Update Glance Keystone Jobs to match common architecture

This commit is contained in:
Pete Birley 2017-03-15 10:57:21 -05:00
parent 3e62cd54e2
commit a5e1d7c608
8 changed files with 271 additions and 50 deletions

View File

@ -19,5 +19,9 @@ metadata:
data: data:
init.sh: |+ init.sh: |+
{{ tuple "bin/_init.sh.tpl" . | include "helm-toolkit.template" | indent 4 }} {{ tuple "bin/_init.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
post.sh: |+ ks-service.sh: |+
{{ tuple "bin/_post.sh.tpl" . | include "helm-toolkit.template" | indent 4 }} {{- include "helm-toolkit.keystone_service" . | indent 4 }}
ks-endpoints.sh: |+
{{- include "helm-toolkit.keystone_endpoints" . | indent 4 }}
ks-user.sh: |+
{{- include "helm-toolkit.keystone_user" . | indent 4 }}

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
{{- $envAll := . }} {{- $envAll := . }}
{{- $dependencies := .Values.dependencies.init }} {{- $dependencies := .Values.dependencies.db_init }}
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:

View File

@ -0,0 +1,73 @@
# 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.
# See the License for the specific language governing permissions and
# limitations under the License.
{{- $envAll := . }}
{{- $ksAdminSecret := $envAll.Values.keystone.admin_secret | default "glance-env-keystone-admin" }}
{{- $dependencies := .Values.dependencies.ks_endpoints }}
apiVersion: batch/v1
kind: Job
metadata:
name: glance-ks-endpoints
spec:
template:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
]'
spec:
restartPolicy: OnFailure
nodeSelector:
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
containers:
{{- range $key1, $osServiceType := tuple "image" }}
{{- range $key2, $osServiceEndPoint := tuple "admin" "internal" "public" }}
- name: {{ $osServiceType }}-ks-endpoints-{{ $osServiceEndPoint }}
image: {{ $envAll.Values.images.ks_endpoints }}
imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
{{- if $envAll.Values.resources.enabled }}
resources:
requests:
memory: {{ $envAll.Values.resources.glance_ks_endpoints.requests.memory | quote }}
cpu: {{ $envAll.Values.resources.glance_ks_endpoints.requests.cpu | quote }}
limits:
memory: {{ $envAll.Values.resources.glance_ks_endpoints.limits.memory | quote }}
cpu: {{ $envAll.Values.resources.glance_ks_endpoints.limits.cpu | quote }}
{{- end }}
command:
- bash
- /tmp/ks-endpoints.sh
volumeMounts:
- name: ks-endpoints-sh
mountPath: /tmp/ks-endpoints.sh
subPath: ks-endpoints.sh
readOnly: true
env:
{{- with $env := dict "ksUserSecret" $ksAdminSecret }}
{{- include "helm-toolkit.keystone_openrc_env_vars" $env | indent 12 }}
{{- end }}
- name: OS_SVC_ENDPOINT
value: {{ $osServiceEndPoint }}
- name: OS_SERVICE_NAME
value: {{ tuple $osServiceType $envAll | include "helm-toolkit.keystone_endpoint_name_lookup" }}
- name: OS_SERVICE_TYPE
value: {{ $osServiceType }}
- name: OS_SERVICE_ENDPOINT
value: {{ tuple $osServiceType $osServiceEndPoint "api" $envAll | include "helm-toolkit.keystone_endpoint_uri_lookup" }}
{{- end }}
{{- end }}
volumes:
- name: ks-endpoints-sh
configMap:
name: glance-bin

View File

@ -0,0 +1,67 @@
# 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.
# See the License for the specific language governing permissions and
# limitations under the License.
{{- $envAll := . }}
{{- $ksAdminSecret := .Values.keystone.admin_secret | default "glance-env-keystone-admin" }}
{{- $dependencies := .Values.dependencies.ks_service }}
apiVersion: batch/v1
kind: Job
metadata:
name: glance-ks-service
spec:
template:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
]'
spec:
restartPolicy: OnFailure
nodeSelector:
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
containers:
{{- range $key1, $osServiceType := tuple "image" }}
- name: {{ $osServiceType }}-ks-service-registration
image: {{ $envAll.Values.images.ks_service }}
imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
{{- if $envAll.Values.resources.enabled }}
resources:
requests:
memory: {{ $envAll.Values.resources.glance_ks_service.requests.memory | quote }}
cpu: {{ $envAll.Values.resources.glance_ks_service.requests.cpu | quote }}
limits:
memory: {{ $envAll.Values.resources.glance_ks_service.limits.memory | quote }}
cpu: {{ $envAll.Values.resources.glance_ks_service.limits.cpu | quote }}
{{- end }}
command:
- bash
- /tmp/ks-service.sh
volumeMounts:
- name: ks-service-sh
mountPath: /tmp/ks-service.sh
subPath: ks-service.sh
readOnly: true
env:
{{- with $env := dict "ksUserSecret" $ksAdminSecret }}
{{- include "helm-toolkit.keystone_openrc_env_vars" $env | indent 12 }}
{{- end }}
- name: OS_SERVICE_NAME
value: {{ tuple $osServiceType $envAll | include "helm-toolkit.keystone_endpoint_name_lookup" }}
- name: OS_SERVICE_TYPE
value: {{ $osServiceType }}
{{- end }}
volumes:
- name: ks-service-sh
configMap:
name: glance-bin

View File

@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
{{- $ksAdminSecret := .Values.keystone.admin_secret | default "glance-env-keystone-admin" }}
{{- $ksUserSecret := .Values.keystone.user_secret | default "glance-env-keystone-user" }}
{{- $envAll := . }} {{- $envAll := . }}
{{- $dependencies := .Values.dependencies.post }} {{- $dependencies := .Values.dependencies.ks_user }}
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: glance-post name: glance-ks-user
spec: spec:
template: template:
metadata: metadata:
@ -26,33 +28,42 @@ spec:
{{ tuple $envAll $dependencies | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }} {{ tuple $envAll $dependencies | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
]' ]'
spec: spec:
restartPolicy: OnFailure
nodeSelector: nodeSelector:
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
restartPolicy: OnFailure
containers: containers:
- name: glance-post - name: glance-ks-user
image: {{ .Values.images.post }} image: {{ .Values.images.ks_user }}
imagePullPolicy: {{ .Values.images.pull_policy }} imagePullPolicy: {{ .Values.images.pull_policy }}
{{- if .Values.resources.enabled }} {{- if .Values.resources.enabled }}
resources: resources:
limits:
cpu: {{ .Values.resources.jobs.post.limits.cpu | quote }}
memory: {{ .Values.resources.jobs.post.limits.memory | quote }}
requests: requests:
cpu: {{ .Values.resources.jobs.post.requests.cpu | quote }} memory: {{ .Values.resources.glance_ks_user.requests.memory | quote }}
memory: {{ .Values.resources.jobs.post.requests.memory | quote }} cpu: {{ .Values.resources.glance_ks_user.requests.cpu | quote }}
limits:
memory: {{ .Values.resources.glance_ks_user.limits.memory | quote }}
cpu: {{ .Values.resources.glance_ks_user.limits.cpu | quote }}
{{- end }} {{- end }}
command: command:
- bash - bash
- /tmp/post.sh - /tmp/ks-user.sh
volumeMounts: volumeMounts:
- name: postsh - name: ks-user-sh
mountPath: /tmp/post.sh mountPath: /tmp/ks-user.sh
subPath: post.sh subPath: ks-user.sh
readOnly: true
env: env:
- name: ANSIBLE_LIBRARY {{- with $env := dict "ksUserSecret" $ksAdminSecret }}
value: /usr/share/ansible/ {{- include "helm-toolkit.keystone_openrc_env_vars" $env | indent 12 }}
{{- end }}
- name: SERVICE_OS_SERVICE_NAME
value: "glance"
{{- with $env := dict "ksUserSecret" $ksUserSecret }}
{{- include "helm-toolkit.keystone_user_create_env_vars" $env | indent 12 }}
{{- end }}
- name: SERVICE_OS_ROLE
value: {{ .Values.keystone.glance_user_role | quote }}
volumes: volumes:
- name: postsh - name: ks-user-sh
configMap: configMap:
name: glance-bin name: glance-bin

View File

@ -0,0 +1,34 @@
# 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.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: v1
kind: Secret
metadata:
name: glance-env-keystone-admin
type: Opaque
data:
OS_AUTH_URL: |
{{ tuple "identity" "admin" "admin" . | include "helm-toolkit.keystone_endpoint_uri_lookup" | b64enc | indent 4 }}
OS_REGION_NAME: |
{{ .Values.keystone.admin_region_name | b64enc | indent 4 }}
OS_PROJECT_DOMAIN_NAME: |
{{ .Values.keystone.admin_project_domain | b64enc | indent 4 }}
OS_PROJECT_NAME: |
{{ .Values.keystone.admin_project_name | b64enc | indent 4 }}
OS_USER_DOMAIN_NAME: |
{{ .Values.keystone.admin_user_domain | b64enc | indent 4 }}
OS_USERNAME: |
{{ .Values.keystone.admin_user | b64enc | indent 4 }}
OS_PASSWORD: |
{{ .Values.keystone.admin_password | b64enc | indent 4 }}

View File

@ -0,0 +1,34 @@
# 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.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: v1
kind: Secret
metadata:
name: glance-env-keystone-user
type: Opaque
data:
OS_AUTH_URL: |
{{ tuple "identity" "internal" "api" . | include "helm-toolkit.keystone_endpoint_uri_lookup" | b64enc | indent 4 }}
OS_REGION_NAME: |
{{ .Values.keystone.glance_region_name | b64enc | indent 4 }}
OS_PROJECT_DOMAIN_NAME: |
{{ .Values.keystone.glance_project_domain | b64enc | indent 4 }}
OS_PROJECT_NAME: |
{{ .Values.keystone.glance_project_name | b64enc | indent 4 }}
OS_USER_DOMAIN_NAME: |
{{ .Values.keystone.glance_user_domain | b64enc | indent 4 }}
OS_USERNAME: |
{{ .Values.keystone.glance_user | b64enc | indent 4 }}
OS_PASSWORD: |
{{ .Values.keystone.glance_password | b64enc | indent 4 }}

View File

@ -32,9 +32,11 @@ labels:
images: images:
db_init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton db_init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton
db_sync: quay.io/stackanetes/stackanetes-glance-api:newton db_sync: quay.io/stackanetes/stackanetes-glance-api:newton
ks_user: quay.io/stackanetes/stackanetes-kolla-toolbox:newton
ks_service: quay.io/stackanetes/stackanetes-kolla-toolbox:newton
ks_endpoints: quay.io/stackanetes/stackanetes-kolla-toolbox:newton
api: quay.io/stackanetes/stackanetes-glance-api:newton api: quay.io/stackanetes/stackanetes-glance-api:newton
registry: quay.io/stackanetes/stackanetes-glance-registry:newton registry: quay.io/stackanetes/stackanetes-glance-registry:newton
post: quay.io/stackanetes/stackanetes-kolla-toolbox:newton
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.1.0 dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.1.0
pull_policy: "IfNotPresent" pull_policy: "IfNotPresent"
@ -129,48 +131,44 @@ resources:
cpu: "500m" cpu: "500m"
dependencies: dependencies:
api: db_init:
jobs:
- mariadb-seed
service:
- mariadb
db_sync:
jobs: jobs:
- glance-db-init - glance-db-init
service:
- mariadb
ks_user:
service:
- keystone-api
ks_service:
service:
- keystone-api
ks_endpoints:
jobs:
- glance-ks-service
service:
- keystone-api
api:
jobs:
- glance-db-sync - glance-db-sync
- keystone-db-sync - glance-ks-user
- glance-ks-endpoints
service: service:
- keystone-api - keystone-api
- mariadb - mariadb
registry: registry:
jobs: jobs:
- glance-db-init
- glance-db-sync - glance-db-sync
- keystone-db-sync - glance-ks-user
- glance-ks-endpoints
service: service:
- keystone-api - keystone-api
- mariadb - mariadb
- glance-api - glance-api
db_sync:
jobs:
- keystone-db-init
- keystone-db-sync
- glance-db-init
- mariadb-seed
service:
- mariadb
init:
jobs:
- mariadb-seed
service:
- mariadb
post:
jobs:
- glance-db-init
- glance-db-sync
- keystone-db-sync
- keystone-db-init
- mariadb-seed
service:
- mariadb
- keystone-api
- glance-api
- glance-registry
# typically overriden by environmental # typically overriden by environmental
# values, but should include all endpoints # values, but should include all endpoints