From c5bbc97ab7197e5561eccdf6539a0f04af7e93da Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Sat, 1 Jul 2017 12:00:56 -0500 Subject: [PATCH] Soft pod anti-affinity for all pods This PS adds soft anti-affinity to all pods in OS-H. By doing so resiliancy is improved by attempting to ensure that pods are created on seperate nodes. Change-Id: I0c1092498f7a1e44218ef785ca3f73fa9f49819c --- barbican/templates/deployment-api.yaml | 8 +++- barbican/templates/pdb-api.yaml | 17 ++++++++- barbican/templates/service-api.yaml | 7 +++- cinder/templates/deployment-api.yaml | 6 ++- cinder/templates/deployment-backup.yaml | 6 ++- cinder/templates/deployment-scheduler.yaml | 6 ++- cinder/templates/deployment-volume.yaml | 6 ++- cinder/templates/pdb-api.yaml | 17 ++++++++- cinder/templates/service-api.yaml | 5 ++- glance/templates/deployment-api.yaml | 5 ++- glance/templates/deployment-registry.yaml | 5 ++- glance/templates/pdb-api.yaml | 17 ++++++++- glance/templates/pdb-registry.yaml | 17 ++++++++- glance/templates/service-api.yaml | 5 ++- glance/templates/service-registry.yaml | 5 ++- heat/templates/deployment-api.yaml | 5 ++- heat/templates/deployment-cfn.yaml | 5 ++- heat/templates/deployment-cloudwatch.yaml | 5 ++- heat/templates/pdb-api.yaml | 17 ++++++++- heat/templates/pdb-cfn.yaml | 17 ++++++++- heat/templates/pdb-cloudwatch.yaml | 17 ++++++++- heat/templates/service-api.yaml | 5 ++- heat/templates/service-cfn.yaml | 5 ++- heat/templates/service-cloudwatch.yaml | 5 ++- heat/templates/statefulset-engine.yaml | 5 ++- .../snippets/_k8s_metadata_labels.tpl | 22 +++++++++++ .../snippets/_k8s_pod_antiaffinity.tpl | 38 +++++++++++++++++++ horizon/templates/deployment.yaml | 5 ++- horizon/templates/pdb.yaml | 17 ++++++++- horizon/templates/service.yaml | 5 ++- keystone/templates/deployment.yaml | 6 ++- keystone/templates/job-bootstrap.yaml | 1 + keystone/templates/pdb.yaml | 17 ++++++++- keystone/templates/service.yaml | 5 ++- magnum/templates/deployment-api.yaml | 5 ++- magnum/templates/pdb-api.yaml | 17 ++++++++- magnum/templates/service-api.yaml | 5 ++- magnum/templates/statefulset-conductor.yaml | 5 ++- mariadb/templates/pdb-mariadb.yaml | 17 ++++++++- mariadb/templates/service-discovery.yaml | 4 +- mariadb/templates/service.yaml | 5 ++- mariadb/templates/statefulset.yaml | 20 ++-------- memcached/templates/deployment.yaml | 7 +++- memcached/templates/service.yaml | 5 ++- mistral/templates/deployment-api.yaml | 6 ++- mistral/templates/deployment-executor.yaml | 6 ++- mistral/templates/pdb-api.yaml | 17 ++++++++- mistral/templates/service-api.yaml | 5 ++- .../templates/statefulset-event-engine.yaml | 6 ++- neutron/templates/daemonset-dhcp-agent.yaml | 3 +- neutron/templates/daemonset-l3-agent.yaml | 3 +- .../templates/daemonset-metadata-agent.yaml | 3 +- neutron/templates/daemonset-ovs-agent.yaml | 3 +- neutron/templates/daemonset-ovs-db.yaml | 5 ++- neutron/templates/daemonset-ovs-vswitchd.yaml | 5 ++- neutron/templates/deployment-server.yaml | 5 ++- neutron/templates/pdb-server.yaml | 17 ++++++++- neutron/templates/service.yaml | 5 ++- nova/templates/daemonset-compute.yaml | 4 +- nova/templates/daemonset-libvirt.yaml | 3 +- nova/templates/deployment-api-metadata.yaml | 5 ++- nova/templates/deployment-api-osapi.yaml | 5 ++- nova/templates/deployment-conductor.yaml | 5 ++- nova/templates/deployment-consoleauth.yaml | 6 ++- nova/templates/deployment-scheduler.yaml | 6 ++- nova/templates/pdb-metadata.yaml | 17 ++++++++- nova/templates/pdb-osapi.yaml | 17 ++++++++- nova/templates/service-metadata.yaml | 5 ++- nova/templates/service-osapi.yaml | 5 ++- rabbitmq/templates/deployment.yaml | 14 +------ rabbitmq/templates/service.yaml | 5 ++- senlin/templates/deployment-api.yaml | 6 ++- senlin/templates/pdb-api.yaml | 17 ++++++++- senlin/templates/service-api.yaml | 5 ++- senlin/templates/statefulset-engine.yaml | 5 ++- tools/gate/openstack_aio_launch.sh | 8 ++-- 76 files changed, 514 insertions(+), 137 deletions(-) create mode 100644 helm-toolkit/templates/snippets/_k8s_metadata_labels.tpl create mode 100644 helm-toolkit/templates/snippets/_k8s_pod_antiaffinity.tpl diff --git a/barbican/templates/deployment-api.yaml b/barbican/templates/deployment-api.yaml index 6f53719e4c..ccf434ba76 100644 --- a/barbican/templates/deployment-api.yaml +++ b/barbican/templates/deployment-api.yaml @@ -1,3 +1,5 @@ +# 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 @@ -9,11 +11,11 @@ # 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 := . }} {{- $dependencies := .Values.dependencies.api }} {{- $mounts_barbican_api := .Values.mounts.barbican_api.barbican_api }} {{- $mounts_barbican_api_init := .Values.mounts.barbican_api.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -31,11 +33,13 @@ spec: template: metadata: labels: - app: barbican-api +{{ tuple $envAll "barbican" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "barbican" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} initContainers: diff --git a/barbican/templates/pdb-api.yaml b/barbican/templates/pdb-api.yaml index ce62b01733..5691b6ab24 100644 --- a/barbican/templates/pdb-api.yaml +++ b/barbican/templates/pdb-api.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.api.min_available }} selector: matchLabels: - app: barbican-api \ No newline at end of file +{{ tuple $envAll "barbican" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/barbican/templates/service-api.yaml b/barbican/templates/service-api.yaml index 19186b4d24..094da7a21b 100644 --- a/barbican/templates/service-api.yaml +++ b/barbican/templates/service-api.yaml @@ -1,3 +1,5 @@ +# 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 @@ -9,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -22,7 +25,7 @@ spec: nodePort: .Values.network.api.node_port.port {{ end }} selector: - app: barbican-api +{{ tuple $envAll "barbican" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.api.node_port.enabled }} type: NodePort {{ end }} diff --git a/cinder/templates/deployment-api.yaml b/cinder/templates/deployment-api.yaml index 73a1f0d09f..0f5525c02e 100644 --- a/cinder/templates/deployment-api.yaml +++ b/cinder/templates/deployment-api.yaml @@ -15,7 +15,7 @@ {{- $dependencies := .Values.dependencies.api }} {{- $mounts_cinder_api := .Values.mounts.cinder_api.cinder_api }} {{- $mounts_cinder_api_init := .Values.mounts.cinder_api.init_container }} - +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +33,13 @@ spec: template: metadata: labels: - app: cinder-api +{{ tuple $envAll "cinder" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "cinder" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.api.timeout | default "30" }} diff --git a/cinder/templates/deployment-backup.yaml b/cinder/templates/deployment-backup.yaml index 55086c2352..dc289944aa 100644 --- a/cinder/templates/deployment-backup.yaml +++ b/cinder/templates/deployment-backup.yaml @@ -15,7 +15,7 @@ {{- $dependencies := .Values.dependencies.backup }} {{- $mounts_cinder_backup := .Values.mounts.cinder_backup.cinder_backup }} {{- $mounts_cinder_backup_init := .Values.mounts.cinder_backup.init_container }} - +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +33,13 @@ spec: template: metadata: labels: - app: cinder-backup +{{ tuple $envAll "cinder" "backup" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "cinder" "backup" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} initContainers: diff --git a/cinder/templates/deployment-scheduler.yaml b/cinder/templates/deployment-scheduler.yaml index 33a66dc113..db21734d8c 100644 --- a/cinder/templates/deployment-scheduler.yaml +++ b/cinder/templates/deployment-scheduler.yaml @@ -15,7 +15,7 @@ {{- $dependencies := .Values.dependencies.scheduler }} {{- $mounts_cinder_scheduler := .Values.mounts.cinder_scheduler.cinder_scheduler }} {{- $mounts_cinder_scheduler_init := .Values.mounts.cinder_scheduler.init_container }} - +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +33,13 @@ spec: template: metadata: labels: - app: cinder-scheduler +{{ tuple $envAll "cinder" "scheduler" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "cinder" "scheduler" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} initContainers: diff --git a/cinder/templates/deployment-volume.yaml b/cinder/templates/deployment-volume.yaml index afe59779c6..a35bbff589 100644 --- a/cinder/templates/deployment-volume.yaml +++ b/cinder/templates/deployment-volume.yaml @@ -15,7 +15,7 @@ {{- $dependencies := .Values.dependencies.volume }} {{- $mounts_cinder_volume := .Values.mounts.cinder_volume.cinder_volume }} {{- $mounts_cinder_volume_init := .Values.mounts.cinder_volume.init_container }} - +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +33,13 @@ spec: template: metadata: labels: - app: cinder-volume +{{ tuple $envAll "cinder" "volume" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "cinder" "volume" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} initContainers: diff --git a/cinder/templates/pdb-api.yaml b/cinder/templates/pdb-api.yaml index 5a36bf5d24..3fe5928278 100644 --- a/cinder/templates/pdb-api.yaml +++ b/cinder/templates/pdb-api.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.api.min_available }} selector: matchLabels: - app: cinder-api \ No newline at end of file +{{ tuple $envAll "cinder" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/cinder/templates/service-api.yaml b/cinder/templates/service-api.yaml index 0fb56d3e69..a45eecc9ec 100644 --- a/cinder/templates/service-api.yaml +++ b/cinder/templates/service-api.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: {{ .Values.network.api.node_port.port }} {{ end }} selector: - app: cinder-api +{{ tuple $envAll "cinder" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.api.node_port.enabled }} type: NodePort {{ end }} diff --git a/glance/templates/deployment-api.yaml b/glance/templates/deployment-api.yaml index 83d5fdca62..072bbb65bd 100644 --- a/glance/templates/deployment-api.yaml +++ b/glance/templates/deployment-api.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.api }} {{- $mounts_glance_api := .Values.mounts.glance_api.glance_api }} {{- $mounts_glance_api_init := .Values.mounts.glance_api.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +34,13 @@ spec: template: metadata: labels: - app: glance-api +{{ tuple $envAll "glance" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "glance" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.api.timeout | default "600" }} diff --git a/glance/templates/deployment-registry.yaml b/glance/templates/deployment-registry.yaml index e9a3256539..895799b2ff 100644 --- a/glance/templates/deployment-registry.yaml +++ b/glance/templates/deployment-registry.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.registry }} {{- $mounts_glance_registry := .Values.mounts.glance_registry.glance_registry }} {{- $mounts_glance_registry_init := .Values.mounts.glance_registry.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -25,11 +26,13 @@ spec: template: metadata: labels: - app: glance-registry +{{ tuple $envAll "glance" "registry" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "glance" "registry" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.registry.timeout | default "600" }} diff --git a/glance/templates/pdb-api.yaml b/glance/templates/pdb-api.yaml index 53f80d28a1..6d60c714ee 100644 --- a/glance/templates/pdb-api.yaml +++ b/glance/templates/pdb-api.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.api.min_available }} selector: matchLabels: - app: glance-api \ No newline at end of file +{{ tuple $envAll "glance" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/glance/templates/pdb-registry.yaml b/glance/templates/pdb-registry.yaml index 7e46e2e50c..fd487aa343 100644 --- a/glance/templates/pdb-registry.yaml +++ b/glance/templates/pdb-registry.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.registry.min_available }} selector: matchLabels: - app: glance-registry \ No newline at end of file +{{ tuple $envAll "glance" "registry" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/glance/templates/service-api.yaml b/glance/templates/service-api.yaml index 8e0813092f..6b1991ff97 100644 --- a/glance/templates/service-api.yaml +++ b/glance/templates/service-api.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: .Values.network.api.node_port.port {{ end }} selector: - app: glance-api +{{ tuple $envAll "glance" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.api.node_port.enabled }} type: NodePort {{ end }} diff --git a/glance/templates/service-registry.yaml b/glance/templates/service-registry.yaml index 0e93cb3694..11ba2f85fa 100644 --- a/glance/templates/service-registry.yaml +++ b/glance/templates/service-registry.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: {{ .Values.network.registry.node_port.port }} {{ end }} selector: - app: glance-registry +{{ tuple $envAll "glance" "registry" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.registry.node_port.enabled }} type: NodePort {{ end }} diff --git a/heat/templates/deployment-api.yaml b/heat/templates/deployment-api.yaml index b2f052358f..c2036f3cd2 100644 --- a/heat/templates/deployment-api.yaml +++ b/heat/templates/deployment-api.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.api }} {{- $mounts_heat_api := .Values.mounts.heat_api.heat_api }} {{- $mounts_heat_api_init := .Values.mounts.heat_api.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +34,13 @@ spec: template: metadata: labels: - app: heat-api +{{ tuple $envAll "heat" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "heat" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.api.timeout | default "30" }} diff --git a/heat/templates/deployment-cfn.yaml b/heat/templates/deployment-cfn.yaml index dc0071b47c..66d03c0d13 100644 --- a/heat/templates/deployment-cfn.yaml +++ b/heat/templates/deployment-cfn.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.cfn }} {{- $mounts_heat_cfn := .Values.mounts.heat_cfn.heat_cfn }} {{- $mounts_heat_cfn_init := .Values.mounts.heat_cfn.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +34,13 @@ spec: template: metadata: labels: - app: heat-cfn +{{ tuple $envAll "heat" "cfn" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "heat" "cfn" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.cfn.timeout | default "30" }} diff --git a/heat/templates/deployment-cloudwatch.yaml b/heat/templates/deployment-cloudwatch.yaml index ca8c569eee..6b8a94d2f9 100644 --- a/heat/templates/deployment-cloudwatch.yaml +++ b/heat/templates/deployment-cloudwatch.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.cloudwatch }} {{- $mounts_heat_cloudwatch := .Values.mounts.heat_cloudwatch.heat_cloudwatch }} {{- $mounts_heat_cloudwatch_init := .Values.mounts.heat_cloudwatch.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +34,13 @@ spec: template: metadata: labels: - app: heat-cloudwatch +{{ tuple $envAll "heat" "cloudwatch" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "heat" "cloudwatch" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.cloudwatch.timeout | default "30" }} diff --git a/heat/templates/pdb-api.yaml b/heat/templates/pdb-api.yaml index 6370f46bac..f3797af0df 100644 --- a/heat/templates/pdb-api.yaml +++ b/heat/templates/pdb-api.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.api.min_available }} selector: matchLabels: - app: heat-api \ No newline at end of file +{{ tuple $envAll "heat" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/heat/templates/pdb-cfn.yaml b/heat/templates/pdb-cfn.yaml index 8d5c8699fb..1c07f47282 100644 --- a/heat/templates/pdb-cfn.yaml +++ b/heat/templates/pdb-cfn.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.cfn.min_available }} selector: matchLabels: - app: heat-cfn \ No newline at end of file +{{ tuple $envAll "heat" "cfn" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/heat/templates/pdb-cloudwatch.yaml b/heat/templates/pdb-cloudwatch.yaml index 39906dbb6f..9cf374ea5a 100644 --- a/heat/templates/pdb-cloudwatch.yaml +++ b/heat/templates/pdb-cloudwatch.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.cloudwatch.min_available }} selector: matchLabels: - app: heat-cloudwatch \ No newline at end of file +{{ tuple $envAll "heat" "cloudwatch" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/heat/templates/service-api.yaml b/heat/templates/service-api.yaml index a5b6c9f6e0..87d1f367f1 100644 --- a/heat/templates/service-api.yaml +++ b/heat/templates/service-api.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: {{ .Values.network.api.node_port.port }} {{ end }} selector: - app: heat-api +{{ tuple $envAll "heat" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.api.node_port.enabled }} type: NodePort {{ end }} diff --git a/heat/templates/service-cfn.yaml b/heat/templates/service-cfn.yaml index 89268b6d17..ff539b7059 100644 --- a/heat/templates/service-cfn.yaml +++ b/heat/templates/service-cfn.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: {{ .Values.network.cfn.node_port.port }} {{ end }} selector: - app: heat-cfn +{{ tuple $envAll "heat" "cfn" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.cfn.node_port.enabled }} type: NodePort {{ end }} diff --git a/heat/templates/service-cloudwatch.yaml b/heat/templates/service-cloudwatch.yaml index 04f42dcc5b..2107c67844 100644 --- a/heat/templates/service-cloudwatch.yaml +++ b/heat/templates/service-cloudwatch.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: {{ .Values.network.cloudwatch.node_port.port }} {{ end }} selector: - app: heat-cloudwatch +{{ tuple $envAll "heat" "cloudwatch" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.cloudwatch.node_port.enabled }} type: NodePort {{ end }} diff --git a/heat/templates/statefulset-engine.yaml b/heat/templates/statefulset-engine.yaml index 26333db711..3c47167f9b 100644 --- a/heat/templates/statefulset-engine.yaml +++ b/heat/templates/statefulset-engine.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.engine }} {{- $mounts_heat_engine := .Values.mounts.heat_engine.heat_engine }} {{- $mounts_heat_engine_init := .Values.mounts.heat_engine.init_container }} +--- apiVersion: apps/v1beta1 kind: StatefulSet metadata: @@ -26,8 +27,10 @@ spec: template: metadata: labels: - app: heat-engine +{{ tuple $envAll "heat" "engine" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: + affinity: +{{ tuple $envAll "heat" "engine" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} initContainers: diff --git a/helm-toolkit/templates/snippets/_k8s_metadata_labels.tpl b/helm-toolkit/templates/snippets/_k8s_metadata_labels.tpl new file mode 100644 index 0000000000..1fad10fad3 --- /dev/null +++ b/helm-toolkit/templates/snippets/_k8s_metadata_labels.tpl @@ -0,0 +1,22 @@ +# 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. + +{{- define "helm-toolkit.snippets.kubernetes_metadata_labels" -}} +{{- $envAll := index . 0 -}} +{{- $application := index . 1 -}} +{{- $component := index . 2 -}} +release_name: {{ $envAll.Release.Name }} +application: {{ $application }} +component: {{ $component }} +{{- end -}} diff --git a/helm-toolkit/templates/snippets/_k8s_pod_antiaffinity.tpl b/helm-toolkit/templates/snippets/_k8s_pod_antiaffinity.tpl new file mode 100644 index 0000000000..6fc572c26a --- /dev/null +++ b/helm-toolkit/templates/snippets/_k8s_pod_antiaffinity.tpl @@ -0,0 +1,38 @@ +# 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. + +{{- define "helm-toolkit.snippets.kubernetes_pod_anti_affinity" -}} +{{- $envAll := index . 0 -}} +{{- $application := index . 1 -}} +{{- $component := index . 2 -}} +podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: release_name + operator: In + values: + - {{ $envAll.Release.Name }} + - key: application + operator: In + values: + - {{ $application }} + - key: component + operator: In + values: + - {{ $component }} + topologyKey: kubernetes.io/hostname + weight: 10 +{{- end -}} diff --git a/horizon/templates/deployment.yaml b/horizon/templates/deployment.yaml index a46610fea2..f5380b199f 100644 --- a/horizon/templates/deployment.yaml +++ b/horizon/templates/deployment.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.dashboard }} {{- $mounts_horizon := .Values.mounts.horizon.horizon }} {{- $mounts_horizon_init := .Values.mounts.horizon.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +34,13 @@ spec: template: metadata: labels: - app: horizon +{{ tuple $envAll "horizon" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "horizon" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.horizon.timeout | default "30" }} diff --git a/horizon/templates/pdb.yaml b/horizon/templates/pdb.yaml index ad9f7588a6..3ee602dd8b 100644 --- a/horizon/templates/pdb.yaml +++ b/horizon/templates/pdb.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.horizon.min_available }} selector: matchLabels: - app: horizon \ No newline at end of file +{{ tuple $envAll "horizon" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/horizon/templates/service.yaml b/horizon/templates/service.yaml index d50586eead..f2c2607c03 100644 --- a/horizon/templates/service.yaml +++ b/horizon/templates/service.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -31,7 +32,7 @@ spec: targetPort: {{ .Values.network.port }} {{ end }} selector: - app: horizon +{{ tuple $envAll "horizon" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.enable_node_port }} type: NodePort {{ end }} diff --git a/keystone/templates/deployment.yaml b/keystone/templates/deployment.yaml index 51613ec6a8..49c4c865ed 100644 --- a/keystone/templates/deployment.yaml +++ b/keystone/templates/deployment.yaml @@ -15,7 +15,7 @@ {{- $dependencies := .Values.dependencies.api }} {{- $mounts_keystone_api := .Values.mounts.keystone_api.keystone_api }} {{- $mounts_keystone_api_init := .Values.mounts.keystone_api.init_container }} - +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +33,13 @@ spec: template: metadata: labels: - app: keystone-api +{{ tuple $envAll "keystone" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "keystone" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.api.timeout | default "30" }} diff --git a/keystone/templates/job-bootstrap.yaml b/keystone/templates/job-bootstrap.yaml index d18d307d5e..e399768982 100644 --- a/keystone/templates/job-bootstrap.yaml +++ b/keystone/templates/job-bootstrap.yaml @@ -18,6 +18,7 @@ {{- $dependencies := .Values.dependencies.bootstrap }} {{- $mounts_keystone_bootstrap := .Values.mounts.keystone_bootstrap.keystone_bootstrap }} {{- $mounts_keystone_bootstrap_init := .Values.mounts.keystone_bootstrap.init_container }} + apiVersion: batch/v1 kind: Job metadata: diff --git a/keystone/templates/pdb.yaml b/keystone/templates/pdb.yaml index f08dc33bd0..498cb7c4bf 100644 --- a/keystone/templates/pdb.yaml +++ b/keystone/templates/pdb.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.api.min_available }} selector: matchLabels: - app: keystone-api \ No newline at end of file +{{ tuple $envAll "keystone" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/keystone/templates/service.yaml b/keystone/templates/service.yaml index f323996cf1..bea03cab52 100644 --- a/keystone/templates/service.yaml +++ b/keystone/templates/service.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -29,7 +30,7 @@ spec: nodePort: {{ .Values.network.admin.node_port.port }} {{ end }} selector: - app: keystone-api +{{ tuple $envAll "keystone" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if or (.Values.network.api.node_port.enabled) (.Values.network.admin.node_port.enabled) }} type: NodePort {{ end }} diff --git a/magnum/templates/deployment-api.yaml b/magnum/templates/deployment-api.yaml index 48c09ca5cf..672547d13f 100644 --- a/magnum/templates/deployment-api.yaml +++ b/magnum/templates/deployment-api.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.api }} {{- $mounts_magnum_api := .Values.mounts.magnum_api.magnum_api }} {{- $mounts_magnum_api_init := .Values.mounts.magnum_api.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +34,13 @@ spec: template: metadata: labels: - app: magnum-api +{{ tuple $envAll "magnum" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "magnum" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.api.timeout | default "30" }} diff --git a/magnum/templates/pdb-api.yaml b/magnum/templates/pdb-api.yaml index f2a6ef8d6d..62b1d77496 100644 --- a/magnum/templates/pdb-api.yaml +++ b/magnum/templates/pdb-api.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.api.min_available }} selector: matchLabels: - app: magnum-api \ No newline at end of file +{{ tuple $envAll "magnum" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/magnum/templates/service-api.yaml b/magnum/templates/service-api.yaml index e470c06baf..639fba236b 100644 --- a/magnum/templates/service-api.yaml +++ b/magnum/templates/service-api.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: {{ .Values.network.api.node_port.port }} {{ end }} selector: - app: magnum-api +{{ tuple $envAll "magnum" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.api.node_port.enabled }} type: NodePort {{ end }} diff --git a/magnum/templates/statefulset-conductor.yaml b/magnum/templates/statefulset-conductor.yaml index eda44f75ce..ae7c6cbf9a 100644 --- a/magnum/templates/statefulset-conductor.yaml +++ b/magnum/templates/statefulset-conductor.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.conductor }} {{- $mounts_magnum_conductor := .Values.mounts.magnum_conductor.magnum_conductor }} {{- $mounts_magnum_conductor_init := .Values.mounts.magnum_conductor.init_container }} +--- apiVersion: apps/v1beta1 kind: StatefulSet metadata: @@ -26,8 +27,10 @@ spec: template: metadata: labels: - app: magnum-conductor +{{ tuple $envAll "magnum" "conductor" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: + affinity: +{{ tuple $envAll "magnum" "conductor" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} initContainers: diff --git a/mariadb/templates/pdb-mariadb.yaml b/mariadb/templates/pdb-mariadb.yaml index 37931cb450..8506a0b6fc 100644 --- a/mariadb/templates/pdb-mariadb.yaml +++ b/mariadb/templates/pdb-mariadb.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.mariadb.min_available }} selector: matchLabels: - app: mariadb +{{ tuple $envAll "mariadb" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/mariadb/templates/service-discovery.yaml b/mariadb/templates/service-discovery.yaml index 6e12c1c0e4..e1dc356f7d 100644 --- a/mariadb/templates/service-discovery.yaml +++ b/mariadb/templates/service-discovery.yaml @@ -14,6 +14,8 @@ # This service could be used for cluster pod discovery, though instead it's # primarily here to allow DNS lookups of cluster pods. +{{- $envAll := . }} +--- apiVersion: v1 kind: Service metadata: @@ -26,4 +28,4 @@ spec: port: {{ tuple "oslo_db" "internal" "mysql" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} clusterIP: None selector: - app: mariadb +{{ tuple $envAll "mariadb" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} diff --git a/mariadb/templates/service.yaml b/mariadb/templates/service.yaml index b01844ab99..836e2a47b1 100644 --- a/mariadb/templates/service.yaml +++ b/mariadb/templates/service.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -29,4 +30,4 @@ spec: - name: db port: {{ tuple "oslo_db" "internal" "mysql" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} selector: - app: mariadb +{{ tuple $envAll "mariadb" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} diff --git a/mariadb/templates/statefulset.yaml b/mariadb/templates/statefulset.yaml index 22196fc6af..c1c63fcdb4 100644 --- a/mariadb/templates/statefulset.yaml +++ b/mariadb/templates/statefulset.yaml @@ -11,7 +11,7 @@ # 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 := . }} --- apiVersion: apps/v1beta1 kind: StatefulSet @@ -23,24 +23,10 @@ spec: template: metadata: labels: - app: mariadb +{{ tuple $envAll "mariadb" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: - # alanmeadows: this soft requirement allows single - # host deployments to spawn several mariadb containers - # but in a larger environment, would attempt to spread - # them out affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - podAffinityTerm: - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - mariadb - topologyKey: kubernetes.io/hostname - weight: 10 +{{ tuple $envAll "mariadb" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} containers: diff --git a/memcached/templates/deployment.yaml b/memcached/templates/deployment.yaml index 6204315ba4..a090b3f5a0 100644 --- a/memcached/templates/deployment.yaml +++ b/memcached/templates/deployment.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -29,8 +30,10 @@ spec: template: metadata: labels: - app: memcached +{{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: + affinity: +{{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} containers: diff --git a/memcached/templates/service.yaml b/memcached/templates/service.yaml index 4027a01062..0bf97a981a 100644 --- a/memcached/templates/service.yaml +++ b/memcached/templates/service.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -21,4 +22,4 @@ spec: ports: - port: {{ .Values.network.port }} selector: - app: memcached +{{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} diff --git a/mistral/templates/deployment-api.yaml b/mistral/templates/deployment-api.yaml index c30f1f4150..245c58e7fb 100644 --- a/mistral/templates/deployment-api.yaml +++ b/mistral/templates/deployment-api.yaml @@ -15,7 +15,7 @@ {{- $dependencies := .Values.dependencies.api }} {{- $mounts_mistral_api := .Values.mounts.mistral_api.mistral_api }} {{- $mounts_mistral_api_init := .Values.mounts.mistral_api.init_container }} - +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +33,13 @@ spec: template: metadata: labels: - app: mistral-api +{{ tuple $envAll "mistral" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "mistral" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.api.timeout | default "30" }} diff --git a/mistral/templates/deployment-executor.yaml b/mistral/templates/deployment-executor.yaml index 7514bed8c6..705fe2ed4d 100644 --- a/mistral/templates/deployment-executor.yaml +++ b/mistral/templates/deployment-executor.yaml @@ -15,7 +15,7 @@ {{- $dependencies := .Values.dependencies.executor }} {{- $mounts_mistral_executor := .Values.mounts.mistral_executor.mistral_executor }} {{- $mounts_mistral_executor_init := .Values.mounts.mistral_executor.init_container }} - +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +33,13 @@ spec: template: metadata: labels: - app: mistral-executor +{{ tuple $envAll "mistral" "executor" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "mistral" "executor" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} initContainers: diff --git a/mistral/templates/pdb-api.yaml b/mistral/templates/pdb-api.yaml index e09ede7416..20052cc6bc 100644 --- a/mistral/templates/pdb-api.yaml +++ b/mistral/templates/pdb-api.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.api.min_available }} selector: matchLabels: - app: mistral-api \ No newline at end of file +{{ tuple $envAll "mistral" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/mistral/templates/service-api.yaml b/mistral/templates/service-api.yaml index 87a851df5e..180b9ab8d3 100644 --- a/mistral/templates/service-api.yaml +++ b/mistral/templates/service-api.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: {{ .Values.network.api.node_port.port }} {{ end }} selector: - app: mistral-api +{{ tuple $envAll "mistral" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.api.node_port.enabled }} type: NodePort {{ end }} diff --git a/mistral/templates/statefulset-event-engine.yaml b/mistral/templates/statefulset-event-engine.yaml index b15fd18379..62faf97f84 100644 --- a/mistral/templates/statefulset-event-engine.yaml +++ b/mistral/templates/statefulset-event-engine.yaml @@ -15,7 +15,7 @@ {{- $dependencies := .Values.dependencies.event_engine }} {{- $mounts_mistral_event_engine := .Values.mounts.mistral_event_engine.mistral_event_engine }} {{- $mounts_mistral_event_engine_init := .Values.mounts.mistral_event_engine.init_container }} - +--- apiVersion: apps/v1beta1 kind: StatefulSet metadata: @@ -26,8 +26,10 @@ spec: template: metadata: labels: - app: mistral-event-engine +{{ tuple $envAll "mistral" "event-engine" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: + affinity: +{{ tuple $envAll "mistral" "event-engine" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} initContainers: diff --git a/neutron/templates/daemonset-dhcp-agent.yaml b/neutron/templates/daemonset-dhcp-agent.yaml index 6735ee8588..16439f3731 100644 --- a/neutron/templates/daemonset-dhcp-agent.yaml +++ b/neutron/templates/daemonset-dhcp-agent.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.dhcp }} {{- $mounts_neutron_dhcp_agent := .Values.mounts.neutron_dhcp_agent.neutron_dhcp_agent }} {{- $mounts_neutron_dhcp_agent_init := .Values.mounts.neutron_dhcp_agent.init_container }} +--- apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -24,7 +25,7 @@ spec: template: metadata: labels: - app: neutron-dhcp-agent +{{ tuple $envAll "neutron" "dhcp-agent" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} diff --git a/neutron/templates/daemonset-l3-agent.yaml b/neutron/templates/daemonset-l3-agent.yaml index 99dcadec0d..4a23b1f813 100644 --- a/neutron/templates/daemonset-l3-agent.yaml +++ b/neutron/templates/daemonset-l3-agent.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.l3 }} {{- $mounts_neutron_l3_agent := .Values.mounts.neutron_l3_agent.neutron_l3_agent }} {{- $mounts_neutron_l3_agent_init := .Values.mounts.neutron_l3_agent.init_container }} +--- apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -24,7 +25,7 @@ spec: template: metadata: labels: - app: neutron-l3-agent +{{ tuple $envAll "neutron" "l3-agent" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} diff --git a/neutron/templates/daemonset-metadata-agent.yaml b/neutron/templates/daemonset-metadata-agent.yaml index 93cd937b66..68a90f347b 100644 --- a/neutron/templates/daemonset-metadata-agent.yaml +++ b/neutron/templates/daemonset-metadata-agent.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.metadata }} {{- $mounts_neutron_metadata_agent := .Values.mounts.neutron_metadata_agent.neutron_metadata_agent }} {{- $mounts_neutron_metadata_agent_init := .Values.mounts.neutron_metadata_agent.init_container }} +--- apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -24,7 +25,7 @@ spec: template: metadata: labels: - app: neutron-metadata-agent +{{ tuple $envAll "neutron" "metadata-agent" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} diff --git a/neutron/templates/daemonset-ovs-agent.yaml b/neutron/templates/daemonset-ovs-agent.yaml index 3e3cf7ee01..65cc19033d 100644 --- a/neutron/templates/daemonset-ovs-agent.yaml +++ b/neutron/templates/daemonset-ovs-agent.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.ovs_agent }} {{- $mounts_neutron_ovs_agent := .Values.mounts.neutron_ovs_agent.neutron_ovs_agent }} {{- $mounts_neutron_ovs_agent_init := .Values.mounts.neutron_ovs_agent.init_container }} +--- apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -24,7 +25,7 @@ spec: template: metadata: labels: - app: ovs-agent +{{ tuple $envAll "neutron" "ovs-agent" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} diff --git a/neutron/templates/daemonset-ovs-db.yaml b/neutron/templates/daemonset-ovs-db.yaml index 9a60dcb9e4..00858e06ae 100644 --- a/neutron/templates/daemonset-ovs-db.yaml +++ b/neutron/templates/daemonset-ovs-db.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -20,7 +21,7 @@ spec: template: metadata: labels: - app: ovs-db +{{ tuple $envAll "neutron" "ovs-db" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} diff --git a/neutron/templates/daemonset-ovs-vswitchd.yaml b/neutron/templates/daemonset-ovs-vswitchd.yaml index 48c479bb55..acc2958efc 100644 --- a/neutron/templates/daemonset-ovs-vswitchd.yaml +++ b/neutron/templates/daemonset-ovs-vswitchd.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -20,7 +21,7 @@ spec: template: metadata: labels: - app: ovs-vswitchd +{{ tuple $envAll "neutron" "ovs-vswitchd" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} diff --git a/neutron/templates/deployment-server.yaml b/neutron/templates/deployment-server.yaml index 0f4c19f409..f3d6dac4f6 100644 --- a/neutron/templates/deployment-server.yaml +++ b/neutron/templates/deployment-server.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.server }} {{- $mounts_neutron_server := .Values.mounts.neutron_server.neutron_server }} {{- $mounts_neutron_server_init := .Values.mounts.neutron_server.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +34,13 @@ spec: template: metadata: labels: - app: neutron-server +{{ tuple $envAll "neutron" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "neutron" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.server.node_selector_key }}: {{ .Values.labels.server.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.server.timeout | default "30" }} diff --git a/neutron/templates/pdb-server.yaml b/neutron/templates/pdb-server.yaml index d1cf37396f..741138f13b 100644 --- a/neutron/templates/pdb-server.yaml +++ b/neutron/templates/pdb-server.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.server.min_available }} selector: matchLabels: - app: neutron-server \ No newline at end of file +{{ tuple $envAll "neutron" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/neutron/templates/service.yaml b/neutron/templates/service.yaml index 18b04c1bb6..2daa258e96 100644 --- a/neutron/templates/service.yaml +++ b/neutron/templates/service.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: {{ .Values.network.server.node_port.port }} {{ end }} selector: - app: neutron-server +{{ tuple $envAll "neutron" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.server.node_port.enabled }} type: NodePort {{ end }} diff --git a/nova/templates/daemonset-compute.yaml b/nova/templates/daemonset-compute.yaml index 7f1bd6e162..a48c2e2428 100644 --- a/nova/templates/daemonset-compute.yaml +++ b/nova/templates/daemonset-compute.yaml @@ -16,7 +16,7 @@ {{- $dependencies := .Values.dependencies.compute }} {{- $mounts_nova_compute := .Values.mounts.nova_compute.nova_compute }} {{- $mounts_nova_compute_init := .Values.mounts.nova_compute.init_container }} - +--- apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -25,7 +25,7 @@ spec: template: metadata: labels: - app: nova-compute +{{ tuple $envAll "nova" "compute" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} diff --git a/nova/templates/daemonset-libvirt.yaml b/nova/templates/daemonset-libvirt.yaml index dce550c71e..adc96b7e75 100644 --- a/nova/templates/daemonset-libvirt.yaml +++ b/nova/templates/daemonset-libvirt.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.libvirt }} {{- $mounts_nova_libvirt := .Values.mounts.nova_libvirt.nova_libvirt }} {{- $mounts_nova_libvirt_init := .Values.mounts.nova_libvirt.init_container }} +--- apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -24,7 +25,7 @@ spec: template: metadata: labels: - app: nova-libvirt +{{ tuple $envAll "nova" "libvirt" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} diff --git a/nova/templates/deployment-api-metadata.yaml b/nova/templates/deployment-api-metadata.yaml index ab80909eca..e122d1ec23 100644 --- a/nova/templates/deployment-api-metadata.yaml +++ b/nova/templates/deployment-api-metadata.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.api }} {{- $mounts_nova_api_metadata := .Values.mounts.nova_api_metadata.nova_api_metadata }} {{- $mounts_nova_api_metadata_init := .Values.mounts.nova_api_metadata.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +34,13 @@ spec: template: metadata: labels: - app: nova-api-metadata +{{ tuple $envAll "nova" "metadata" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "nova" "metadata" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.api_metadata.node_selector_key }}: {{ .Values.labels.api_metadata.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.metadata.timeout | default "30" }} diff --git a/nova/templates/deployment-api-osapi.yaml b/nova/templates/deployment-api-osapi.yaml index b75741809c..1d314d31b5 100644 --- a/nova/templates/deployment-api-osapi.yaml +++ b/nova/templates/deployment-api-osapi.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.api }} {{- $mounts_nova_api_osapi := .Values.mounts.nova_api_osapi.nova_api_osapi }} {{- $mounts_nova_api_osapi_init := .Values.mounts.nova_api_osapi.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +34,13 @@ spec: template: metadata: labels: - app: nova-api-osapi +{{ tuple $envAll "nova" "os-api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "nova" "os-api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.osapi.node_selector_key }}: {{ .Values.labels.osapi.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.osapi.timeout | default "30" }} diff --git a/nova/templates/deployment-conductor.yaml b/nova/templates/deployment-conductor.yaml index e46ba2fa2f..bad932ea46 100644 --- a/nova/templates/deployment-conductor.yaml +++ b/nova/templates/deployment-conductor.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.conductor }} {{- $mounts_nova_conductor := .Values.mounts.nova_conductor.nova_conductor }} {{- $mounts_nova_conductor_init := .Values.mounts.nova_conductor.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +34,13 @@ spec: template: metadata: labels: - app: nova-conductor +{{ tuple $envAll "nova" "conductor" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "nova" "conductor" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.conductor.node_selector_key }}: {{ .Values.labels.conductor.node_selector_value }} initContainers: diff --git a/nova/templates/deployment-consoleauth.yaml b/nova/templates/deployment-consoleauth.yaml index 73548f6ea8..5b7fc6ecbf 100644 --- a/nova/templates/deployment-consoleauth.yaml +++ b/nova/templates/deployment-consoleauth.yaml @@ -16,7 +16,7 @@ {{- $dependencies := .Values.dependencies.consoleauth }} {{- $mounts_nova_consoleauth := .Values.mounts.nova_consoleauth.nova_conductor }} {{- $mounts_nova_consoleauth_init := .Values.mounts.nova_consoleauth.init_container }} - +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -34,11 +34,13 @@ spec: template: metadata: labels: - app: nova-consoleauth +{{ tuple $envAll "nova" "consoleauth" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "nova" "consoleauth" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.consoleauth.node_selector_key }}: {{ .Values.labels.consoleauth.node_selector_value }} initContainers: diff --git a/nova/templates/deployment-scheduler.yaml b/nova/templates/deployment-scheduler.yaml index 4d01adf898..e4f65f1668 100644 --- a/nova/templates/deployment-scheduler.yaml +++ b/nova/templates/deployment-scheduler.yaml @@ -16,7 +16,7 @@ {{- $dependencies := .Values.dependencies.scheduler }} {{- $mounts_nova_scheduler := .Values.mounts.nova_scheduler.nova_conductor }} {{- $mounts_nova_scheduler_init := .Values.mounts.nova_scheduler.init_container }} - +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -34,11 +34,13 @@ spec: template: metadata: labels: - app: nova-scheduler +{{ tuple $envAll "nova" "scheduler" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "nova" "scheduler" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.scheduler.node_selector_key }}: {{ .Values.labels.scheduler.node_selector_value }} initContainers: diff --git a/nova/templates/pdb-metadata.yaml b/nova/templates/pdb-metadata.yaml index 7dc22ea9ab..1a6035d178 100644 --- a/nova/templates/pdb-metadata.yaml +++ b/nova/templates/pdb-metadata.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.metadata.min_available }} selector: matchLabels: - app: nova-api-metadata \ No newline at end of file +{{ tuple $envAll "nova" "metadata" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/nova/templates/pdb-osapi.yaml b/nova/templates/pdb-osapi.yaml index 77f9ca3559..8aae192e9d 100644 --- a/nova/templates/pdb-osapi.yaml +++ b/nova/templates/pdb-osapi.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.osapi.min_available }} selector: matchLabels: - app: nova-api-osapi \ No newline at end of file +{{ tuple $envAll "nova" "os-api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/nova/templates/service-metadata.yaml b/nova/templates/service-metadata.yaml index a34ab7e77d..87ca101ca8 100644 --- a/nova/templates/service-metadata.yaml +++ b/nova/templates/service-metadata.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: {{ .Values.network.metadata.node_port.port }} {{ end }} selector: - app: nova-api-metadata +{{ tuple $envAll "nova" "metadata" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.metadata.node_port.enabled }} type: NodePort {{ end }} diff --git a/nova/templates/service-osapi.yaml b/nova/templates/service-osapi.yaml index f1e7081aec..c379d8c523 100644 --- a/nova/templates/service-osapi.yaml +++ b/nova/templates/service-osapi.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: {{ .Values.network.osapi.node_port.port }} {{ end }} selector: - app: nova-api-osapi +{{ tuple $envAll "nova" "os-api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.osapi.node_port.enabled }} type: NodePort {{ end }} diff --git a/rabbitmq/templates/deployment.yaml b/rabbitmq/templates/deployment.yaml index 864af8a2fe..d5e92ce3c8 100644 --- a/rabbitmq/templates/deployment.yaml +++ b/rabbitmq/templates/deployment.yaml @@ -31,23 +31,13 @@ spec: template: metadata: labels: - app: rabbitmq +{{ tuple $envAll "rabbitmq" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: - # TODO: this needs to be moved to common. affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - podAffinityTerm: - labelSelector: - matchExpressions: - - key: app - operator: In - values: ["rabbitmq"] - topologyKey: kubernetes.io/hostname - weight: 10 +{{ tuple $envAll "rabbitmq" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} volumes: diff --git a/rabbitmq/templates/service.yaml b/rabbitmq/templates/service.yaml index a05a9994ef..24862bebd8 100644 --- a/rabbitmq/templates/service.yaml +++ b/rabbitmq/templates/service.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -20,4 +21,4 @@ spec: ports: - port: {{.Values.network.port.public}} selector: - app: rabbitmq +{{ tuple $envAll "rabbitmq" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} diff --git a/senlin/templates/deployment-api.yaml b/senlin/templates/deployment-api.yaml index 316d6a7f78..ba28f0846b 100644 --- a/senlin/templates/deployment-api.yaml +++ b/senlin/templates/deployment-api.yaml @@ -11,11 +11,11 @@ # 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 := . }} {{- $dependencies := .Values.dependencies.api }} {{- $mounts_senlin_api := .Values.mounts.senlin_api.senlin_api }} {{- $mounts_senlin_api_init := .Values.mounts.senlin_api.init_container }} +--- apiVersion: apps/v1beta1 kind: Deployment metadata: @@ -33,11 +33,13 @@ spec: template: metadata: labels: - app: senlin-api +{{ tuple $envAll "senlin" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: + affinity: +{{ tuple $envAll "senlin" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.termination_grace_period.api.timeout | default "30" }} diff --git a/senlin/templates/pdb-api.yaml b/senlin/templates/pdb-api.yaml index 0e098bc41c..85030c40fd 100644 --- a/senlin/templates/pdb-api.yaml +++ b/senlin/templates/pdb-api.yaml @@ -1,3 +1,18 @@ +# 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 := . }} +--- apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -6,4 +21,4 @@ spec: minAvailable: {{ .Values.pod_disruption_budget.api.min_available }} selector: matchLabels: - app: senlin-api \ No newline at end of file +{{ tuple $envAll "senlin" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} diff --git a/senlin/templates/service-api.yaml b/senlin/templates/service-api.yaml index 1251f0888e..bfb2578aaf 100644 --- a/senlin/templates/service-api.yaml +++ b/senlin/templates/service-api.yaml @@ -11,7 +11,8 @@ # 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 := . }} +--- apiVersion: v1 kind: Service metadata: @@ -24,7 +25,7 @@ spec: nodePort: {{ .Values.network.api.node_port.port }} {{ end }} selector: - app: senlin-api +{{ tuple $envAll "senlin" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.api.node_port.enabled }} type: NodePort {{ end }} diff --git a/senlin/templates/statefulset-engine.yaml b/senlin/templates/statefulset-engine.yaml index 55605ed731..5c20f22a18 100644 --- a/senlin/templates/statefulset-engine.yaml +++ b/senlin/templates/statefulset-engine.yaml @@ -16,6 +16,7 @@ {{- $dependencies := .Values.dependencies.engine }} {{- $mounts_senlin_engine := .Values.mounts.senlin_engine.senlin_engine }} {{- $mounts_senlin_engine_init := .Values.mounts.senlin_engine.init_container }} +--- apiVersion: apps/v1beta1 kind: StatefulSet metadata: @@ -26,8 +27,10 @@ spec: template: metadata: labels: - app: senlin-engine +{{ tuple $envAll "senlin" "engine" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: + affinity: +{{ tuple $envAll "senlin" "engine" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} initContainers: diff --git a/tools/gate/openstack_aio_launch.sh b/tools/gate/openstack_aio_launch.sh index 06bc43d519..67bce01a67 100644 --- a/tools/gate/openstack_aio_launch.sh +++ b/tools/gate/openstack_aio_launch.sh @@ -45,11 +45,11 @@ KEYSTONE_CREDS="--os-username ${KS_USER} \ --os-project-domain-name ${KS_PROJECT_DOMAIN} \ --os-user-domain-name ${KS_USER_DOMAIN} \ --os-password ${KS_PASSWORD}" -NEUTRON_POD=$(kubectl get -n openstack pods -l app=neutron-server --no-headers -o name | head -1 | awk -F '/' '{ print $NF }') +NEUTRON_POD=$(kubectl get -n openstack pods -l application=neutron,component=server --no-headers -o name | head -1 | awk -F '/' '{ print $NF }') NEUTRON="kubectl exec -n openstack ${NEUTRON_POD} -- neutron ${KEYSTONE_CREDS}" -OPENSTACK_POD=$(kubectl get -n openstack pods -l app=keystone-api --no-headers -o name | head -1 | awk -F '/' '{ print $NF }') +OPENSTACK_POD=$(kubectl get -n openstack pods -l application=keystone,component=api --no-headers -o name | head -1 | awk -F '/' '{ print $NF }') OPENSTACK="kubectl exec -n openstack ${OPENSTACK_POD} -- openstack ${KEYSTONE_CREDS} --os-identity-api-version 3 --os-image-api-version 2" -NOVA_POD=$(kubectl get -n openstack pods -l app=nova-api-osapi --no-headers -o name | head -1 | awk -F '/' '{ print $NF }') +NOVA_POD=$(kubectl get -n openstack pods -l application=nova,component=os-api --no-headers -o name | head -1 | awk -F '/' '{ print $NF }') NOVA="kubectl exec -n openstack ${NOVA_POD} -- nova ${KEYSTONE_CREDS}" # Turn on ip forwarding if its not already @@ -62,7 +62,7 @@ sudo ip addr add ${OSH_BR_EX_ADDR} dev br-ex sudo ip link set br-ex up # Disable In-Band rules on br-ex bridge to ease debugging -OVS_VSWITCHD_POD=$(kubectl get -n openstack pods -l app=ovs-vswitchd --no-headers -o name | head -1 | awk -F '/' '{ print $NF }') +OVS_VSWITCHD_POD=$(kubectl get -n openstack pods -l application=neutron,component=ovs-vswitchd --no-headers -o name | head -1 | awk -F '/' '{ print $NF }') kubectl exec -n openstack ${OVS_VSWITCHD_POD} -- ovs-vsctl set Bridge br-ex other_config:disable-in-band=true # Setup masquerading on default route dev to public subnet