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 -}}
{{- 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

View File

@ -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

View File

@ -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 }}

View File

@ -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:

View File

@ -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 }}

View File

@ -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
<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}
WSGIProcessGroup 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.
*/}}
{{- 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 }}

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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