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:
Pete Birley 2018-05-12 12:44:19 -05:00
parent dd92edfb58
commit 0aace1705f
5 changed files with 71 additions and 39 deletions

View File

@ -1,9 +1,12 @@
{{/* {{/*
Copyright 2017 The Openstack-Helm Authors. Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@ -1,9 +1,12 @@
{{/* {{/*
Copyright 2017 The Openstack-Helm Authors. Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@ -16,52 +16,63 @@ limitations under the License.
{{- define "helm-toolkit.scripts.rabbit_init" }} {{- define "helm-toolkit.scripts.rabbit_init" }}
#!/bin/bash #!/bin/bash
set -ex set -e
# Extract connection details # Extract connection details
RABBIT_HOSTNAME=`echo $RABBITMQ_ADMIN_CONNECTION | awk -F'[@]' '{print $2}' \ RABBIT_HOSTNAME=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \
| awk -F'[:/]' '{print $1}'` awk -F'[@]' '{print $2}' | \
RABBIT_PORT=`echo $RABBITMQ_ADMIN_CONNECTION | awk -F'[@]' '{print $2}' \ awk -F'[:/]' '{print $1}')
| awk -F'[:/]' '{print $2}'` RABBIT_PORT=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \
awk -F'[@]' '{print $2}' | \
awk -F'[:/]' '{print $2}')
# Extract Admin User creadential # Extract Admin User creadential
RABBITMQ_ADMIN_USERNAME=`echo $RABBITMQ_ADMIN_CONNECTION | awk -F'[@]' '{print $1}' \ RABBITMQ_ADMIN_USERNAME=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \
| awk -F'[//:]' '{print $4}'` awk -F'[@]' '{print $1}' | \
RABBITMQ_ADMIN_PASSWORD=`echo $RABBITMQ_ADMIN_CONNECTION | awk -F'[@]' '{print $1}' \ awk -F'[//:]' '{print $4}')
| awk -F'[//:]' '{print $5}'` RABBITMQ_ADMIN_PASSWORD=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \
awk -F'[@]' '{print $1}' | \
awk -F'[//:]' '{print $5}')
# Extract User creadential # Extract User creadential
RABBITMQ_USERNAME=`echo $RABBITMQ_USER_CONNECTION | awk -F'[@]' '{print $1}' \ RABBITMQ_USERNAME=$(echo "${RABBITMQ_USER_CONNECTION}" | \
| awk -F'[//:]' '{print $4}'` awk -F'[@]' '{print $1}' | \
RABBITMQ_PASSWORD=`echo $RABBITMQ_USER_CONNECTION | awk -F'[@]' '{print $1}' \ awk -F'[//:]' '{print $4}')
| awk -F'[//:]' '{print $5}'` RABBITMQ_PASSWORD=$(echo "${RABBITMQ_USER_CONNECTION}" | \
awk -F'[@]' '{print $1}' | \
awk -F'[//:]' '{print $5}')
# Using admin creadential, list current rabbitmq users # Extract User vHost
rabbitmqadmin --host=$RABBIT_HOSTNAME --port=$RABBIT_PORT \ RABBITMQ_VHOST=$(echo "${RABBITMQ_USER_CONNECTION}" | \
--username=$RABBITMQ_ADMIN_USERNAME --password=$RABBITMQ_ADMIN_PASSWORD \ awk -F'[@]' '{print $2}' | \
list users awk -F'[:/]' '{print $3}')
# if user already exist, credentials will be overwritten function rabbitmqadmin_cli () {
# Using admin creadential, adding new admin rabbitmq user" rabbitmqadmin \
rabbitmqadmin --host=$RABBIT_HOSTNAME --port=$RABBIT_PORT \ --host="${RABBIT_HOSTNAME}" \
--username=$RABBITMQ_ADMIN_USERNAME --password=$RABBITMQ_ADMIN_PASSWORD \ --port="${RABBIT_PORT}" \
declare user name=$RABBITMQ_USERNAME password=$RABBITMQ_PASSWORD \ --username="${RABBITMQ_ADMIN_USERNAME}" \
tags="administrator" --password="${RABBITMQ_ADMIN_PASSWORD}" \
${@}
}
# Declare permissions for new user echo "Managing: User: ${RABBITMQ_USERNAME}"
rabbitmqadmin --host=$RABBIT_HOSTNAME --port=$RABBIT_PORT \ rabbitmqadmin_cli \
--username=$RABBITMQ_ADMIN_USERNAME --password=$RABBITMQ_ADMIN_PASSWORD \ declare user \
declare permission vhost="/" user=$RABBITMQ_USERNAME \ name="${RABBITMQ_USERNAME}" \
configure=".*" write=".*" read=".*" password="${RABBITMQ_PASSWORD}" \
tags="user"
# Using new user creadential, list current rabbitmq users echo "Managing: vHost: ${RABBITMQ_VHOST}"
rabbitmqadmin --host=$RABBIT_HOSTNAME --port=$RABBIT_PORT \ rabbitmqadmin_cli \
--username=$RABBITMQ_USERNAME --password=$RABBITMQ_PASSWORD \ declare vhost \
list users name="${RABBITMQ_VHOST}"
# Using new user creadential, list permissions
rabbitmqadmin --host=$RABBIT_HOSTNAME --port=$RABBIT_PORT \
--username=$RABBITMQ_USERNAME --password=$RABBITMQ_PASSWORD \
list permissions
echo "Managing: Permissions: ${RABBITMQ_USERNAME} on ${RABBITMQ_VHOST}"
rabbitmqadmin_cli \
declare permission \
vhost="${RABBITMQ_VHOST}" \
user="${RABBITMQ_USERNAME}" \
configure=".*" \
write=".*" \
read=".*"
{{- end }} {{- end }}

View File

@ -22,10 +22,18 @@ limitations under the License.
{{- $_ := set $envAll.Values "__kubernetes_entrypoint_init_container" dict -}} {{- $_ := set $envAll.Values "__kubernetes_entrypoint_init_container" dict -}}
{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" dict -}} {{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" dict -}}
{{- if and ($envAll.Values.images.local_registry.active) (ne $component "image_repo_sync") -}} {{- 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 ) -}} {{- $_ := 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 -}} {{- else -}}
{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.dependencies.static $component ) -}} {{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.dependencies.static $component ) -}}
{{- end -}} {{- end -}}
{{- end -}}
{{- $deps := $envAll.Values.__kubernetes_entrypoint_init_container.deps }} {{- $deps := $envAll.Values.__kubernetes_entrypoint_init_container.deps }}
- name: init - name: init

View File

@ -25,12 +25,19 @@ limitations under the License.
{{- $_ := set $envAll.Values "__kubernetes_entrypoint_init_container" dict -}} {{- $_ := set $envAll.Values "__kubernetes_entrypoint_init_container" dict -}}
{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" dict -}} {{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" dict -}}
{{- if and ($envAll.Values.images.local_registry.active) (ne $component "image_repo_sync") -}} {{- 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 ) -}} {{- $_ := 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 -}} {{- else -}}
{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.dependencies.static $component ) -}} {{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.dependencies.static $component ) -}}
{{- end -}} {{- end -}}
{{- end -}}
{{- $deps := $envAll.Values.__kubernetes_entrypoint_init_container.deps }} {{- $deps := $envAll.Values.__kubernetes_entrypoint_init_container.deps }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount