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
This commit is contained in:
portdirect 2018-03-03 15:07:37 -05:00
parent 16c6d31155
commit 42d2f3bc06
11 changed files with 31 additions and 33 deletions

View File

@ -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 -}} {{- 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 -}} {{- 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 apiVersion: v1
kind: ConfigMap kind: ConfigMap

View File

@ -64,10 +64,11 @@ spec:
- /tmp/nova-api.sh - /tmp/nova-api.sh
- stop - stop
ports: ports:
- containerPort: {{ .Values.network.osapi.port }} - name: n-api
containerPort: {{ tuple "compute" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.network.osapi.port }} port: {{ tuple "compute" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
volumeMounts: volumeMounts:
- name: nova-bin - name: nova-bin
mountPath: /tmp/nova-api.sh mountPath: /tmp/nova-api.sh

View File

@ -14,9 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- if .Values.manifests.deployment_novncproxy }} {{- if and .Values.manifests.deployment_novncproxy ( eq .Values.console.console_kind "novnc" )}}
{{- $envAll := . }} {{- $envAll := . }}
{{ if eq .Values.console.console_kind "novnc" }}
{{- $dependencies := .Values.dependencies.static.novncproxy }} {{- $dependencies := .Values.dependencies.static.novncproxy }}
{{- $mounts_nova_novncproxy := .Values.pod.mounts.nova_novncproxy.nova_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 }} {{ tuple $envAll $envAll.Values.pod.resources.novncproxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command: command:
- /tmp/nova-console-proxy.sh - /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: volumeMounts:
- name: nova-bin - name: nova-bin
mountPath: /tmp/nova-console-proxy.sh mountPath: /tmp/nova-console-proxy.sh
@ -118,4 +120,3 @@ spec:
emptyDir: {} emptyDir: {}
{{ if $mounts_nova_novncproxy.volumes }}{{ toYaml $mounts_nova_novncproxy.volumes | indent 8 }}{{ end }} {{ if $mounts_nova_novncproxy.volumes }}{{ toYaml $mounts_nova_novncproxy.volumes | indent 8 }}{{ end }}
{{- end }} {{- end }}
{{- end }}

View File

@ -62,11 +62,12 @@ spec:
- /tmp/nova-placement-api.sh - /tmp/nova-placement-api.sh
- stop - stop
ports: ports:
- containerPort: {{ .Values.network.placement.port }} - name: p-api
containerPort: {{ tuple "placement" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
readinessProbe: readinessProbe:
#NOTE(portdirect): use tcpSocket check as HTTP will return 401 #NOTE(portdirect): use tcpSocket check as HTTP will return 401
tcpSocket: tcpSocket:
port: {{ .Values.network.placement.port }} port: {{ tuple "placement" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
initialDelaySeconds: 15 initialDelaySeconds: 15
periodSeconds: 10 periodSeconds: 10
volumeMounts: volumeMounts:

View File

@ -14,9 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- if .Values.manifests.deployment_spiceproxy }} {{- if and .Values.manifests.deployment_spiceproxy ( eq .Values.console.console_kind "spice" )}}
{{- $envAll := . }} {{- $envAll := . }}
{{ if eq .Values.console.console_kind "spice" }}
{{- $dependencies := .Values.dependencies.static.spiceproxy }} {{- $dependencies := .Values.dependencies.static.spiceproxy }}
{{- $mounts_nova_spiceproxy := .Values.pod.mounts.nova_spiceproxy.nova_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 }} {{ tuple $envAll $envAll.Values.pod.resources.spiceproxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command: command:
- /tmp/nova-console-proxy.sh - /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: volumeMounts:
- name: nova-bin - name: nova-bin
mountPath: /tmp/nova-console-proxy.sh mountPath: /tmp/nova-console-proxy.sh
@ -118,4 +120,3 @@ spec:
emptyDir: {} emptyDir: {}
{{ if $mounts_nova_spiceproxy.volumes }}{{ toYaml $mounts_nova_spiceproxy.volumes | indent 8 }}{{ end }} {{ if $mounts_nova_spiceproxy.volumes }}{{ toYaml $mounts_nova_spiceproxy.volumes | indent 8 }}{{ end }}
{{- end }} {{- end }}
{{- end }}

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. 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 "%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 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 combined env=!forwarded
CustomLog /dev/stdout proxy env=forwarded CustomLog /dev/stdout proxy env=forwarded
<VirtualHost *:{{ .Values.network.placement.port }}> <VirtualHost *:{{ tuple "placement" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}>
WSGIDaemonProcess placement-api processes=1 threads=4 user=nova group=nova display-name=%{GROUP} WSGIDaemonProcess placement-api processes=1 threads=4 user=nova group=nova display-name=%{GROUP}
WSGIProcessGroup placement-api WSGIProcessGroup placement-api
WSGIScriptAlias / /var/www/cgi-bin/nova/nova-placement-api WSGIScriptAlias / /var/www/cgi-bin/nova/nova-placement-api

View File

@ -14,9 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- if .Values.manifests.service_novncproxy }} {{- if and .Values.manifests.service_novncproxy ( eq .Values.console.console_kind "novnc" ) }}
{{- $envAll := . }} {{- $envAll := . }}
{{ if eq .Values.console.console_kind "novnc" }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
@ -24,10 +23,8 @@ metadata:
name: {{ tuple "compute_novnc_proxy" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} name: {{ tuple "compute_novnc_proxy" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec: spec:
ports: ports:
- name: nova-novncproxy - name: n-novnc
protocol: TCP port: {{ tuple "compute_novnc_proxy" "internal" "novnc_proxy" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
port: {{ .Values.network.novncproxy.port }}
targetPort: {{ .Values.network.novncproxy.targetPort }}
{{ if .Values.network.novncproxy.node_port.enabled }} {{ if .Values.network.novncproxy.node_port.enabled }}
nodePort: {{ .Values.network.novncproxy.node_port.port }} nodePort: {{ .Values.network.novncproxy.node_port.port }}
{{ end }} {{ end }}
@ -37,4 +34,3 @@ spec:
type: NodePort type: NodePort
{{ end }} {{ end }}
{{- end }} {{- end }}
{{- end }}

View File

@ -24,7 +24,7 @@ metadata:
spec: spec:
ports: ports:
- name: n-api - 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 }} {{ if .Values.network.osapi.node_port.enabled }}
nodePort: {{ .Values.network.osapi.node_port.port }} nodePort: {{ .Values.network.osapi.node_port.port }}
{{ end }} {{ end }}

View File

@ -24,7 +24,7 @@ metadata:
spec: spec:
ports: ports:
- name: p-api - 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 }} {{ if .Values.network.placement.node_port.enabled }}
nodePort: {{ .Values.network.placement.node_port.port }} nodePort: {{ .Values.network.placement.node_port.port }}
{{ end }} {{ end }}

View File

@ -14,9 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- if .Values.manifests.service_spiceproxy }} {{- if and .Values.manifests.service_spiceproxy (eq .Values.console.console_kind "spice") }}
{{- $envAll := . }} {{- $envAll := . }}
{{ if eq .Values.console.console_kind "spice" }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
@ -24,10 +23,8 @@ metadata:
name: {{ tuple "compute_spice_proxy" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} name: {{ tuple "compute_spice_proxy" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec: spec:
ports: ports:
- name: nova-spiceproxy - name: n-spice
protocol: TCP port: {{ tuple "compute_spice_proxy" "internal" "spice_proxy" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
port: {{ .Values.network.spiceproxy.port }}
targetPort: {{ .Values.network.spiceproxy.targetPort }}
{{ if .Values.network.spiceproxy.node_port.enabled }} {{ if .Values.network.spiceproxy.node_port.enabled }}
nodePort: {{ .Values.network.spiceproxy.node_port.port }} nodePort: {{ .Values.network.spiceproxy.node_port.port }}
{{ end }} {{ end }}
@ -37,4 +34,3 @@ spec:
type: NodePort type: NodePort
{{ end }} {{ end }}
{{- end }} {{- end }}
{{- end }}

View File

@ -164,14 +164,10 @@ network:
node_port: node_port:
enabled: false enabled: false
port: 30680 port: 30680
port: 6080
targetPort: 6080
spiceproxy: spiceproxy:
node_port: node_port:
enabled: false enabled: false
port: 30682 port: 30682
port: 6082
targetPort: 6082
ssh: ssh:
name: "nova-ssh" name: "nova-ssh"
port: 8022 port: 8022
@ -969,7 +965,9 @@ conf:
cpu_allocation_ratio: 3.0 cpu_allocation_ratio: 3.0
state_path: /var/lib/nova state_path: /var/lib/nova
osapi_compute_listen: 0.0.0.0 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 osapi_compute_workers: 1
metadata_workers: 1 metadata_workers: 1
use_neutron: true use_neutron: true