Helm-Toolkit: Resolve final deltas between OSH and OSH-Infra
This PS removes the remaining deltas between OSH and OSH-Infra Change-Id: Ia322b7b62a5b755674d1a244748266e36edcfb8c
This commit is contained in:
parent
dd92edfb58
commit
0aace1705f
@ -1,9 +1,12 @@
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -1,9 +1,12 @@
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -16,52 +16,63 @@ limitations under the License.
|
||||
|
||||
{{- define "helm-toolkit.scripts.rabbit_init" }}
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
set -e
|
||||
# Extract connection details
|
||||
RABBIT_HOSTNAME=`echo $RABBITMQ_ADMIN_CONNECTION | awk -F'[@]' '{print $2}' \
|
||||
| awk -F'[:/]' '{print $1}'`
|
||||
RABBIT_PORT=`echo $RABBITMQ_ADMIN_CONNECTION | awk -F'[@]' '{print $2}' \
|
||||
| awk -F'[:/]' '{print $2}'`
|
||||
RABBIT_HOSTNAME=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \
|
||||
awk -F'[@]' '{print $2}' | \
|
||||
awk -F'[:/]' '{print $1}')
|
||||
RABBIT_PORT=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \
|
||||
awk -F'[@]' '{print $2}' | \
|
||||
awk -F'[:/]' '{print $2}')
|
||||
|
||||
# Extract Admin User creadential
|
||||
RABBITMQ_ADMIN_USERNAME=`echo $RABBITMQ_ADMIN_CONNECTION | awk -F'[@]' '{print $1}' \
|
||||
| awk -F'[//:]' '{print $4}'`
|
||||
RABBITMQ_ADMIN_PASSWORD=`echo $RABBITMQ_ADMIN_CONNECTION | awk -F'[@]' '{print $1}' \
|
||||
| awk -F'[//:]' '{print $5}'`
|
||||
RABBITMQ_ADMIN_USERNAME=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \
|
||||
awk -F'[@]' '{print $1}' | \
|
||||
awk -F'[//:]' '{print $4}')
|
||||
RABBITMQ_ADMIN_PASSWORD=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \
|
||||
awk -F'[@]' '{print $1}' | \
|
||||
awk -F'[//:]' '{print $5}')
|
||||
|
||||
# Extract User creadential
|
||||
RABBITMQ_USERNAME=`echo $RABBITMQ_USER_CONNECTION | awk -F'[@]' '{print $1}' \
|
||||
| awk -F'[//:]' '{print $4}'`
|
||||
RABBITMQ_PASSWORD=`echo $RABBITMQ_USER_CONNECTION | awk -F'[@]' '{print $1}' \
|
||||
| awk -F'[//:]' '{print $5}'`
|
||||
RABBITMQ_USERNAME=$(echo "${RABBITMQ_USER_CONNECTION}" | \
|
||||
awk -F'[@]' '{print $1}' | \
|
||||
awk -F'[//:]' '{print $4}')
|
||||
RABBITMQ_PASSWORD=$(echo "${RABBITMQ_USER_CONNECTION}" | \
|
||||
awk -F'[@]' '{print $1}' | \
|
||||
awk -F'[//:]' '{print $5}')
|
||||
|
||||
# Using admin creadential, list current rabbitmq users
|
||||
rabbitmqadmin --host=$RABBIT_HOSTNAME --port=$RABBIT_PORT \
|
||||
--username=$RABBITMQ_ADMIN_USERNAME --password=$RABBITMQ_ADMIN_PASSWORD \
|
||||
list users
|
||||
# Extract User vHost
|
||||
RABBITMQ_VHOST=$(echo "${RABBITMQ_USER_CONNECTION}" | \
|
||||
awk -F'[@]' '{print $2}' | \
|
||||
awk -F'[:/]' '{print $3}')
|
||||
|
||||
# if user already exist, credentials will be overwritten
|
||||
# Using admin creadential, adding new admin rabbitmq user"
|
||||
rabbitmqadmin --host=$RABBIT_HOSTNAME --port=$RABBIT_PORT \
|
||||
--username=$RABBITMQ_ADMIN_USERNAME --password=$RABBITMQ_ADMIN_PASSWORD \
|
||||
declare user name=$RABBITMQ_USERNAME password=$RABBITMQ_PASSWORD \
|
||||
tags="administrator"
|
||||
function rabbitmqadmin_cli () {
|
||||
rabbitmqadmin \
|
||||
--host="${RABBIT_HOSTNAME}" \
|
||||
--port="${RABBIT_PORT}" \
|
||||
--username="${RABBITMQ_ADMIN_USERNAME}" \
|
||||
--password="${RABBITMQ_ADMIN_PASSWORD}" \
|
||||
${@}
|
||||
}
|
||||
|
||||
# Declare permissions for new user
|
||||
rabbitmqadmin --host=$RABBIT_HOSTNAME --port=$RABBIT_PORT \
|
||||
--username=$RABBITMQ_ADMIN_USERNAME --password=$RABBITMQ_ADMIN_PASSWORD \
|
||||
declare permission vhost="/" user=$RABBITMQ_USERNAME \
|
||||
configure=".*" write=".*" read=".*"
|
||||
echo "Managing: User: ${RABBITMQ_USERNAME}"
|
||||
rabbitmqadmin_cli \
|
||||
declare user \
|
||||
name="${RABBITMQ_USERNAME}" \
|
||||
password="${RABBITMQ_PASSWORD}" \
|
||||
tags="user"
|
||||
|
||||
# Using new user creadential, list current rabbitmq users
|
||||
rabbitmqadmin --host=$RABBIT_HOSTNAME --port=$RABBIT_PORT \
|
||||
--username=$RABBITMQ_USERNAME --password=$RABBITMQ_PASSWORD \
|
||||
list users
|
||||
|
||||
# Using new user creadential, list permissions
|
||||
rabbitmqadmin --host=$RABBIT_HOSTNAME --port=$RABBIT_PORT \
|
||||
--username=$RABBITMQ_USERNAME --password=$RABBITMQ_PASSWORD \
|
||||
list permissions
|
||||
echo "Managing: vHost: ${RABBITMQ_VHOST}"
|
||||
rabbitmqadmin_cli \
|
||||
declare vhost \
|
||||
name="${RABBITMQ_VHOST}"
|
||||
|
||||
echo "Managing: Permissions: ${RABBITMQ_USERNAME} on ${RABBITMQ_VHOST}"
|
||||
rabbitmqadmin_cli \
|
||||
declare permission \
|
||||
vhost="${RABBITMQ_VHOST}" \
|
||||
user="${RABBITMQ_USERNAME}" \
|
||||
configure=".*" \
|
||||
write=".*" \
|
||||
read=".*"
|
||||
{{- end }}
|
||||
|
@ -22,10 +22,18 @@ limitations under the License.
|
||||
{{- $_ := set $envAll.Values "__kubernetes_entrypoint_init_container" dict -}}
|
||||
{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" dict -}}
|
||||
{{- if and ($envAll.Values.images.local_registry.active) (ne $component "image_repo_sync") -}}
|
||||
{{- if eq $component "pod_dependency" -}}
|
||||
{{- $_ := include "helm-toolkit.utils.merge" ( tuple $envAll.Values.__kubernetes_entrypoint_init_container.deps ( index $envAll.Values.pod_dependency ) $envAll.Values.dependencies.dynamic.common.local_image_registry ) -}}
|
||||
{{- else -}}
|
||||
{{- $_ := include "helm-toolkit.utils.merge" ( tuple $envAll.Values.__kubernetes_entrypoint_init_container.deps ( index $envAll.Values.dependencies.static $component ) $envAll.Values.dependencies.dynamic.common.local_image_registry ) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if eq $component "pod_dependency" -}}
|
||||
{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.pod_dependency ) -}}
|
||||
{{- else -}}
|
||||
{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.dependencies.static $component ) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $deps := $envAll.Values.__kubernetes_entrypoint_init_container.deps }}
|
||||
|
||||
- name: init
|
||||
|
@ -25,12 +25,19 @@ limitations under the License.
|
||||
{{- $_ := set $envAll.Values "__kubernetes_entrypoint_init_container" dict -}}
|
||||
{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" dict -}}
|
||||
{{- if and ($envAll.Values.images.local_registry.active) (ne $component "image_repo_sync") -}}
|
||||
{{- if eq $component "pod_dependency" -}}
|
||||
{{- $_ := include "helm-toolkit.utils.merge" ( tuple $envAll.Values.__kubernetes_entrypoint_init_container.deps ( index $envAll.Values.pod_dependency ) $envAll.Values.dependencies.dynamic.common.local_image_registry ) -}}
|
||||
{{- else -}}
|
||||
{{- $_ := include "helm-toolkit.utils.merge" ( tuple $envAll.Values.__kubernetes_entrypoint_init_container.deps ( index $envAll.Values.dependencies.static $component ) $envAll.Values.dependencies.dynamic.common.local_image_registry ) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if eq $component "pod_dependency" -}}
|
||||
{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.pod_dependency ) -}}
|
||||
{{- else -}}
|
||||
{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.dependencies.static $component ) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $deps := $envAll.Values.__kubernetes_entrypoint_init_container.deps }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
|
Loading…
Reference in New Issue
Block a user