From 42d2f3bc06b9de69a8bbd865b908ce058b3e2473 Mon Sep 17 00:00:00 2001 From: portdirect Date: Sat, 3 Mar 2018 15:07:37 -0500 Subject: [PATCH] Nova: use endpoints section and lookups to set port This PS moves nova to use the endpoints section and lookups to set the port it serves on. Change-Id: I49b2bde8576a61ec9d42545909aee1858c8eb122 --- nova/templates/configmap-etc.yaml | 4 ++++ nova/templates/deployment-api-osapi.yaml | 5 +++-- nova/templates/deployment-novncproxy.yaml | 7 ++++--- nova/templates/deployment-placement.yaml | 5 +++-- nova/templates/deployment-spiceproxy.yaml | 7 ++++--- nova/templates/etc/_wsgi-nova-placement.conf.tpl | 4 ++-- nova/templates/service-novncproxy.yaml | 10 +++------- nova/templates/service-osapi.yaml | 2 +- nova/templates/service-placement.yaml | 2 +- nova/templates/service-spiceproxy.yaml | 10 +++------- nova/values.yaml | 8 +++----- 11 files changed, 31 insertions(+), 33 deletions(-) diff --git a/nova/templates/configmap-etc.yaml b/nova/templates/configmap-etc.yaml index a0b12a00b8..195dc573a5 100644 --- a/nova/templates/configmap-etc.yaml +++ b/nova/templates/configmap-etc.yaml @@ -200,6 +200,10 @@ limitations under the License. {{- tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set .Values.conf.nova.ironic "memcache_servers" | quote | trunc 0 -}} {{- end -}} +{{- if empty .Values.conf.nova.DEFAULT.osapi_compute_listen_port -}} +{{- tuple "compute" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.nova.DEFAULT "osapi_compute_listen_port" | quote | trunc 0 -}} +{{- end -}} + --- apiVersion: v1 kind: ConfigMap diff --git a/nova/templates/deployment-api-osapi.yaml b/nova/templates/deployment-api-osapi.yaml index b87daece4f..c818162371 100644 --- a/nova/templates/deployment-api-osapi.yaml +++ b/nova/templates/deployment-api-osapi.yaml @@ -64,10 +64,11 @@ spec: - /tmp/nova-api.sh - stop ports: - - containerPort: {{ .Values.network.osapi.port }} + - name: n-api + containerPort: {{ tuple "compute" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} readinessProbe: tcpSocket: - port: {{ .Values.network.osapi.port }} + port: {{ tuple "compute" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} volumeMounts: - name: nova-bin mountPath: /tmp/nova-api.sh diff --git a/nova/templates/deployment-novncproxy.yaml b/nova/templates/deployment-novncproxy.yaml index 878bf2ee3f..e66284fbd8 100644 --- a/nova/templates/deployment-novncproxy.yaml +++ b/nova/templates/deployment-novncproxy.yaml @@ -14,9 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */}} -{{- if .Values.manifests.deployment_novncproxy }} +{{- if and .Values.manifests.deployment_novncproxy ( eq .Values.console.console_kind "novnc" )}} {{- $envAll := . }} -{{ if eq .Values.console.console_kind "novnc" }} {{- $dependencies := .Values.dependencies.static.novncproxy }} {{- $mounts_nova_novncproxy := .Values.pod.mounts.nova_novncproxy.nova_novncproxy }} @@ -88,6 +87,9 @@ spec: {{ tuple $envAll $envAll.Values.pod.resources.novncproxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} command: - /tmp/nova-console-proxy.sh + ports: + - name: n-novnc + containerPort: {{ tuple "compute_novnc_proxy" "internal" "novnc_proxy" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} volumeMounts: - name: nova-bin mountPath: /tmp/nova-console-proxy.sh @@ -118,4 +120,3 @@ spec: emptyDir: {} {{ if $mounts_nova_novncproxy.volumes }}{{ toYaml $mounts_nova_novncproxy.volumes | indent 8 }}{{ end }} {{- end }} -{{- end }} diff --git a/nova/templates/deployment-placement.yaml b/nova/templates/deployment-placement.yaml index a72ff27dd3..b0ab03a731 100644 --- a/nova/templates/deployment-placement.yaml +++ b/nova/templates/deployment-placement.yaml @@ -62,11 +62,12 @@ spec: - /tmp/nova-placement-api.sh - stop ports: - - containerPort: {{ .Values.network.placement.port }} + - name: p-api + containerPort: {{ tuple "placement" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} readinessProbe: #NOTE(portdirect): use tcpSocket check as HTTP will return 401 tcpSocket: - port: {{ .Values.network.placement.port }} + port: {{ tuple "placement" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} initialDelaySeconds: 15 periodSeconds: 10 volumeMounts: diff --git a/nova/templates/deployment-spiceproxy.yaml b/nova/templates/deployment-spiceproxy.yaml index 2155cd1877..cd29732761 100644 --- a/nova/templates/deployment-spiceproxy.yaml +++ b/nova/templates/deployment-spiceproxy.yaml @@ -14,9 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */}} -{{- if .Values.manifests.deployment_spiceproxy }} +{{- if and .Values.manifests.deployment_spiceproxy ( eq .Values.console.console_kind "spice" )}} {{- $envAll := . }} -{{ if eq .Values.console.console_kind "spice" }} {{- $dependencies := .Values.dependencies.static.spiceproxy }} {{- $mounts_nova_spiceproxy := .Values.pod.mounts.nova_spiceproxy.nova_spiceproxy }} @@ -88,6 +87,9 @@ spec: {{ tuple $envAll $envAll.Values.pod.resources.spiceproxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} command: - /tmp/nova-console-proxy.sh + ports: + - name: n-spice + containerPort: {{ tuple "compute_spice_proxy" "internal" "spice_proxy" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} volumeMounts: - name: nova-bin mountPath: /tmp/nova-console-proxy.sh @@ -118,4 +120,3 @@ spec: emptyDir: {} {{ if $mounts_nova_spiceproxy.volumes }}{{ toYaml $mounts_nova_spiceproxy.volumes | indent 8 }}{{ end }} {{- end }} -{{- end }} diff --git a/nova/templates/etc/_wsgi-nova-placement.conf.tpl b/nova/templates/etc/_wsgi-nova-placement.conf.tpl index 860680d49f..43e1e6c80e 100644 --- a/nova/templates/etc/_wsgi-nova-placement.conf.tpl +++ b/nova/templates/etc/_wsgi-nova-placement.conf.tpl @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */}} -Listen 0.0.0.0:{{ .Values.network.placement.port }} +Listen 0.0.0.0:{{ tuple "placement" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy @@ -23,7 +23,7 @@ SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded CustomLog /dev/stdout combined env=!forwarded CustomLog /dev/stdout proxy env=forwarded - + WSGIDaemonProcess placement-api processes=1 threads=4 user=nova group=nova display-name=%{GROUP} WSGIProcessGroup placement-api WSGIScriptAlias / /var/www/cgi-bin/nova/nova-placement-api diff --git a/nova/templates/service-novncproxy.yaml b/nova/templates/service-novncproxy.yaml index b43bb11225..a4f3a6c033 100644 --- a/nova/templates/service-novncproxy.yaml +++ b/nova/templates/service-novncproxy.yaml @@ -14,9 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */}} -{{- if .Values.manifests.service_novncproxy }} +{{- if and .Values.manifests.service_novncproxy ( eq .Values.console.console_kind "novnc" ) }} {{- $envAll := . }} -{{ if eq .Values.console.console_kind "novnc" }} --- apiVersion: v1 kind: Service @@ -24,10 +23,8 @@ metadata: name: {{ tuple "compute_novnc_proxy" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} spec: ports: - - name: nova-novncproxy - protocol: TCP - port: {{ .Values.network.novncproxy.port }} - targetPort: {{ .Values.network.novncproxy.targetPort }} + - name: n-novnc + port: {{ tuple "compute_novnc_proxy" "internal" "novnc_proxy" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} {{ if .Values.network.novncproxy.node_port.enabled }} nodePort: {{ .Values.network.novncproxy.node_port.port }} {{ end }} @@ -37,4 +34,3 @@ spec: type: NodePort {{ end }} {{- end }} -{{- end }} diff --git a/nova/templates/service-osapi.yaml b/nova/templates/service-osapi.yaml index 6214a19564..36114fa30e 100644 --- a/nova/templates/service-osapi.yaml +++ b/nova/templates/service-osapi.yaml @@ -24,7 +24,7 @@ metadata: spec: ports: - name: n-api - port: {{ .Values.network.osapi.port }} + port: {{ tuple "compute" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} {{ if .Values.network.osapi.node_port.enabled }} nodePort: {{ .Values.network.osapi.node_port.port }} {{ end }} diff --git a/nova/templates/service-placement.yaml b/nova/templates/service-placement.yaml index 3b02313805..0f7931d774 100644 --- a/nova/templates/service-placement.yaml +++ b/nova/templates/service-placement.yaml @@ -24,7 +24,7 @@ metadata: spec: ports: - name: p-api - port: {{ .Values.network.placement.port }} + port: {{ tuple "placement" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} {{ if .Values.network.placement.node_port.enabled }} nodePort: {{ .Values.network.placement.node_port.port }} {{ end }} diff --git a/nova/templates/service-spiceproxy.yaml b/nova/templates/service-spiceproxy.yaml index 11a30413fc..37bcea099b 100644 --- a/nova/templates/service-spiceproxy.yaml +++ b/nova/templates/service-spiceproxy.yaml @@ -14,9 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */}} -{{- if .Values.manifests.service_spiceproxy }} +{{- if and .Values.manifests.service_spiceproxy (eq .Values.console.console_kind "spice") }} {{- $envAll := . }} -{{ if eq .Values.console.console_kind "spice" }} --- apiVersion: v1 kind: Service @@ -24,10 +23,8 @@ metadata: name: {{ tuple "compute_spice_proxy" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} spec: ports: - - name: nova-spiceproxy - protocol: TCP - port: {{ .Values.network.spiceproxy.port }} - targetPort: {{ .Values.network.spiceproxy.targetPort }} + - name: n-spice + port: {{ tuple "compute_spice_proxy" "internal" "spice_proxy" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} {{ if .Values.network.spiceproxy.node_port.enabled }} nodePort: {{ .Values.network.spiceproxy.node_port.port }} {{ end }} @@ -37,4 +34,3 @@ spec: type: NodePort {{ end }} {{- end }} -{{- end }} diff --git a/nova/values.yaml b/nova/values.yaml index 3acc561dfa..b2fd32c0ae 100644 --- a/nova/values.yaml +++ b/nova/values.yaml @@ -164,14 +164,10 @@ network: node_port: enabled: false port: 30680 - port: 6080 - targetPort: 6080 spiceproxy: node_port: enabled: false port: 30682 - port: 6082 - targetPort: 6082 ssh: name: "nova-ssh" port: 8022 @@ -969,7 +965,9 @@ conf: cpu_allocation_ratio: 3.0 state_path: /var/lib/nova osapi_compute_listen: 0.0.0.0 - osapi_compute_listen_port: 8774 + #NOTE(portdirect): the bind port should not be defined, and is manipulated + # via the endpoints section. + osapi_compute_listen_port: null osapi_compute_workers: 1 metadata_workers: 1 use_neutron: true