From c1a0533d36e557345b74141eebb4eae0422eacdd Mon Sep 17 00:00:00 2001
From: Dae Seong Kim <powerds0111@gmail.com>
Date: Mon, 14 Aug 2017 13:52:15 +0900
Subject: [PATCH] Add the nova placement service

Placement service is optional in Newton, but required in Ocata.
So it needs to add the service for upgrading.

Change-Id: I49637c04ba7739a5108a442af05580f719ec3d54
Implements: blueprint add-nova-placement-service
---
 nova/templates/bin/_nova-placement-api.sh.tpl | 31 +++++++
 nova/templates/configmap-bin.yaml             |  2 +
 nova/templates/configmap-etc.yaml             |  4 +
 nova/templates/deployment-placement.yaml      | 92 +++++++++++++++++++
 nova/templates/ingress-placement.yaml         | 59 ++++++++++++
 .../templates/job-ks-placement-endpoints.yaml | 69 ++++++++++++++
 nova/templates/job-ks-placement-service.yaml  | 63 +++++++++++++
 nova/templates/job-ks-placement-user.yaml     | 64 +++++++++++++
 nova/templates/pdb-placement.yaml             | 29 ++++++
 nova/templates/secret-keystone-placement.yaml | 30 ++++++
 nova/templates/service-ingress-placement.yaml | 32 +++++++
 nova/templates/service-placement.yaml         | 36 ++++++++
 nova/values.yaml                              | 69 ++++++++++++++
 13 files changed, 580 insertions(+)
 create mode 100644 nova/templates/bin/_nova-placement-api.sh.tpl
 create mode 100644 nova/templates/deployment-placement.yaml
 create mode 100644 nova/templates/ingress-placement.yaml
 create mode 100644 nova/templates/job-ks-placement-endpoints.yaml
 create mode 100644 nova/templates/job-ks-placement-service.yaml
 create mode 100644 nova/templates/job-ks-placement-user.yaml
 create mode 100644 nova/templates/pdb-placement.yaml
 create mode 100644 nova/templates/secret-keystone-placement.yaml
 create mode 100644 nova/templates/service-ingress-placement.yaml
 create mode 100644 nova/templates/service-placement.yaml

