Merge "Ingress controller service: consolidate to helm-toolkit"

This commit is contained in:
Zuul 2018-03-14 02:14:22 +00:00 committed by Gerrit Code Review
commit 32a468178b
24 changed files with 108 additions and 307 deletions

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_api }}
{{- $envAll := . }}
{{- if .Values.network.api.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "key-manager" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "key-manager" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_api }}
{{- $envAll := . }}
{{- if .Values.network.api.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "metering" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "metering" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_api }}
{{- $envAll := . }}
{{- if .Values.network.api.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "volume" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "volume" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_api }}
{{- $envAll := . }}
{{- if .Values.network.api.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "policy" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "policy" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_api }}
{{- $envAll := . }}
{{- if .Values.network.api.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "image" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "image" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_registry }}
{{- $envAll := . }}
{{- if .Values.network.registry.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "image_registry" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_registry .Values.network.registry.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "image_registry" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_api }}
{{- $envAll := . }}
{{- if .Values.network.api.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "metric" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "metric" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_api }}
{{- $envAll := . }}
{{- if .Values.network.api.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "orchestration" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "orchestration" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_cfn }}
{{- $envAll := . }}
{{- if .Values.network.cfn.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "cloudformation" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_cfn .Values.network.cfn.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "cloudformation" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_cloudwatch }}
{{- $envAll := . }}
{{- if .Values.network.cloudwatch.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "cloudwatch" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_cloudwatch .Values.network.cloudwatch.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "cloudwatch" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -0,0 +1,43 @@
{{/*
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.
*/}}
# This function creates a manifest for a services ingress rules.
# It can be used in charts dict created similar to the following:
# {- $serviceIngressOpts := dict "envAll" . "backendServiceType" "key-manager" -}
# { $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }
{{- define "helm-toolkit.manifests.service_ingress" -}}
{{- $envAll := index . "envAll" -}}
{{- $backendServiceType := index . "backendServiceType" -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- if index $envAll.Values.endpoints $backendServiceType }}
{{- if index $envAll.Values.endpoints $backendServiceType "ip" }}
{{- if index $envAll.Values.endpoints $backendServiceType "ip" "ingress" }}
clusterIP: {{ (index $envAll.Values.endpoints $backendServiceType "ip" "ingress") }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress }}
{{- $envAll := . }}
{{- if .Values.network.dashboard.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "dashboard" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress .Values.network.dashboard.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "dashboard" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -15,16 +15,6 @@ limitations under the License.
*/}}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $envAll := . }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "baremetal" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "baremetal" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_api }}
{{- $envAll := . }}
{{- if .Values.network.api.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "identity" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "identity" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_api }}
{{- $envAll := . }}
{{- if .Values.network.api.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "container-infra" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "container-infra" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_api }}
{{- $envAll := . }}
{{- if .Values.network.api.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "workflow" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "workflow" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,18 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_server }}
{{- $envAll := . }}
{{- if .Values.network.server.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "network" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_server .Values.network.server.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "network" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -18,7 +18,7 @@ limitations under the License.
set -ex
metadata_ip="{{- .Values.network.metadata.ip -}}"
metadata_ip="{{- .Values.endpoints.compute_metadata.ip.ingress -}}"
if [ -z "${metadata_ip}" ] ; then
metadata_ip=$(getent hosts metadata | awk '{print $1}')
fi
@ -27,4 +27,3 @@ cat <<EOF>/tmp/pod-shared/nova-api-metadata.ini
[DEFAULT]
metadata_host=$metadata_ip
EOF

View File

@ -103,10 +103,8 @@ limitations under the License.
{{- tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set .Values.conf.nova.cache "memcache_servers" | quote | trunc 0 -}}
{{- end -}}
{{- if empty .Values.conf.nova.DEFAULT.metadata_host -}}
{{- if .Values.network.metadata.ip -}}
{{- set .Values.conf.nova.DEFAULT "metadata_host" .Values.network.metadata.ip | quote | trunc 0 -}}
{{- end -}}
{{- if and (empty .Values.conf.nova.DEFAULT.metadata_host) .Values.endpoints.compute_metadata.ip.ingress -}}
{{- set .Values.conf.nova.DEFAULT "metadata_host" .Values.endpoints.compute_metadata.ip.ingress | quote | trunc 0 -}}
{{- end -}}
{{- if empty .Values.conf.nova.DEFAULT.metadata_port -}}

View File

@ -14,22 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_metadata }}
{{- $envAll := . }}
{{- if .Values.network.metadata.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "compute_metadata" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
{{- if .Values.network.metadata.ip }}
clusterIP: {{ .Values.network.metadata.ip }}
{{- end }}
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_metadata .Values.network.metadata.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "compute_metadata" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_osapi }}
{{- $envAll := . }}
{{- if .Values.network.osapi.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "compute" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_osapi .Values.network.osapi.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "compute" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -14,19 +14,7 @@ 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 }}
{{- if and .Values.manifests.service_ingress_placement .Values.network.placement.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "placement" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -138,8 +138,6 @@ network:
enabled: false
port: 30774
metadata:
# IF blank, set clusterIP and metadata_host dynamically
ip:
port: 8775
ingress:
public: true
@ -1254,6 +1252,9 @@ endpoints:
default: 6080
compute_metadata:
name: nova
ip:
# IF blank, set clusterIP and metadata_host dynamically
ingress: null
hosts:
default: nova-metadata
public: metadata

View File

@ -14,19 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service_ingress_api }}
{{- $envAll := . }}
{{- if .Values.network.api.ingress.public }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "clustering" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
port: 80
selector:
app: ingress-api
{{- end }}
{{- if and .Values.manifests.service_ingress_api .Values.network.api.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "clustering" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}