diff --git a/nova/templates/bin/_nova-placement-api.sh.tpl b/nova/templates/bin/_nova-placement-api.sh.tpl
new file mode 100644
index 0000000000..07519cc526
--- /dev/null
+++ b/nova/templates/bin/_nova-placement-api.sh.tpl
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+{{/*
+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.
+*/}}
+
+set -ex
+COMMAND="${@:-start}"
+
+function start () {
+  exec nova-placement-api \
+        --port {{ .Values.network.placement.port }}
+}
+
+function stop () {
+  kill -TERM 1
+}
+
+$COMMAND
diff --git a/nova/templates/configmap-bin.yaml b/nova/templates/configmap-bin.yaml
index 21953ed82a..de8f8291af 100644
--- a/nova/templates/configmap-bin.yaml
+++ b/nova/templates/configmap-bin.yaml
@@ -49,6 +49,8 @@ data:
 {{ tuple "bin/_nova-api-metadata.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
   nova-api-metadata-init.sh: |
 {{ tuple "bin/_nova-api-metadata-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
+  nova-placement-api.sh: |
+{{ tuple "bin/_nova-placement-api.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
   nova-compute.sh: |
 {{ tuple "bin/_nova-compute.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
   nova-compute-init.sh: |
diff --git a/nova/templates/configmap-etc.yaml b/nova/templates/configmap-etc.yaml
index 15a9a5d777..4fee0608ab 100644
--- a/nova/templates/configmap-etc.yaml
+++ b/nova/templates/configmap-etc.yaml
@@ -109,6 +109,10 @@ limitations under the License.
 {{- tuple "compute_metadata" "public" "metadata" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.nova.DEFAULT "metadata_port" | quote | trunc 0 -}}
 {{- end -}}
 
+{{- if empty .Values.conf.nova.placement.auth_url -}}
+{{- tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.nova.placement "auth_url" | quote | trunc 0 -}}
+{{- end -}}
+
 {{- if empty .Values.conf.nova.vnc.novncproxy_base_url -}}
 {{- tuple "compute_novnc_proxy" "public" "novnc_proxy" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | set .Values.conf.nova.vnc "novncproxy_base_url" | quote | trunc 0 -}}
 {{- end -}}
diff --git a/nova/templates/deployment-placement.yaml b/nova/templates/deployment-placement.yaml
new file mode 100644
index 0000000000..d27223be29
--- /dev/null
+++ b/nova/templates/deployment-placement.yaml
@@ -0,0 +1,92 @@
+{{/*
+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.
+*/}}
+
+{{- if .Values.manifests.deployment_placement }}
+{{- $envAll := . }}
+{{- $dependencies := .Values.dependencies.api }}
+{{- $mounts_nova_placement := .Values.pod.mounts.nova_placement.nova_placement }}
+{{- $mounts_nova_placement_init := .Values.pod.mounts.nova_placement.init_container }}
+---
+apiVersion: apps/v1beta1
+kind: Deployment
+metadata:
+  name: nova-placement-api
+spec:
+  replicas: {{ .Values.pod.replicas.placement }}
+{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
+  template:
+    metadata:
+      labels:
+{{ tuple $envAll "nova" "placement" | 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" "placement" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
+      nodeSelector:
+        {{ .Values.labels.placement.node_selector_key }}: {{ .Values.labels.placement.node_selector_value }}
+      terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.placement.timeout | default "30" }}
+      initContainers:
+{{ tuple $envAll $dependencies $mounts_nova_placement_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
+      containers:
+        - name: nova-placement-api
+          image: {{ .Values.images.tags.placement }}
+          imagePullPolicy: {{ .Values.images.pull_policy }}
+{{ tuple $envAll $envAll.Values.pod.resources.placement | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
+          command:
+            - /tmp/nova-placement-api.sh
+            - start
+          lifecycle:
+            preStop:
+              exec:
+                command:
+                  - /tmp/nova-placement-api.sh
+                  - stop
+          ports:
+            - containerPort: {{ .Values.network.placement.port }}
+          readinessProbe:
+            tcpSocket:
+              port: {{ .Values.network.placement.port }}
+          volumeMounts:
+            - name: nova-bin
+              mountPath: /tmp/nova-placement-api.sh
+              subPath: nova-placement-api.sh
+              readOnly: true
+            - name: nova-etc
+              mountPath: /etc/nova/nova.conf
+              subPath: nova.conf
+              readOnly: true
+            - name: nova-etc
+              mountPath: /etc/nova/api-paste.ini
+              subPath: api-paste.ini
+              readOnly: true
+            - name: nova-etc
+              mountPath: /etc/nova/policy.yaml
+              subPath: policy.yaml
+              readOnly: true
+{{- if $mounts_nova_placement.volumeMounts }}{{ toYaml $mounts_nova_placement.volumeMounts | indent 12 }}{{ end }}
+      volumes:
+        - name: nova-bin
+          configMap:
+            name: nova-bin
+            defaultMode: 0555
+        - name: nova-etc
+          configMap:
+            name: nova-etc
+            defaultMode: 0444
+{{- if $mounts_nova_placement.volumes }}{{ toYaml $mounts_nova_placement.volumes | indent 8 }}{{ end }}
+{{- end }}
diff --git a/nova/templates/ingress-placement.yaml b/nova/templates/ingress-placement.yaml
new file mode 100644
index 0000000000..bc16b7e6eb
--- /dev/null
+++ b/nova/templates/ingress-placement.yaml
@@ -0,0 +1,59 @@
+{{/*
+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.
+*/}}
+
+{{- if .Values.manifests.ingress_placement }}
+{{- $envAll := . }}
+{{- if .Values.network.placement.ingress.public }}
+{{- $backendServiceType := "placement" }}
+{{- $backendPort := "p-api" }}
+{{- $ingressName := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
+{{- $backendName := tuple $backendServiceType "internal" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
+{{- $hostName := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
+{{- $hostNameNamespaced := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }}
+{{- $hostNameFull := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" }}
+---
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: {{ $ingressName }}
+  annotations:
+    kubernetes.io/ingress.class: "nginx"
+    ingress.kubernetes.io/rewrite-target: /
+spec:
+  rules:
+{{ if ne $hostNameNamespaced $hostNameFull }}
+{{- range $key1, $vHost := tuple $hostName $hostNameNamespaced $hostNameFull }}
+  - host: {{ $vHost }}
+    http:
+      paths:
+      - path: /
+        backend:
+          serviceName: {{ $backendName }}
+          servicePort: {{ $backendPort }}
+{{- end }}
+{{- else }}
+{{- range $key1, $vHost := tuple $hostName $hostNameNamespaced }}
+  - host: {{ $vHost }}
+    http:
+      paths:
+      - path: /
+        backend:
+          serviceName: {{ $backendName }}
+          servicePort: {{ $backendPort }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end }}
diff --git a/nova/templates/job-ks-placement-endpoints.yaml b/nova/templates/job-ks-placement-endpoints.yaml
new file mode 100644
index 0000000000..8001459006
--- /dev/null
+++ b/nova/templates/job-ks-placement-endpoints.yaml
@@ -0,0 +1,69 @@
+{{/*
+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.
+*/}}
+
+{{- if .Values.manifests.job_ks_placement_endpoints }}
+{{- $envAll := . }}
+{{- $dependencies := .Values.dependencies.ks_endpoints }}
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: placement-ks-endpoints
+spec:
+  template:
+    metadata:
+      labels:
+{{ tuple $envAll "placement" "ks-endpoints" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
+    spec:
+      restartPolicy: OnFailure
+      nodeSelector:
+        {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
+      initContainers:
+{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
+      containers:
+{{- range $key1, $osServiceType := tuple "placement" }}
+{{- range $key2, $osServiceEndPoint := tuple "admin" "internal" "public" }}
+        - name: {{ $osServiceType }}-ks-endpoints-{{ $osServiceEndPoint }}
+          image: {{ $envAll.Values.images.tags.ks_endpoints }}
+          imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
+{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_endpoints | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
+          command:
+            - /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" $envAll.Values.secrets.identity.admin }}
+{{- include "helm-toolkit.snippets.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.endpoints.keystone_endpoint_name_lookup" }}
+            - name: OS_SERVICE_TYPE
+              value: {{ $osServiceType }}
+            - name: OS_SERVICE_ENDPOINT
+              value: {{ tuple $osServiceType $osServiceEndPoint "api" $envAll | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" }}
+{{- end }}
+{{- end }}
+      volumes:
+        - name: ks-endpoints-sh
+          configMap:
+            name: nova-bin
+            defaultMode: 0555
+{{- end }}
diff --git a/nova/templates/job-ks-placement-service.yaml b/nova/templates/job-ks-placement-service.yaml
new file mode 100644
index 0000000000..84d38a958b
--- /dev/null
+++ b/nova/templates/job-ks-placement-service.yaml
@@ -0,0 +1,63 @@
+{{/*
+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.
+*/}}
+
+{{- if .Values.manifests.job_ks_placement_service }}
+{{- $envAll := . }}
+{{- $dependencies := .Values.dependencies.ks_service }}
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: placement-ks-service
+spec:
+  template:
+    metadata:
+      labels:
+{{ tuple $envAll "placement" "ks-service" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
+    spec:
+      restartPolicy: OnFailure
+      nodeSelector:
+        {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
+      initContainers:
+{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
+      containers:
+{{- range $key1, $osServiceType := tuple "placement" }}
+        - name: {{ $osServiceType }}-ks-service-registration
+          image: {{ $envAll.Values.images.tags.ks_service }}
+          imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
+{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_endpoints | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
+          command:
+            - /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" $envAll.Values.secrets.identity.admin }}
+{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }}
+{{- end }}
+            - name: OS_SERVICE_NAME
+              value: {{ tuple $osServiceType $envAll | include "helm-toolkit.endpoints.keystone_endpoint_name_lookup" }}
+            - name: OS_SERVICE_TYPE
+              value: {{ $osServiceType }}
+{{- end }}
+      volumes:
+        - name: ks-service-sh
+          configMap:
+            name: nova-bin
+            defaultMode: 0555
+{{- end }}
diff --git a/nova/templates/job-ks-placement-user.yaml b/nova/templates/job-ks-placement-user.yaml
new file mode 100644
index 0000000000..1751eb4867
--- /dev/null
+++ b/nova/templates/job-ks-placement-user.yaml
@@ -0,0 +1,64 @@
+{{/*
+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.
+*/}}
+
+{{- if .Values.manifests.job_ks_placement_user }}
+{{- $envAll := . }}
+{{- $dependencies := .Values.dependencies.ks_user }}
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: placement-ks-user
+spec:
+  template:
+    metadata:
+      labels:
+{{ tuple $envAll "placement" "ks-user" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
+    spec:
+      restartPolicy: OnFailure
+      nodeSelector:
+        {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
+      initContainers:
+{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
+      containers:
+        - name: placement-ks-user
+          image: {{ .Values.images.tags.ks_user }}
+          imagePullPolicy: {{ .Values.images.pull_policy }}
+{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_service | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
+          command:
+            - /tmp/ks-user.sh
+          volumeMounts:
+            - name: ks-user-sh
+              mountPath: /tmp/ks-user.sh
+              subPath: ks-user.sh
+              readOnly: true
+          env:
+{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }}
+{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }}
+{{- end }}
+            - name: SERVICE_OS_SERVICE_NAME
+              value: "placement"
+{{- with $env := dict "ksUserSecret" .Values.secrets.identity.placement }}
+{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 12 }}
+{{- end }}
+            - name: SERVICE_OS_ROLE
+              value: {{ .Values.endpoints.identity.auth.placement.role | quote }}
+      volumes:
+        - name: ks-user-sh
+          configMap:
+            name: nova-bin
+            defaultMode: 0555
+{{- end }}
diff --git a/nova/templates/pdb-placement.yaml b/nova/templates/pdb-placement.yaml
new file mode 100644
index 0000000000..2ee8436577
--- /dev/null
+++ b/nova/templates/pdb-placement.yaml
@@ -0,0 +1,29 @@
+{{/*
+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.
+*/}}
+
+{{- if .Values.manifests.pdb_placement }}
+{{- $envAll := . }}
+---
+apiVersion: policy/v1beta1
+kind: PodDisruptionBudget
+metadata:
+  name: nova-placement-api
+spec:
+  minAvailable: {{ .Values.pod.lifecycle.disruption_budget.placement.min_available }}
+  selector:
+    matchLabels:
+{{ tuple $envAll "nova" "placement" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
+{{- end }}
diff --git a/nova/templates/secret-keystone-placement.yaml b/nova/templates/secret-keystone-placement.yaml
new file mode 100644
index 0000000000..aba4d57f18
--- /dev/null
+++ b/nova/templates/secret-keystone-placement.yaml
@@ -0,0 +1,30 @@
+{{/*
+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.
+*/}}
+
+{{- if .Values.manifests.secret_keystone_placement }}
+{{- $envAll := . }}
+{{- range $key1, $userClass := tuple "placement" }}
+{{- $secretName := index $envAll.Values.secrets.identity $userClass }}
+---
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ $secretName }}
+type: Opaque
+data:
+{{- tuple $userClass "internal" $envAll | include "helm-toolkit.snippets.keystone_secret_openrc" | indent 2 -}}
+{{- end }}
+{{- end }}
diff --git a/nova/templates/service-ingress-placement.yaml b/nova/templates/service-ingress-placement.yaml
new file mode 100644
index 0000000000..ab5a269c1f
--- /dev/null
+++ b/nova/templates/service-ingress-placement.yaml
@@ -0,0 +1,32 @@
+{{/*
+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.
+*/}}
+
+{{- if .Values.manifests.service_ingress_placement }}
+{{- $envAll := . }}
+{{- if .Values.network.placement.ingress.public }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ tuple "placement" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
+spec:
+  ports:
+  - name: http
+    port: 80
+  selector:
+    app: ingress-api
+{{- end }}
+{{- end }}
diff --git a/nova/templates/service-placement.yaml b/nova/templates/service-placement.yaml
new file mode 100644
index 0000000000..3b02313805
--- /dev/null
+++ b/nova/templates/service-placement.yaml
@@ -0,0 +1,36 @@
+{{/*
+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.
+*/}}
+
+{{- if .Values.manifests.service_placement }}
+{{- $envAll := . }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ tuple "placement" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
+spec:
+  ports:
+  - name: p-api
+    port: {{ .Values.network.placement.port }}
+    {{ if .Values.network.placement.node_port.enabled }}
+    nodePort: {{ .Values.network.placement.node_port.port }}
+    {{ end }}
+  selector:
+{{ tuple $envAll "nova" "placement" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
+  {{ if .Values.network.placement.node_port.enabled }}
+  type: NodePort
+  {{ end }}
+{{- end }}
diff --git a/nova/values.yaml b/nova/values.yaml
index 857454678a..493a0e70f3 100644
--- a/nova/values.yaml
+++ b/nova/values.yaml
@@ -39,6 +39,9 @@ labels:
   api_metadata:
     node_selector_key: openstack-control-plane
     node_selector_value: enabled
+  placement:
+    node_selector_key: openstack-control-plane
+    node_selector_value: enabled
   job:
     node_selector_key: openstack-control-plane
     node_selector_value: enabled
@@ -63,6 +66,7 @@ images:
     consoleauth: docker.io/kolla/ubuntu-source-nova-consoleauth:3.0.3
     compute: docker.io/kolla/ubuntu-source-nova-compute:3.0.3
     compute_ssh: docker.io/kolla/ubuntu-source-nova-ssh:3.0.3
+    placement: docker.io/kolla/ubuntu-source-nova-placement-api:3.0.3-beta.1
     bootstrap: docker.io/kolla/ubuntu-source-heat-engine:3.0.3
     dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.2.1
   pull_policy: "IfNotPresent"
@@ -123,6 +127,13 @@ network:
     node_port:
       enabled: false
       port: 30775
+  placement:
+    port: 8778
+    ingress:
+      public: true
+    node_port:
+      enabled: false
+      port: 30778
   novncproxy:
     node_port:
       enabled: false
@@ -996,12 +1007,22 @@ conf:
       api_paste_config: /etc/nova/api-paste.ini
     oslo_messaging_notifications:
       driver: messagingv2
+    placement:
+      os_region_name: RegionOne
+      project_domain_name: default
+      project_name: service
+      auth_type: password
+      auth_version: v3
+      user_domain_name: default
+      username: placement
+      password: password
 
 # Names of secrets used by bootstrap and environmental checks
 secrets:
   identity:
     admin: nova-keystone-admin
     user: nova-keystone-user
+    placement: nova-keystone-placement
   oslo_db:
     admin: nova-db-admin
     user: nova-db-user
@@ -1098,6 +1119,14 @@ endpoints:
         user_domain_name: default
         username: neutron
         password: password
+      placement:
+        role: admin
+        region_name: RegionOne
+        username: placement
+        password: password
+        project_name: service
+        user_domain_name: default
+        project_domain_name: default
     hosts:
       default: keystone-api
       public: keystone
@@ -1172,6 +1201,21 @@ endpoints:
     port:
       novnc_proxy:
         default: 6080
+  placement:
+    name: placement
+    hosts:
+      default: placement-api
+      public: placement
+    host_fqdn_override:
+      default: null
+    path:
+      default: /
+    scheme:
+      default: 'http'
+    port:
+      api:
+        default: 8778
+        public: 80
   network:
     name: neutron
     hosts:
@@ -1205,6 +1249,9 @@ pod:
     nova_api_metadata:
       init_container: null
       nova_api_metadata:
+    nova_placement:
+      init_container: null
+      nova_placement:
     nova_api_osapi:
       init_container: null
       nova_api_osapi:
@@ -1228,6 +1275,7 @@ pod:
       nova_novncproxy:
   replicas:
     api_metadata: 1
+    placement: 1
     osapi: 1
     conductor: 1
     consoleauth: 1
@@ -1250,11 +1298,15 @@ pod:
     disruption_budget:
       metadata:
         min_available: 0
+      placement:
+        min_available: 0
       osapi:
         min_available: 0
     termination_grace_period:
       metadata:
         timeout: 30
+      placement:
+        timeout: 30
       osapi:
         timeout: 30
   resources:
@@ -1273,6 +1325,13 @@ pod:
       limits:
         memory: "1024Mi"
         cpu: "2000m"
+    placement:
+      requests:
+        memory: "128Mi"
+        cpu: "100m"
+      limits:
+        memory: "1024Mi"
+        cpu: "2000m"
     api:
       requests:
         memory: "128Mi"
@@ -1379,27 +1438,37 @@ manifests:
   daemonset_compute: true
   deployment_api_metadata: true
   deployment_api_osapi: true
+  deployment_placement: true
   deployment_conductor: true
   deployment_consoleauth: true
   deployment_novncproxy: true
   deployment_scheduler: true
   ingress_metadata: true
+  ingress_placement: true
   ingress_osapi: true
   job_bootstrap: true
   job_db_init: true
+  job_db_init_placement: true
   job_db_sync: true
   job_db_drop: false
   job_ks_endpoints: true
   job_ks_service: true
   job_ks_user: true
+  job_ks_placement_endpoints: true
+  job_ks_placement_service: true
+  job_ks_placement_user: true
   pdb_metadata: true
+  pdb_placement: true
   pdb_osapi: true
   pod_rally_test: true
   secret_db_api: true
   secret_db: true
   secret_keystone: true
+  secret_keystone_placement: true
   service_ingress_metadata: true
+  service_ingress_placement: true
   service_ingress_osapi: true
   service_metadata: true
+  service_placement: true
   service_novncproxy: true
   service_osapi: true