diff --git a/Makefile b/Makefile index 69eba463c5..d97eb0739b 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,8 @@ SHELL := /bin/bash HELM := helm TASK := build -EXCLUDES := helm-toolkit doc tests tools logs tmp -CHARTS := helm-toolkit $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) +EXCLUDES := doc tests tools logs tmp +CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) .PHONY: $(EXCLUDES) $(CHARTS) @@ -42,7 +42,6 @@ build-%: lint-% clean: @echo "Removed .b64, _partials.tpl, and _globals.tpl files" - rm -f helm-toolkit/secrets/*.b64 rm -f */templates/_partials.tpl rm -f */templates/_globals.tpl rm -f *tgz */charts/*tgz diff --git a/helm-toolkit/.gitignore b/helm-toolkit/.gitignore deleted file mode 100644 index f5f3a91ab3..0000000000 --- a/helm-toolkit/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -secrets/* -!secrets/.gitkeep -templates/_secrets.tpl diff --git a/helm-toolkit/.helmignore b/helm-toolkit/.helmignore deleted file mode 100644 index e8ef5ffab2..0000000000 --- a/helm-toolkit/.helmignore +++ /dev/null @@ -1,27 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*~ -# Various IDEs -.project -.idea/ -*.tmproj - -bin/ -etc/ -patches/ -*.py -Makefile diff --git a/helm-toolkit/Chart.yaml b/helm-toolkit/Chart.yaml deleted file mode 100644 index 4e81afaa53..0000000000 --- a/helm-toolkit/Chart.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# 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. - -apiVersion: v1 -description: OpenStack-Helm Helm-Toolkit -name: helm-toolkit -version: 0.1.0 diff --git a/helm-toolkit/Makefile b/helm-toolkit/Makefile deleted file mode 100644 index 9662e57a83..0000000000 --- a/helm-toolkit/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# 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. - -EXCLUDE := templates/* charts/* Chart.yaml requirement* values.yaml Makefile utils/* helm-toolkit/Chart.yaml -SECRETS := $(shell find secrets -type f $(foreach e,$(EXCLUDE), -not -path "$(e)") ) - -templates/_secrets.tpl: Makefile $(SECRETS) - echo Generating $(CURDIR)/$@ - rm -f $@ - for i in $(SECRETS); do printf '{{ define "'$$i'" }}' >> $@; cat $$i >> $@; printf "{{ end }}\n" >> $@; done diff --git a/helm-toolkit/requirements.yaml b/helm-toolkit/requirements.yaml deleted file mode 100644 index 7a4ed34eeb..0000000000 --- a/helm-toolkit/requirements.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# 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. - -dependencies: [] diff --git a/helm-toolkit/templates/endpoints/_authenticated_endpoint_uri_lookup.tpl b/helm-toolkit/templates/endpoints/_authenticated_endpoint_uri_lookup.tpl deleted file mode 100644 index 2065551f81..0000000000 --- a/helm-toolkit/templates/endpoints/_authenticated_endpoint_uri_lookup.tpl +++ /dev/null @@ -1,48 +0,0 @@ -{{/* -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 helps resolve database style endpoints: -# -# Presuming that .Values contains an endpoint: definition for 'neutron-db' with the -# appropriate attributes, a call such as: -# { tuple "neutron-db" "internal" "userClass" "portName" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" } -# where portName is optional if a default port has been defined in .Values -# returns: mysql+pymysql://username:password@internal_host:3306/dbname - -{{- define "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" -}} -{{- $type := index . 0 -}} -{{- $endpoint := index . 1 -}} -{{- $userclass := index . 2 -}} -{{- $port := index . 3 -}} -{{- $context := index . 4 -}} -{{- $typeYamlSafe := $type | replace "-" "_" }} -{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }} -{{- $userMap := index $endpointMap.auth $userclass }} -{{- $clusterSuffix := printf "%s.%s" "svc" $context.Values.endpoints.cluster_domain_suffix }} -{{- with $endpointMap -}} -{{- $namespace := .namespace | default $context.Release.Namespace }} -{{- $endpointScheme := .scheme }} -{{- $endpointUser := index $userMap "username" }} -{{- $endpointPass := index $userMap "password" }} -{{- $endpointHost := index .hosts $endpoint | default .hosts.default}} -{{- $endpointPortMAP := index .port $port }} -{{- $endpointPort := index $endpointPortMAP $endpoint | default (index $endpointPortMAP "default") }} -{{- $endpointPath := .path | default "" }} -{{- $endpointClusterHostname := printf "%s.%s.%s" $endpointHost $namespace $clusterSuffix }} -{{- $endpointHostname := index .host_fqdn_override $endpoint | default .host_fqdn_override.default | default $endpointClusterHostname }} -{{- printf "%s://%s:%s@%s:%1.f%s" $endpointScheme $endpointUser $endpointPass $endpointHostname $endpointPort $endpointPath -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/endpoints/_endpoint_port_lookup.tpl b/helm-toolkit/templates/endpoints/_endpoint_port_lookup.tpl deleted file mode 100644 index 26c4768391..0000000000 --- a/helm-toolkit/templates/endpoints/_endpoint_port_lookup.tpl +++ /dev/null @@ -1,37 +0,0 @@ -{{/* -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 returns hostnames from endpoint definitions for use cases -# where the uri style return is not appropriate, and only the hostname -# portion is used or relevant in the template: -# { tuple "memcache" "internal" "portName" . | include "helm-toolkit.endpoints.endpoint_port_lookup" } -# returns: internal_host:port -# -# Output that requires the port aspect striped could simply split the output based on ':' - -{{- define "helm-toolkit.endpoints.endpoint_port_lookup" -}} -{{- $type := index . 0 -}} -{{- $endpoint := index . 1 -}} -{{- $port := index . 2 -}} -{{- $context := index . 3 -}} -{{- $typeYamlSafe := $type | replace "-" "_" }} -{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }} -{{- with $endpointMap -}} -{{- $endpointPortMAP := index .port $port }} -{{- $endpointPort := index $endpointPortMAP $endpoint | default (index $endpointPortMAP "default") }} -{{- printf "%1.f" $endpointPort -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/endpoints/_host_and_port_endpoint_uri_lookup.tpl b/helm-toolkit/templates/endpoints/_host_and_port_endpoint_uri_lookup.tpl deleted file mode 100644 index fc0beb72af..0000000000 --- a/helm-toolkit/templates/endpoints/_host_and_port_endpoint_uri_lookup.tpl +++ /dev/null @@ -1,43 +0,0 @@ -{{/* -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 returns hostnames from endpoint definitions for use cases -# where the uri style return is not appropriate, and only the hostname -# portion is used or relevant in the template: -# { tuple "memcache" "internal" "portName" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" } -# returns: internal_host:port -# -# Output that requires the port aspect striped could simply split the output based on ':' - -{{- define "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" -}} -{{- $type := index . 0 -}} -{{- $endpoint := index . 1 -}} -{{- $port := index . 2 -}} -{{- $context := index . 3 -}} -{{- $typeYamlSafe := $type | replace "-" "_" }} -{{- $clusterSuffix := printf "%s.%s" "svc" $context.Values.endpoints.cluster_domain_suffix }} -{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }} -{{- with $endpointMap -}} -{{- $namespace := .namespace | default $context.Release.Namespace }} -{{- $endpointScheme := .scheme }} -{{- $endpointHost := index .hosts $endpoint | default .hosts.default }} -{{- $endpointPortMAP := index .port $port }} -{{- $endpointPort := index $endpointPortMAP $endpoint | default (index $endpointPortMAP "default") }} -{{- $endpointClusterHostname := printf "%s.%s.%s" $endpointHost $namespace $clusterSuffix }} -{{- $endpointHostname := index .host_fqdn_override $endpoint | default .host_fqdn_override.default | default $endpointClusterHostname }} -{{- printf "%s:%1.f" $endpointHostname $endpointPort -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/endpoints/_hostname_fqdn_endpoint_lookup.tpl b/helm-toolkit/templates/endpoints/_hostname_fqdn_endpoint_lookup.tpl deleted file mode 100644 index 20a1cff86f..0000000000 --- a/helm-toolkit/templates/endpoints/_hostname_fqdn_endpoint_lookup.tpl +++ /dev/null @@ -1,38 +0,0 @@ -{{/* -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 returns hostnames from endpoint definitions for use cases -# where the uri style return is not appropriate, and only the hostname -# portion is used or relevant in the template: -# { tuple "memcache" "internal" . | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" } -# returns: internal_host_fqdn - -{{- define "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" -}} -{{- $type := index . 0 -}} -{{- $endpoint := index . 1 -}} -{{- $context := index . 2 -}} -{{- $typeYamlSafe := $type | replace "-" "_" }} -{{- $clusterSuffix := printf "%s.%s" "svc" $context.Values.endpoints.cluster_domain_suffix }} -{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }} -{{- with $endpointMap -}} -{{- $namespace := .namespace | default $context.Release.Namespace }} -{{- $endpointScheme := .scheme }} -{{- $endpointHost := index .hosts $endpoint | default .hosts.default }} -{{- $endpointClusterHostname := printf "%s.%s.%s" $endpointHost $namespace $clusterSuffix }} -{{- $endpointHostname := index .host_fqdn_override $endpoint | default .host_fqdn_override.default | default $endpointClusterHostname }} -{{- printf "%s" $endpointHostname -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/endpoints/_hostname_namespaced_endpoint_lookup.tpl b/helm-toolkit/templates/endpoints/_hostname_namespaced_endpoint_lookup.tpl deleted file mode 100644 index b3f234d3f0..0000000000 --- a/helm-toolkit/templates/endpoints/_hostname_namespaced_endpoint_lookup.tpl +++ /dev/null @@ -1,37 +0,0 @@ -{{/* -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 returns hostnames from endpoint definitions for use cases -# where the uri style return is not appropriate, and only the hostname -# portion is used or relevant in the template: -# { tuple "memcache" "internal" . | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" } -# returns: internal_host_namespaced - -{{- define "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" -}} -{{- $type := index . 0 -}} -{{- $endpoint := index . 1 -}} -{{- $context := index . 2 -}} -{{- $typeYamlSafe := $type | replace "-" "_" }} -{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }} -{{- with $endpointMap -}} -{{- $namespace := .namespace | default $context.Release.Namespace }} -{{- $endpointScheme := .scheme }} -{{- $endpointHost := index .hosts $endpoint | default .hosts.default }} -{{- $endpointClusterHostname := printf "%s.%s" $endpointHost $namespace }} -{{- $endpointHostname := index .host_fqdn_override $endpoint | default .host_fqdn_override.default | default $endpointClusterHostname }} -{{- printf "%s" $endpointHostname -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/endpoints/_hostname_short_endpoint_lookup.tpl b/helm-toolkit/templates/endpoints/_hostname_short_endpoint_lookup.tpl deleted file mode 100644 index 6fc17c314e..0000000000 --- a/helm-toolkit/templates/endpoints/_hostname_short_endpoint_lookup.tpl +++ /dev/null @@ -1,39 +0,0 @@ -{{/* -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 returns hostnames from endpoint definitions for use cases -# where the uri style return is not appropriate, and only the short hostname or -# kubernetes servicename is used or relevant in the template: -# { tuple "memcache" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" } -# returns: the short internal hostname, which will also match the service name - -{{- define "helm-toolkit.endpoints.hostname_short_endpoint_lookup" -}} -{{- $type := index . 0 -}} -{{- $endpoint := index . 1 -}} -{{- $context := index . 2 -}} -{{- $typeYamlSafe := $type | replace "-" "_" }} -{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }} -{{- with $endpointMap -}} -{{- $endpointScheme := .scheme }} -{{- $endpointHost := index .hosts $endpoint | default .hosts.default}} -{{- if regexMatch "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+" $endpointHost }} -{{- printf "%s" $typeYamlSafe -}} -{{- else }} -{{- $endpointHostname := printf "%s" $endpointHost }} -{{- printf "%s" $endpointHostname -}} -{{- end }} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/endpoints/_keystone_endpoint_name_lookup.tpl b/helm-toolkit/templates/endpoints/_keystone_endpoint_name_lookup.tpl deleted file mode 100644 index 2f6cf081e2..0000000000 --- a/helm-toolkit/templates/endpoints/_keystone_endpoint_name_lookup.tpl +++ /dev/null @@ -1,29 +0,0 @@ -{{/* -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 is used in endpoint management templates -# it returns the service type for an openstack service eg: -# { tuple orchestration . | include "keystone_endpoint_name_lookup" } -# will return "heat" - -{{- define "helm-toolkit.endpoints.keystone_endpoint_name_lookup" -}} -{{- $type := index . 0 -}} -{{- $context := index . 1 -}} -{{- $typeYamlSafe := $type | replace "-" "_" }} -{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }} -{{- $endpointName := index $endpointMap "name" }} -{{- $endpointName | quote -}} -{{- end -}} diff --git a/helm-toolkit/templates/endpoints/_keystone_endpoint_path_lookup.tpl b/helm-toolkit/templates/endpoints/_keystone_endpoint_path_lookup.tpl deleted file mode 100644 index 0945be626c..0000000000 --- a/helm-toolkit/templates/endpoints/_keystone_endpoint_path_lookup.tpl +++ /dev/null @@ -1,33 +0,0 @@ -{{/* -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 returns the path for a service, it takes an tuple -# input in the form: service-type, endpoint-class, port-name. eg: -# { tuple "orchestration" "public" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_path_lookup" } -# will return the appropriate path. - -{{- define "helm-toolkit.endpoints.keystone_endpoint_path_lookup" -}} -{{- $type := index . 0 -}} -{{- $endpoint := index . 1 -}} -{{- $port := index . 2 -}} -{{- $context := index . 3 -}} -{{- $typeYamlSafe := $type | replace "-" "_" }} -{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }} -{{- with $endpointMap -}} -{{- $endpointPath := index .path $endpoint | default .path.default | default "/" }} -{{- printf "%s" $endpointPath -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/endpoints/_keystone_endpoint_scheme_lookup.tpl b/helm-toolkit/templates/endpoints/_keystone_endpoint_scheme_lookup.tpl deleted file mode 100644 index 150a5446bd..0000000000 --- a/helm-toolkit/templates/endpoints/_keystone_endpoint_scheme_lookup.tpl +++ /dev/null @@ -1,34 +0,0 @@ -{{/* -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 returns the scheme for a service, it takes an tuple -# input in the form: service-type, endpoint-class, port-name. eg: -# { tuple "etcd" "internal" "client" . | include "helm-toolkit.endpoints.keystone_scheme_lookup" } -# will return the scheme setting for this particular endpoint. In other words, for most endpoints -# it will return either 'http' or 'https' - -{{- define "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" -}} -{{- $type := index . 0 -}} -{{- $endpoint := index . 1 -}} -{{- $port := index . 2 -}} -{{- $context := index . 3 -}} -{{- $typeYamlSafe := $type | replace "-" "_" }} -{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }} -{{- with $endpointMap -}} -{{- $endpointScheme := index .scheme $endpoint | default .scheme.default | default "http" }} -{{- printf "%s" $endpointScheme -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/endpoints/_keystone_endpoint_uri_lookup.tpl b/helm-toolkit/templates/endpoints/_keystone_endpoint_uri_lookup.tpl deleted file mode 100644 index 8c13651ef7..0000000000 --- a/helm-toolkit/templates/endpoints/_keystone_endpoint_uri_lookup.tpl +++ /dev/null @@ -1,45 +0,0 @@ -{{/* -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 returns the endpoint uri for a service, it takes an tuple -# input in the form: service-type, endpoint-class, port-name. eg: -# { tuple "orchestration" "public" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" } -# will return the appropriate URI. - -{{- define "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" -}} -{{- $type := index . 0 -}} -{{- $endpoint := index . 1 -}} -{{- $port := index . 2 -}} -{{- $context := index . 3 -}} -{{- $typeYamlSafe := $type | replace "-" "_" }} -{{- $clusterSuffix := printf "%s.%s" "svc" $context.Values.endpoints.cluster_domain_suffix }} -{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }} -{{- with $endpointMap -}} -{{- $namespace := $endpointMap.namespace | default $context.Release.Namespace }} -{{- $endpointScheme := index .scheme $endpoint | default .scheme.default }} -{{- $endpointHost := index .hosts $endpoint | default .hosts.default }} -{{- $endpointPortMAP := index .port $port }} -{{- $endpointPort := index $endpointPortMAP $endpoint | default (index $endpointPortMAP "default") }} -{{- $endpointPath := index .path $endpoint | default .path.default | default "/" }} -{{- $endpointClusterHostname := printf "%s.%s.%s" $endpointHost $namespace $clusterSuffix }} -{{- if regexMatch "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+" $endpointHost }} -{{- printf "%s://%s:%1.f%s" $endpointScheme $endpointHost $endpointPort $endpointPath -}} -{{- else -}} -{{- $endpointFqdnHostname := index .host_fqdn_override $endpoint | default .host_fqdn_override.default | default $endpointClusterHostname }} -{{- printf "%s://%s:%1.f%s" $endpointScheme $endpointFqdnHostname $endpointPort $endpointPath -}} -{{- end -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/endpoints/_service_name_endpoint_with_namespace_lookup.tpl b/helm-toolkit/templates/endpoints/_service_name_endpoint_with_namespace_lookup.tpl deleted file mode 100644 index a3c2f496a3..0000000000 --- a/helm-toolkit/templates/endpoints/_service_name_endpoint_with_namespace_lookup.tpl +++ /dev/null @@ -1,48 +0,0 @@ -{{/* -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 returns endpoint ":" pair from an endpoint -# definition. This is used in kubernetes-entrypoint to support dependencies -# between different services in different namespaces. -# returns: the endpoint namespace and the service name, delimited by a colon -# -# Normally, the service name is constructed dynamically from the hostname -# however when an ip address is used as the hostname, we default to -# namespace:endpointCategoryName in order to construct a valid service name -# however this can be overriden to a custom service name by defining -# .service.name within the endpoint definition - -{{- define "helm-toolkit.endpoints.service_name_endpoint_with_namespace_lookup" -}} -{{- $type := index . 0 -}} -{{- $endpoint := index . 1 -}} -{{- $context := index . 2 -}} -{{- $typeYamlSafe := $type | replace "-" "_" }} -{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }} -{{- with $endpointMap -}} -{{- $endpointScheme := .scheme }} -{{- $endpointName := index .hosts $endpoint | default .hosts.default}} -{{- $endpointNamespace := .namespace | default $context.Release.Namespace }} -{{- if regexMatch "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+" $endpointName }} -{{- if .service.name }} -{{- printf "%s:%s" $endpointNamespace .service.name -}} -{{- else -}} -{{- printf "%s:%s" $endpointNamespace $typeYamlSafe -}} -{{- end -}} -{{- else -}} -{{- printf "%s:%s" $endpointNamespace $endpointName -}} -{{- end -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/manifests/_ingress.yaml.tpl b/helm-toolkit/templates/manifests/_ingress.yaml.tpl deleted file mode 100644 index 09ca8515f7..0000000000 --- a/helm-toolkit/templates/manifests/_ingress.yaml.tpl +++ /dev/null @@ -1,73 +0,0 @@ -{{/* -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: -# {- $ingressOpts := dict "envAll" . "backendServiceType" "key-manager" -} -# { $ingressOpts | include "helm-toolkit.manifests.ingress" } - -{{- define "helm-toolkit.manifests.ingress._host_rules" -}} -{{- $vHost := index . "vHost" -}} -{{- $backendName := index . "backendName" -}} -{{- $backendPort := index . "backendPort" -}} -- host: {{ $vHost }} - http: - paths: - - path: / - backend: - serviceName: {{ $backendName }} - servicePort: {{ $backendPort }} -{{- end }} - -{{- define "helm-toolkit.manifests.ingress" -}} -{{- $envAll := index . "envAll" -}} -{{- $backendService := index . "backendService" | default "api" -}} -{{- $backendServiceType := index . "backendServiceType" -}} -{{- $backendPort := index . "backendPort" -}} -{{- $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" }} -{{- $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: {{ index $envAll.Values.network $backendService "ingress" "classes" "namespace" | quote }} -{{ toYaml (index $envAll.Values.network $backendService "ingress" "annotations") | indent 4 }} -spec: - rules: -{{- range $key1, $vHost := tuple $hostName (printf "%s.%s" $hostName $envAll.Release.Namespace) (printf "%s.%s.svc.%s" $hostName $envAll.Release.Namespace $envAll.Values.endpoints.cluster_domain_suffix)}} -{{- $hostRules := dict "vHost" $vHost "backendName" $backendName "backendPort" $backendPort }} -{{ $hostRules | include "helm-toolkit.manifests.ingress._host_rules" | indent 4}} -{{- end }} -{{- if not ( hasSuffix ( printf ".%s.svc.%s" $envAll.Release.Namespace $envAll.Values.endpoints.cluster_domain_suffix) $hostNameFull) }} -{{- $hostNameFullRules := dict "vHost" $hostNameFull "backendName" $backendName "backendPort" $backendPort }} -{{ $hostNameFullRules | include "helm-toolkit.manifests.ingress._host_rules" | indent 4}} ---- -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - name: {{ printf "%s-%s" $ingressName "fqdn" }} - annotations: - kubernetes.io/ingress.class: {{ index $envAll.Values.network $backendService "ingress" "classes" "cluster" | quote }} -{{ toYaml (index $envAll.Values.network $backendService "ingress" "annotations") | indent 4 }} -spec: - rules: -{{ $hostNameFullRules | include "helm-toolkit.manifests.ingress._host_rules" | indent 4}} -{{- end }} -{{- end }} diff --git a/helm-toolkit/templates/manifests/_job-bootstrap.yaml b/helm-toolkit/templates/manifests/_job-bootstrap.yaml deleted file mode 100644 index f9b6453d5c..0000000000 --- a/helm-toolkit/templates/manifests/_job-bootstrap.yaml +++ /dev/null @@ -1,96 +0,0 @@ -{{/* -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 db creation and user management. -# It can be used in charts dict created similar to the following: -# {- $dbSyncJob := dict "envAll" . "serviceName" "senlin" -} -# { $dbSyncJob | include "helm-toolkit.manifests.job_db_sync" } - -{{- define "helm-toolkit.manifests.job_bootstrap" -}} -{{- $envAll := index . "envAll" -}} -{{- $serviceName := index . "serviceName" -}} -{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} -{{- $podVolMounts := index . "podVolMounts" | default false -}} -{{- $podVols := index . "podVols" | default false -}} -{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} -{{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}} -{{- $configFile := index . "configFile" | default (printf "/etc/%s/%s.conf" $serviceName $serviceName ) -}} -{{- $keystoneUser := index . "keystoneUser" | default $serviceName -}} -{{- $openrc := index . "openrc" | default "true" -}} - -{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} - -{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "bootstrap" }} -{{ tuple $envAll "bootstrap" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ printf "%s-%s" $serviceNamePretty "bootstrap" | quote }} -spec: - template: - metadata: - labels: -{{ tuple $envAll $serviceName "bootstrap" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: -{{ toYaml $nodeSelector | indent 8 }} - initContainers: -{{ tuple $envAll "bootstrap" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: bootstrap - image: {{ $envAll.Values.images.tags.bootstrap }} - imagePullPolicy: {{ $envAll.Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.bootstrap | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} -{{- if eq $openrc "true" }} - env: -{{- with $env := dict "ksUserSecret" ( index $envAll.Values.secrets.identity $keystoneUser ) }} -{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }} -{{- end }} -{{- end }} - command: - - /tmp/bootstrap.sh - volumeMounts: - - name: bootstrap-sh - mountPath: /tmp/bootstrap.sh - subPath: bootstrap.sh - readOnly: true - - name: etc-service - mountPath: {{ dir $configFile | quote }} - - name: bootstrap-conf - mountPath: {{ $configFile | quote }} - subPath: {{ base $configFile | quote }} - readOnly: true -{{- if $podVolMounts }} -{{ $podVolMounts | toYaml | indent 12 }} -{{- end }} - volumes: - - name: bootstrap-sh - configMap: - name: {{ $configMapBin | quote }} - defaultMode: 0555 - - name: etc-service - emptyDir: {} - - name: bootstrap-conf - configMap: - name: {{ $configMapEtc | quote }} - defaultMode: 0444 -{{- if $podVols }} -{{ $podVols | toYaml | indent 8 }} -{{- end }} -{{- end }} diff --git a/helm-toolkit/templates/manifests/_job-db-drop-mysql.yaml.tpl b/helm-toolkit/templates/manifests/_job-db-drop-mysql.yaml.tpl deleted file mode 100644 index 43cae950be..0000000000 --- a/helm-toolkit/templates/manifests/_job-db-drop-mysql.yaml.tpl +++ /dev/null @@ -1,122 +0,0 @@ -{{/* -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 db creation and user management. -# It can be used in charts dict created similar to the following: -# {- $dbToDropJob := dict "envAll" . "serviceName" "senlin" -} -# { $dbToDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" } -# -# If the service does not use olso then the db can be managed with: -# {- $dbToDrop := dict "inputType" "secret" "adminSecret" .Values.secrets.oslo_db.admin "userSecret" .Values.secrets.oslo_db.horizon -} -# {- $dbToDropJob := dict "envAll" . "serviceName" "horizon" "dbToDrop" $dbToDrop -} -# { $dbToDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" } - -{{- define "helm-toolkit.manifests.job_db_drop_mysql" -}} -{{- $envAll := index . "envAll" -}} -{{- $serviceName := index . "serviceName" -}} -{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} -{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} -{{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}} -{{- $dbToDrop := index . "dbToDrop" | default ( dict "adminSecret" $envAll.Values.secrets.oslo_db.admin "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "configDbSection" "database" "configDbKey" "connection" ) -}} -{{- $dbsToDrop := default (list $dbToDrop) (index . "dbsToDrop") }} - -{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} - -{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "db-drop" }} -{{ tuple $envAll "db_drop" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ printf "%s-%s" $serviceNamePretty "db-drop" | quote }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll $serviceName "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: -{{ toYaml $nodeSelector | indent 8 }} - initContainers: -{{ tuple $envAll "db_drop" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: -{{- range $key1, $dbToDrop := $dbsToDrop }} -{{ $dbToDropType := default "oslo" $dbToDrop.inputType }} - - name: {{ printf "%s-%s-%d" $serviceNamePretty "db-drop" $key1 | quote }} - image: {{ $envAll.Values.images.tags.db_drop }} - imagePullPolicy: {{ $envAll.Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ $dbToDrop.adminSecret | quote }} - key: DB_CONNECTION -{{- if eq $dbToDropType "oslo" }} - - name: OPENSTACK_CONFIG_FILE - value: {{ $dbToDrop.configFile | quote }} - - name: OPENSTACK_CONFIG_DB_SECTION - value: {{ $dbToDrop.configDbSection | quote }} - - name: OPENSTACK_CONFIG_DB_KEY - value: {{ $dbToDrop.configDbKey | quote }} -{{- end }} -{{- if eq $dbToDropType "secret" }} - - name: DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ $dbToDrop.userSecret | quote }} - key: DB_CONNECTION -{{- end }} - command: - - /tmp/db-drop.py - volumeMounts: - - name: db-drop-sh - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true -{{- if eq $dbToDropType "oslo" }} - - name: etc-service - mountPath: {{ dir $dbToDrop.configFile | quote }} - - name: db-drop-conf - mountPath: {{ $dbToDrop.configFile | quote }} - subPath: {{ base $dbToDrop.configFile | quote }} - readOnly: true -{{- end }} -{{- end }} - volumes: - - name: db-drop-sh - configMap: - name: {{ $configMapBin | quote }} - defaultMode: 0555 -{{- $local := dict "configMapBinFirst" true -}} -{{- range $key1, $dbToDrop := $dbsToDrop }} -{{- $dbToDropType := default "oslo" $dbToDrop.inputType }} -{{- if and (eq $dbToDropType "oslo") $local.configMapBinFirst }} -{{- $_ := set $local "configMapBinFirst" false }} - - name: etc-service - emptyDir: {} - - name: db-drop-conf - configMap: - name: {{ $configMapEtc | quote }} - defaultMode: 0444 -{{- end -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/manifests/_job-db-init-mysql.yaml.tpl b/helm-toolkit/templates/manifests/_job-db-init-mysql.yaml.tpl deleted file mode 100644 index 1656729cf6..0000000000 --- a/helm-toolkit/templates/manifests/_job-db-init-mysql.yaml.tpl +++ /dev/null @@ -1,119 +0,0 @@ -{{/* -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 db creation and user management. -# It can be used in charts dict created similar to the following: -# {- $dbToInitJob := dict "envAll" . "serviceName" "senlin" -} -# { $dbToInitJob | include "helm-toolkit.manifests.job_db_init_mysql" } -# -# If the service does not use olso then the db can be managed with: -# {- $dbToInit := dict "inputType" "secret" "adminSecret" .Values.secrets.oslo_db.admin "userSecret" .Values.secrets.oslo_db.horizon -} -# {- $dbToInitJob := dict "envAll" . "serviceName" "horizon" "dbToInit" $dbToInit -} -# { $dbToInitJob | include "helm-toolkit.manifests.job_db_init_mysql" } - -{{- define "helm-toolkit.manifests.job_db_init_mysql" -}} -{{- $envAll := index . "envAll" -}} -{{- $serviceName := index . "serviceName" -}} -{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} -{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} -{{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}} -{{- $dbToInit := index . "dbToInit" | default ( dict "adminSecret" $envAll.Values.secrets.oslo_db.admin "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "configDbSection" "database" "configDbKey" "connection" ) -}} -{{- $dbsToInit := default (list $dbToInit) (index . "dbsToInit") }} - -{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} - -{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "db-init" }} -{{ tuple $envAll "db_init" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ printf "%s-%s" $serviceNamePretty "db-init" | quote }} -spec: - template: - metadata: - labels: -{{ tuple $envAll $serviceName "db-init" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: -{{ toYaml $nodeSelector | indent 8 }} - initContainers: -{{ tuple $envAll "db_init" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: -{{- range $key1, $dbToInit := $dbsToInit }} -{{ $dbToInitType := default "oslo" $dbToInit.inputType }} - - name: {{ printf "%s-%s-%d" $serviceNamePretty "db-init" $key1 | quote }} - image: {{ $envAll.Values.images.tags.db_init }} - imagePullPolicy: {{ $envAll.Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ $dbToInit.adminSecret | quote }} - key: DB_CONNECTION -{{- if eq $dbToInitType "oslo" }} - - name: OPENSTACK_CONFIG_FILE - value: {{ $dbToInit.configFile | quote }} - - name: OPENSTACK_CONFIG_DB_SECTION - value: {{ $dbToInit.configDbSection | quote }} - - name: OPENSTACK_CONFIG_DB_KEY - value: {{ $dbToInit.configDbKey | quote }} -{{- end }} -{{- if eq $dbToInitType "secret" }} - - name: DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ $dbToInit.userSecret | quote }} - key: DB_CONNECTION -{{- end }} - command: - - /tmp/db-init.py - volumeMounts: - - name: db-init-sh - mountPath: /tmp/db-init.py - subPath: db-init.py - readOnly: true -{{- if eq $dbToInitType "oslo" }} - - name: etc-service - mountPath: {{ dir $dbToInit.configFile | quote }} - - name: db-init-conf - mountPath: {{ $dbToInit.configFile | quote }} - subPath: {{ base $dbToInit.configFile | quote }} - readOnly: true -{{- end }} -{{- end }} - volumes: - - name: db-init-sh - configMap: - name: {{ $configMapBin | quote }} - defaultMode: 0555 -{{- $local := dict "configMapBinFirst" true -}} -{{- range $key1, $dbToInit := $dbsToInit }} -{{- $dbToInitType := default "oslo" $dbToInit.inputType }} -{{- if and (eq $dbToInitType "oslo") $local.configMapBinFirst }} -{{- $_ := set $local "configMapBinFirst" false }} - - name: etc-service - emptyDir: {} - - name: db-init-conf - configMap: - name: {{ $configMapEtc | quote }} - defaultMode: 0444 -{{- end -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/manifests/_job-db-sync.yaml.tpl b/helm-toolkit/templates/manifests/_job-db-sync.yaml.tpl deleted file mode 100644 index 9ce6aafd36..0000000000 --- a/helm-toolkit/templates/manifests/_job-db-sync.yaml.tpl +++ /dev/null @@ -1,93 +0,0 @@ -{{/* -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 db migration and management. -# It can be used in charts dict created similar to the following: -# {- $dbSyncJob := dict "envAll" . "serviceName" "senlin" -} -# { $dbSyncJob | include "helm-toolkit.manifests.job_db_sync" } - -{{- define "helm-toolkit.manifests.job_db_sync" -}} -{{- $envAll := index . "envAll" -}} -{{- $serviceName := index . "serviceName" -}} -{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} -{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} -{{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}} -{{- $podVolMounts := index . "podVolMounts" | default false -}} -{{- $podVols := index . "podVols" | default false -}} -{{- $podEnvVars := index . "podEnvVars" | default false -}} -{{- $dbToSync := index . "dbToSync" | default ( dict "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "image" ( index $envAll.Values.images.tags ( printf "%s_db_sync" $serviceName )) ) -}} - -{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} - -{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "db-sync" }} -{{ tuple $envAll "db_sync" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ printf "%s-%s" $serviceNamePretty "db-sync" | quote }} -spec: - template: - metadata: - labels: -{{ tuple $envAll $serviceName "db-sync" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: -{{ toYaml $nodeSelector | indent 8 }} - initContainers: -{{ tuple $envAll "db_sync" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: {{ printf "%s-%s" $serviceNamePretty "db-sync" | quote }} - image: {{ $dbToSync.image | quote }} - imagePullPolicy: {{ $envAll.Values.images.pull_policy | quote }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_sync | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} -{{- if $podEnvVars }} - env: -{{ $podEnvVars | toYaml | indent 12 }} -{{- end }} - command: - - /tmp/db-sync.sh - volumeMounts: - - name: db-sync-sh - mountPath: /tmp/db-sync.sh - subPath: db-sync.sh - readOnly: true - - name: etc-service - mountPath: {{ dir $dbToSync.configFile | quote }} - - name: db-sync-conf - mountPath: {{ $dbToSync.configFile | quote }} - subPath: {{ base $dbToSync.configFile | quote }} - readOnly: true -{{- if $podVolMounts }} -{{ $podVolMounts | toYaml | indent 12 }} -{{- end }} - volumes: - - name: db-sync-sh - configMap: - name: {{ $configMapBin | quote }} - defaultMode: 0555 - - name: etc-service - emptyDir: {} - - name: db-sync-conf - configMap: - name: {{ $configMapEtc | quote }} - defaultMode: 0444 -{{- if $podVols }} -{{ $podVols | toYaml | indent 8 }} -{{- end }} -{{- end }} diff --git a/helm-toolkit/templates/manifests/_job-ks-endpoints.yaml.tpl b/helm-toolkit/templates/manifests/_job-ks-endpoints.yaml.tpl deleted file mode 100644 index f07cb630b5..0000000000 --- a/helm-toolkit/templates/manifests/_job-ks-endpoints.yaml.tpl +++ /dev/null @@ -1,82 +0,0 @@ -{{/* -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 keystone service management. -# It can be used in charts dict created similar to the following: -# {- $ksEndpointJob := dict "envAll" . "serviceName" "senlin" "serviceTypes" ( tuple "clustering" ) -} -# { $ksEndpointJob | include "helm-toolkit.manifests.job_ks_endpoints" } - -{{- define "helm-toolkit.manifests.job_ks_endpoints" -}} -{{- $envAll := index . "envAll" -}} -{{- $serviceName := index . "serviceName" -}} -{{- $serviceTypes := index . "serviceTypes" -}} -{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} -{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} -{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} - -{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "ks-endpoints" }} -{{ tuple $envAll "ks_endpoints" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ printf "%s-%s" $serviceNamePretty "ks-endpoints" | quote }} -spec: - template: - metadata: - labels: -{{ tuple $envAll $serviceName "ks-endpoints" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: -{{ toYaml $nodeSelector | indent 8 }} - initContainers: -{{ tuple $envAll "ks_endpoints" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: -{{- range $key1, $osServiceType := $serviceTypes }} -{{- range $key2, $osServiceEndPoint := tuple "admin" "internal" "public" }} - - name: {{ printf "%s-%s-%s" $osServiceType "ks-endpoints" $osServiceEndPoint | quote }} - 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 | quote }} - - name: OS_SERVICE_NAME - value: {{ tuple $osServiceType $envAll | include "helm-toolkit.endpoints.keystone_endpoint_name_lookup" }} - - name: OS_SERVICE_TYPE - value: {{ $osServiceType | quote }} - - name: OS_SERVICE_ENDPOINT - value: {{ tuple $osServiceType $osServiceEndPoint "api" $envAll | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | quote }} -{{- end }} -{{- end }} - volumes: - - name: ks-endpoints-sh - configMap: - name: {{ $configMapBin | quote }} - defaultMode: 0555 -{{- end }} diff --git a/helm-toolkit/templates/manifests/_job-ks-service.yaml.tpl b/helm-toolkit/templates/manifests/_job-ks-service.yaml.tpl deleted file mode 100644 index 628b24cac9..0000000000 --- a/helm-toolkit/templates/manifests/_job-ks-service.yaml.tpl +++ /dev/null @@ -1,76 +0,0 @@ -{{/* -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 keystone service management. -# It can be used in charts dict created similar to the following: -# {- $ksServiceJob := dict "envAll" . "serviceName" "senlin" "serviceTypes" ( tuple "clustering" ) -} -# { $ksServiceJob | include "helm-toolkit.manifests.job_ks_service" } - -{{- define "helm-toolkit.manifests.job_ks_service" -}} -{{- $envAll := index . "envAll" -}} -{{- $serviceName := index . "serviceName" -}} -{{- $serviceTypes := index . "serviceTypes" -}} -{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} -{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} -{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} - -{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "ks-service" }} -{{ tuple $envAll "ks_service" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ printf "%s-%s" $serviceNamePretty "ks-service" | quote }} -spec: - template: - metadata: - labels: -{{ tuple $envAll $serviceName "ks-service" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: -{{ toYaml $nodeSelector | indent 8 }} - initContainers: -{{ tuple $envAll "ks_service" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: -{{- range $key1, $osServiceType := $serviceTypes }} - - name: {{ printf "%s-%s" $osServiceType "ks-service-registration" | quote }} - image: {{ $envAll.Values.images.tags.ks_service }} - imagePullPolicy: {{ $envAll.Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_service | 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 | quote }} -{{- end }} - volumes: - - name: ks-service-sh - configMap: - name: {{ $configMapBin | quote }} - defaultMode: 0555 -{{- end }} diff --git a/helm-toolkit/templates/manifests/_job-ks-user.yaml.tpl b/helm-toolkit/templates/manifests/_job-ks-user.yaml.tpl deleted file mode 100644 index 1a79094cc1..0000000000 --- a/helm-toolkit/templates/manifests/_job-ks-user.yaml.tpl +++ /dev/null @@ -1,82 +0,0 @@ -{{/* -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 keystone user management. -# It can be used in charts dict created similar to the following: -# {- $ksUserJob := dict "envAll" . "serviceName" "senlin" } -# { $ksUserJob | include "helm-toolkit.manifests.job_ks_user" } - -{{- define "helm-toolkit.manifests.job_ks_user" -}} -{{- $envAll := index . "envAll" -}} -{{- $serviceName := index . "serviceName" -}} -{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} -{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} -{{- $serviceUser := index . "serviceUser" | default $serviceName -}} -{{- $serviceUserPretty := $serviceUser | replace "_" "-" -}} - -{{- $serviceAccountName := printf "%s-%s" $serviceUserPretty "ks-user" }} -{{ tuple $envAll "ks_user" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ printf "%s-%s" $serviceUserPretty "ks-user" | quote }} -spec: - template: - metadata: - labels: -{{ tuple $envAll $serviceName "ks-user" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName | quote }} - restartPolicy: OnFailure - nodeSelector: -{{ toYaml $nodeSelector | indent 8 }} - initContainers: -{{ tuple $envAll "ks_user" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: ks-user - image: {{ $envAll.Values.images.tags.ks_user }} - imagePullPolicy: {{ $envAll.Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | 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" $envAll.Values.secrets.identity.admin }} -{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }} -{{- end }} - - name: SERVICE_OS_SERVICE_NAME - value: {{ $serviceName | quote }} -{{- with $env := dict "ksUserSecret" (index $envAll.Values.secrets.identity $serviceUser ) }} -{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 12 }} -{{- end }} - - name: SERVICE_OS_ROLES - {{- $serviceOsRoles := index $envAll.Values.endpoints.identity.auth $serviceUser "role" }} - {{- if kindIs "slice" $serviceOsRoles }} - value: {{ include "helm-toolkit.utils.joinListWithComma" $serviceOsRoles | quote }} - {{- else }} - value: {{ $serviceOsRoles | quote }} - {{- end }} - volumes: - - name: ks-user-sh - configMap: - name: {{ $configMapBin | quote }} - defaultMode: 0555 -{{- end -}} diff --git a/helm-toolkit/templates/manifests/_job-rabbit-init.yaml.tpl b/helm-toolkit/templates/manifests/_job-rabbit-init.yaml.tpl deleted file mode 100644 index 53365289ab..0000000000 --- a/helm-toolkit/templates/manifests/_job-rabbit-init.yaml.tpl +++ /dev/null @@ -1,73 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.manifests.job_rabbit_init" -}} -{{- $envAll := index . "envAll" -}} -{{- $serviceName := index . "serviceName" -}} -{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} -{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} -{{- $serviceUser := index . "serviceUser" | default $serviceName -}} -{{- $serviceUserPretty := $serviceUser | replace "_" "-" -}} - -{{- $serviceAccountName := printf "%s-%s" $serviceUserPretty "rabbit-init" }} -{{ tuple $envAll "rabbit_init" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ printf "%s-%s" $serviceUserPretty "rabbit-init" | quote }} -spec: - template: - metadata: - labels: -{{ tuple $envAll $serviceName "rabbit-init" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName | quote }} - restartPolicy: OnFailure - nodeSelector: -{{ toYaml $nodeSelector | indent 8 }} - initContainers: -{{ tuple $envAll "rabbit_init" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: rabbit-init - image: {{ $envAll.Values.images.tags.rabbit_init | quote }} - imagePullPolicy: {{ $envAll.Values.images.pull_policy | quote }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.rabbit_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - command: - - /tmp/rabbit-init.sh - volumeMounts: - - name: rabbit-init-sh - mountPath: /tmp/rabbit-init.sh - subPath: rabbit-init.sh - readOnly: true - env: - - name: RABBITMQ_ADMIN_CONNECTION - valueFrom: - secretKeyRef: - name: {{ $envAll.Values.secrets.oslo_messaging.admin }} - key: RABBITMQ_CONNECTION - - name: RABBITMQ_USER_CONNECTION - valueFrom: - secretKeyRef: - name: {{ index $envAll.Values.secrets.oslo_messaging $serviceName }} - key: RABBITMQ_CONNECTION - volumes: - - name: rabbit-init-sh - configMap: - name: {{ $configMapBin | quote }} - defaultMode: 0555 - -{{- end -}} diff --git a/helm-toolkit/templates/manifests/_job_image_repo_sync.yaml.tpl b/helm-toolkit/templates/manifests/_job_image_repo_sync.yaml.tpl deleted file mode 100644 index 514fa59dd4..0000000000 --- a/helm-toolkit/templates/manifests/_job_image_repo_sync.yaml.tpl +++ /dev/null @@ -1,83 +0,0 @@ -{{/* -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 the image repo sync jobs. -# It can be used in charts dict created similar to the following: -# {- $imageRepoSyncJob := dict "envAll" . "serviceName" "prometheus" -} -# { $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" } - -{{- define "helm-toolkit.manifests.job_image_repo_sync" -}} -{{- $envAll := index . "envAll" -}} -{{- $serviceName := index . "serviceName" -}} -{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} -{{- $podVolMounts := index . "podVolMounts" | default false -}} -{{- $podVols := index . "podVols" | default false -}} -{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} - -{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} - -{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "image-repo-sync" }} -{{ tuple $envAll "image_repo_sync" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ printf "%s-%s" $serviceNamePretty "image-repo-sync" | quote }} -spec: - template: - metadata: - labels: -{{ tuple $envAll $serviceName "image-repo-sync" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: -{{ toYaml $nodeSelector | indent 8 }} - initContainers: -{{ tuple $envAll "image_repo_sync" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: image-repo-sync -{{ tuple $envAll "image_repo_sync" | include "helm-toolkit.snippets.image" | indent 10 }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.image_repo_sync | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: LOCAL_REPO - value: "{{ tuple "local_image_registry" "node" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}:{{ tuple "local_image_registry" "node" "registry" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }}" - - name: IMAGE_SYNC_LIST - value: "{{ include "helm-toolkit.utils.image_sync_list" $envAll }}" - command: - - /tmp/image-repo-sync.sh - volumeMounts: - - name: bootstrap-sh - mountPath: /tmp/image-repo-sync.sh - subPath: image-repo-sync.sh - readOnly: true - - name: docker-socket - mountPath: /var/run/docker.sock -{{- if $podVolMounts }} -{{ $podVolMounts | toYaml | indent 12 }} -{{- end }} - volumes: - - name: bootstrap-sh - configMap: - name: {{ $configMapBin | quote }} - defaultMode: 0555 - - name: docker-socket - hostPath: - path: /var/run/docker.sock -{{- if $podVols }} -{{ $podVols | toYaml | indent 8 }} -{{- end }} -{{- end }} diff --git a/helm-toolkit/templates/manifests/_service-ingress.tpl b/helm-toolkit/templates/manifests/_service-ingress.tpl deleted file mode 100644 index 859b4b1161..0000000000 --- a/helm-toolkit/templates/manifests/_service-ingress.tpl +++ /dev/null @@ -1,43 +0,0 @@ -{{/* -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 }} diff --git a/helm-toolkit/templates/scripts/_db-drop.py.tpl b/helm-toolkit/templates/scripts/_db-drop.py.tpl deleted file mode 100644 index 2f661bccf0..0000000000 --- a/helm-toolkit/templates/scripts/_db-drop.py.tpl +++ /dev/null @@ -1,132 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.scripts.db_drop" }} -#!/usr/bin/env python - -# Drops db and user for an OpenStack Service: -# Set ROOT_DB_CONNECTION and DB_CONNECTION environment variables to contain -# SQLAlchemy strings for the root connection to the database and the one you -# wish the service to use. Alternatively, you can use an ini formatted config -# at the location specified by OPENSTACK_CONFIG_FILE, and extract the string -# from the key OPENSTACK_CONFIG_DB_KEY, in the section specified by -# OPENSTACK_CONFIG_DB_SECTION. - -import os -import sys -import ConfigParser -import logging -from sqlalchemy import create_engine - -# Create logger, console handler and formatter -logger = logging.getLogger('OpenStack-Helm DB Drop') -logger.setLevel(logging.DEBUG) -ch = logging.StreamHandler() -ch.setLevel(logging.DEBUG) -formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') - -# Set the formatter and add the handler -ch.setFormatter(formatter) -logger.addHandler(ch) - - -# Get the connection string for the service db root user -if "ROOT_DB_CONNECTION" in os.environ: - db_connection = os.environ['ROOT_DB_CONNECTION'] - logger.info('Got DB root connection') -else: - logger.critical('environment variable ROOT_DB_CONNECTION not set') - sys.exit(1) - -# Get the connection string for the service db -if "OPENSTACK_CONFIG_FILE" in os.environ: - os_conf = os.environ['OPENSTACK_CONFIG_FILE'] - if "OPENSTACK_CONFIG_DB_SECTION" in os.environ: - os_conf_section = os.environ['OPENSTACK_CONFIG_DB_SECTION'] - else: - logger.critical('environment variable OPENSTACK_CONFIG_DB_SECTION not set') - sys.exit(1) - if "OPENSTACK_CONFIG_DB_KEY" in os.environ: - os_conf_key = os.environ['OPENSTACK_CONFIG_DB_KEY'] - else: - logger.critical('environment variable OPENSTACK_CONFIG_DB_KEY not set') - sys.exit(1) - try: - config = ConfigParser.RawConfigParser() - logger.info("Using {0} as db config source".format(os_conf)) - config.read(os_conf) - logger.info("Trying to load db config from {0}:{1}".format( - os_conf_section, os_conf_key)) - user_db_conn = config.get(os_conf_section, os_conf_key) - logger.info("Got config from {0}".format(os_conf)) - except: - logger.critical("Tried to load config from {0} but failed.".format(os_conf)) - raise -elif "DB_CONNECTION" in os.environ: - user_db_conn = os.environ['DB_CONNECTION'] - logger.info('Got config from DB_CONNECTION env var') -else: - logger.critical('Could not get db config, either from config file or env var') - sys.exit(1) - -# Root DB engine -try: - root_engine_full = create_engine(db_connection) - root_user = root_engine_full.url.username - root_password = root_engine_full.url.password - drivername = root_engine_full.url.drivername - host = root_engine_full.url.host - port = root_engine_full.url.port - root_engine_url = ''.join([drivername, '://', root_user, ':', root_password, '@', host, ':', str (port)]) - root_engine = create_engine(root_engine_url) - connection = root_engine.connect() - connection.close() - logger.info("Tested connection to DB @ {0}:{1} as {2}".format( - host, port, root_user)) -except: - logger.critical('Could not connect to database as root user') - raise - -# User DB engine -try: - user_engine = create_engine(user_db_conn) - # Get our user data out of the user_engine - database = user_engine.url.database - user = user_engine.url.username - password = user_engine.url.password - logger.info('Got user db config') -except: - logger.critical('Could not get user database config') - raise - -# Delete DB -try: - root_engine.execute("DROP DATABASE IF EXISTS {0}".format(database)) - logger.info("Deleted database {0}".format(database)) -except: - logger.critical("Could not drop database {0}".format(database)) - raise - -# Delete DB User -try: - root_engine.execute("DROP USER IF EXISTS {0}".format(user)) - logger.info("Deleted user {0}".format(user)) -except: - logger.critical("Could not delete user {0}".format(user)) - raise - -logger.info('Finished DB Management') -{{- end }} diff --git a/helm-toolkit/templates/scripts/_db-init.py.tpl b/helm-toolkit/templates/scripts/_db-init.py.tpl deleted file mode 100644 index c3a1b6dff1..0000000000 --- a/helm-toolkit/templates/scripts/_db-init.py.tpl +++ /dev/null @@ -1,144 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.scripts.db_init" }} -#!/usr/bin/env python - -# Creates db and user for an OpenStack Service: -# Set ROOT_DB_CONNECTION and DB_CONNECTION environment variables to contain -# SQLAlchemy strings for the root connection to the database and the one you -# wish the service to use. Alternatively, you can use an ini formatted config -# at the location specified by OPENSTACK_CONFIG_FILE, and extract the string -# from the key OPENSTACK_CONFIG_DB_KEY, in the section specified by -# OPENSTACK_CONFIG_DB_SECTION. - -import os -import sys -import ConfigParser -import logging -from sqlalchemy import create_engine - -# Create logger, console handler and formatter -logger = logging.getLogger('OpenStack-Helm DB Init') -logger.setLevel(logging.DEBUG) -ch = logging.StreamHandler() -ch.setLevel(logging.DEBUG) -formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') - -# Set the formatter and add the handler -ch.setFormatter(formatter) -logger.addHandler(ch) - - -# Get the connection string for the service db root user -if "ROOT_DB_CONNECTION" in os.environ: - db_connection = os.environ['ROOT_DB_CONNECTION'] - logger.info('Got DB root connection') -else: - logger.critical('environment variable ROOT_DB_CONNECTION not set') - sys.exit(1) - -# Get the connection string for the service db -if "OPENSTACK_CONFIG_FILE" in os.environ: - os_conf = os.environ['OPENSTACK_CONFIG_FILE'] - if "OPENSTACK_CONFIG_DB_SECTION" in os.environ: - os_conf_section = os.environ['OPENSTACK_CONFIG_DB_SECTION'] - else: - logger.critical('environment variable OPENSTACK_CONFIG_DB_SECTION not set') - sys.exit(1) - if "OPENSTACK_CONFIG_DB_KEY" in os.environ: - os_conf_key = os.environ['OPENSTACK_CONFIG_DB_KEY'] - else: - logger.critical('environment variable OPENSTACK_CONFIG_DB_KEY not set') - sys.exit(1) - try: - config = ConfigParser.RawConfigParser() - logger.info("Using {0} as db config source".format(os_conf)) - config.read(os_conf) - logger.info("Trying to load db config from {0}:{1}".format( - os_conf_section, os_conf_key)) - user_db_conn = config.get(os_conf_section, os_conf_key) - logger.info("Got config from {0}".format(os_conf)) - except: - logger.critical("Tried to load config from {0} but failed.".format(os_conf)) - raise -elif "DB_CONNECTION" in os.environ: - user_db_conn = os.environ['DB_CONNECTION'] - logger.info('Got config from DB_CONNECTION env var') -else: - logger.critical('Could not get db config, either from config file or env var') - sys.exit(1) - -# Root DB engine -try: - root_engine_full = create_engine(db_connection) - root_user = root_engine_full.url.username - root_password = root_engine_full.url.password - drivername = root_engine_full.url.drivername - host = root_engine_full.url.host - port = root_engine_full.url.port - root_engine_url = ''.join([drivername, '://', root_user, ':', root_password, '@', host, ':', str (port)]) - root_engine = create_engine(root_engine_url) - connection = root_engine.connect() - connection.close() - logger.info("Tested connection to DB @ {0}:{1} as {2}".format( - host, port, root_user)) -except: - logger.critical('Could not connect to database as root user') - raise - -# User DB engine -try: - user_engine = create_engine(user_db_conn) - # Get our user data out of the user_engine - database = user_engine.url.database - user = user_engine.url.username - password = user_engine.url.password - logger.info('Got user db config') -except: - logger.critical('Could not get user database config') - raise - -# Create DB -try: - root_engine.execute("CREATE DATABASE IF NOT EXISTS {0}".format(database)) - logger.info("Created database {0}".format(database)) -except: - logger.critical("Could not create database {0}".format(database)) - raise - -# Create DB User -try: - root_engine.execute( - "GRANT ALL ON `{0}`.* TO \'{1}\'@\'%%\' IDENTIFIED BY \'{2}\'".format( - database, user, password)) - logger.info("Created user {0} for {1}".format(user, database)) -except: - logger.critical("Could not create user {0} for {1}".format(user, database)) - raise - -# Test connection -try: - connection = user_engine.connect() - connection.close() - logger.info("Tested connection to DB @ {0}:{1}/{2} as {3}".format( - host, port, database, user)) -except: - logger.critical('Could not connect to database as user') - raise - -logger.info('Finished DB Management') -{{- end }} diff --git a/helm-toolkit/templates/scripts/_image-repo-sync.sh.tpl b/helm-toolkit/templates/scripts/_image-repo-sync.sh.tpl deleted file mode 100644 index a9c2b1e456..0000000000 --- a/helm-toolkit/templates/scripts/_image-repo-sync.sh.tpl +++ /dev/null @@ -1,26 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.scripts.image_repo_sync" }} -#!/bin/sh -set -ex - -IFS=','; for IMAGE in ${IMAGE_SYNC_LIST}; do - docker pull ${IMAGE} - docker tag ${IMAGE} ${LOCAL_REPO}/${IMAGE} - docker push ${LOCAL_REPO}/${IMAGE} -done -{{- end }} diff --git a/helm-toolkit/templates/scripts/_ks-domain-user.sh.tpl b/helm-toolkit/templates/scripts/_ks-domain-user.sh.tpl deleted file mode 100644 index e80c0f6963..0000000000 --- a/helm-toolkit/templates/scripts/_ks-domain-user.sh.tpl +++ /dev/null @@ -1,74 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.scripts.keystone_domain_user" }} -#!/bin/bash - -# Copyright 2017 Pete Birley -# -# 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 - -# Manage domain -SERVICE_OS_DOMAIN_ID=$(openstack domain create --or-show --enable -f value -c id \ - --description="Service Domain for ${SERVICE_OS_REGION_NAME}/${SERVICE_OS_DOMAIN_NAME}" \ - "${SERVICE_OS_DOMAIN_NAME}") - -# Display domain -openstack domain show "${SERVICE_OS_DOMAIN_ID}" - -# Manage user -SERVICE_OS_USERID=$(openstack user create --or-show --enable -f value -c id \ - --domain="${SERVICE_OS_DOMAIN_ID}" \ - --description "Service User for ${SERVICE_OS_REGION_NAME}/${SERVICE_OS_DOMAIN_NAME}" \ - --password="${SERVICE_OS_PASSWORD}" \ - "${SERVICE_OS_USERNAME}") - -# Manage user password (we do this to ensure the password is updated if required) -openstack user set --password="${SERVICE_OS_PASSWORD}" "${SERVICE_OS_USERID}" - -# Display user -openstack user show "${SERVICE_OS_USERID}" - -# Manage role -SERVICE_OS_ROLE_ID=$(openstack role show -f value -c id \ - "${SERVICE_OS_ROLE}" || openstack role create -f value -c id \ - "${SERVICE_OS_ROLE}" ) - -# Manage user role assignment -openstack role add \ - --domain="${SERVICE_OS_DOMAIN_ID}" \ - --user="${SERVICE_OS_USERID}" \ - --user-domain="${SERVICE_OS_DOMAIN_ID}" \ - "${SERVICE_OS_ROLE_ID}" - -# Display user role assignment -openstack role assignment list \ - --role="${SERVICE_OS_ROLE_ID}" \ - --user-domain="${SERVICE_OS_DOMAIN_ID}" \ - --user="${SERVICE_OS_USERID}" -{{- end }} diff --git a/helm-toolkit/templates/scripts/_ks-endpoints.sh.tpl b/helm-toolkit/templates/scripts/_ks-endpoints.sh.tpl deleted file mode 100755 index b1609456fb..0000000000 --- a/helm-toolkit/templates/scripts/_ks-endpoints.sh.tpl +++ /dev/null @@ -1,81 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.scripts.keystone_endpoints" }} -#!/bin/bash - -# Copyright 2017 Pete Birley -# -# 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 - -# Get Service ID -OS_SERVICE_ID=$( openstack service list -f csv --quote none | \ - grep ",${OS_SERVICE_NAME},${OS_SERVICE_TYPE}$" | \ - sed -e "s/,${OS_SERVICE_NAME},${OS_SERVICE_TYPE}//g" ) - -# Get Endpoint ID if it exists -OS_ENDPOINT_ID=$( openstack endpoint list -f csv --quote none | \ - grep "^[a-z0-9]*,${OS_REGION_NAME},${OS_SERVICE_NAME},${OS_SERVICE_TYPE},True,${OS_SVC_ENDPOINT}," | \ - awk -F ',' '{ print $1 }' ) - -# Making sure only a single endpoint exists for a service within a region -if [ "$(echo $OS_ENDPOINT_ID | wc -w)" -gt "1" ]; then - echo "More than one endpoint found, cleaning up" - for ENDPOINT_ID in $OS_ENDPOINT_ID; do - openstack endpoint delete ${ENDPOINT_ID} - done - unset OS_ENDPOINT_ID -fi - -# Determine if Endpoint needs updated -if [[ ${OS_ENDPOINT_ID} ]]; then - OS_ENDPOINT_URL_CURRENT=$(openstack endpoint show ${OS_ENDPOINT_ID} -f value -c url) - if [ "${OS_ENDPOINT_URL_CURRENT}" == "${OS_SERVICE_ENDPOINT}" ]; then - echo "Endpoints Match: no action required" - OS_ENDPOINT_UPDATE="False" - else - echo "Endpoints Dont Match: removing existing entries" - openstack endpoint delete ${OS_ENDPOINT_ID} - OS_ENDPOINT_UPDATE="True" - fi -else - OS_ENDPOINT_UPDATE="True" -fi - -# Update Endpoint if required -if [[ "${OS_ENDPOINT_UPDATE}" == "True" ]]; then - OS_ENDPOINT_ID=$( openstack endpoint create -f value -c id \ - --region="${OS_REGION_NAME}" \ - "${OS_SERVICE_ID}" \ - ${OS_SVC_ENDPOINT} \ - "${OS_SERVICE_ENDPOINT}" ) -fi - -# Display the Endpoint -openstack endpoint show ${OS_ENDPOINT_ID} -{{- end }} diff --git a/helm-toolkit/templates/scripts/_ks-service.sh.tpl b/helm-toolkit/templates/scripts/_ks-service.sh.tpl deleted file mode 100644 index ef122be17d..0000000000 --- a/helm-toolkit/templates/scripts/_ks-service.sh.tpl +++ /dev/null @@ -1,53 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.scripts.keystone_service" }} -#!/bin/bash - -# Copyright 2017 Pete Birley -# -# 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 - -# Service boilerplate description -OS_SERVICE_DESC="${OS_REGION_NAME}: ${OS_SERVICE_NAME} (${OS_SERVICE_TYPE}) service" - -# Get Service ID if it exists -unset OS_SERVICE_ID -OS_SERVICE_ID=$( openstack service list -f csv --quote none | \ - grep ",${OS_SERVICE_NAME},${OS_SERVICE_TYPE}$" | \ - sed -e "s/,${OS_SERVICE_NAME},${OS_SERVICE_TYPE}//g" ) - -# If a Service ID was not found, then create the service -if [[ -z ${OS_SERVICE_ID} ]]; then - OS_SERVICE_ID=$(openstack service create -f value -c id \ - --name="${OS_SERVICE_NAME}" \ - --description "${OS_SERVICE_DESC}" \ - --enable \ - "${OS_SERVICE_TYPE}") -fi -{{- end }} diff --git a/helm-toolkit/templates/scripts/_ks-user.sh.tpl b/helm-toolkit/templates/scripts/_ks-user.sh.tpl deleted file mode 100644 index 72b81fc716..0000000000 --- a/helm-toolkit/templates/scripts/_ks-user.sh.tpl +++ /dev/null @@ -1,109 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.scripts.keystone_user" }} -#!/bin/bash - -# Copyright 2017 Pete Birley -# -# 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 - -# Manage project domain -PROJECT_DOMAIN_ID=$(openstack domain create --or-show --enable -f value -c id \ - --description="Domain for ${SERVICE_OS_REGION_NAME}/${SERVICE_OS_PROJECT_DOMAIN_NAME}" \ - "${SERVICE_OS_PROJECT_DOMAIN_NAME}") - -# Display project domain -openstack domain show "${PROJECT_DOMAIN_ID}" - -# Manage user project -USER_PROJECT_DESC="Service Project for ${SERVICE_OS_REGION_NAME}/${SERVICE_OS_PROJECT_DOMAIN_NAME}" -USER_PROJECT_ID=$(openstack project create --or-show --enable -f value -c id \ - --domain="${PROJECT_DOMAIN_ID}" \ - --description="${USER_PROJECT_DESC}" \ - "${SERVICE_OS_PROJECT_NAME}"); - -# Display project -openstack project show "${USER_PROJECT_ID}" - -# Manage user domain -USER_DOMAIN_ID=$(openstack domain create --or-show --enable -f value -c id \ - --description="Domain for ${SERVICE_OS_REGION_NAME}/${SERVICE_OS_USER_DOMAIN_NAME}" \ - "${SERVICE_OS_USER_DOMAIN_NAME}") - -# Display user domain -openstack domain show "${USER_DOMAIN_ID}" - -# Manage user -USER_DESC="Service User for ${SERVICE_OS_REGION_NAME}/${SERVICE_OS_USER_DOMAIN_NAME}/${SERVICE_OS_SERVICE_NAME}" -USER_ID=$(openstack user create --or-show --enable -f value -c id \ - --domain="${USER_DOMAIN_ID}" \ - --project-domain="${PROJECT_DOMAIN_ID}" \ - --project="${USER_PROJECT_ID}" \ - --description="${USER_DESC}" \ - --password="${SERVICE_OS_PASSWORD}" \ - "${SERVICE_OS_USERNAME}"); - -# Manage user password (we do this to ensure the password is updated if required) -openstack user set --password="${SERVICE_OS_PASSWORD}" "${USER_ID}" - -# Display user -openstack user show "${USER_ID}" - -function ks_assign_user_role () { - # Get user role - USER_ROLE_ID=$(openstack role create --or-show -f value -c id \ - "${SERVICE_OS_ROLE}"); - - # Manage user role assignment - openstack role add \ - --user="${USER_ID}" \ - --user-domain="${USER_DOMAIN_ID}" \ - --project-domain="${PROJECT_DOMAIN_ID}" \ - --project="${USER_PROJECT_ID}" \ - "${USER_ROLE_ID}" - - # Display user role assignment - openstack role assignment list \ - --role="${USER_ROLE_ID}" \ - --user-domain="${USER_DOMAIN_ID}" \ - --user="${USER_ID}" -} - -# Manage user service role -IFS=',' -for SERVICE_OS_ROLE in ${SERVICE_OS_ROLES}; do - ks_assign_user_role -done - -# Manage user member role -: ${MEMBER_OS_ROLE:="_member_"} -export USER_ROLE_ID=$(openstack role create --or-show -f value -c id \ - "${MEMBER_OS_ROLE}"); -ks_assign_user_role -{{- end }} diff --git a/helm-toolkit/templates/scripts/_rabbit-init.sh.tpl b/helm-toolkit/templates/scripts/_rabbit-init.sh.tpl deleted file mode 100644 index e54442df71..0000000000 --- a/helm-toolkit/templates/scripts/_rabbit-init.sh.tpl +++ /dev/null @@ -1,78 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.scripts.rabbit_init" }} -#!/bin/bash -set -e -# Extract connection details -RABBIT_HOSTNAME=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \ - awk -F'[@]' '{print $2}' | \ - awk -F'[:/]' '{print $1}') -RABBIT_PORT=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \ - awk -F'[@]' '{print $2}' | \ - awk -F'[:/]' '{print $2}') - -# Extract Admin User creadential -RABBITMQ_ADMIN_USERNAME=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \ - awk -F'[@]' '{print $1}' | \ - awk -F'[//:]' '{print $4}') -RABBITMQ_ADMIN_PASSWORD=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \ - awk -F'[@]' '{print $1}' | \ - awk -F'[//:]' '{print $5}') - -# Extract User creadential -RABBITMQ_USERNAME=$(echo "${RABBITMQ_USER_CONNECTION}" | \ - awk -F'[@]' '{print $1}' | \ - awk -F'[//:]' '{print $4}') -RABBITMQ_PASSWORD=$(echo "${RABBITMQ_USER_CONNECTION}" | \ - awk -F'[@]' '{print $1}' | \ - awk -F'[//:]' '{print $5}') - -# Extract User vHost -RABBITMQ_VHOST=$(echo "${RABBITMQ_USER_CONNECTION}" | \ - awk -F'[@]' '{print $2}' | \ - awk -F'[:/]' '{print $3}') - -function rabbitmqadmin_cli () { - rabbitmqadmin \ - --host="${RABBIT_HOSTNAME}" \ - --port="${RABBIT_PORT}" \ - --username="${RABBITMQ_ADMIN_USERNAME}" \ - --password="${RABBITMQ_ADMIN_PASSWORD}" \ - ${@} -} - -echo "Managing: User: ${RABBITMQ_USERNAME}" -rabbitmqadmin_cli \ - declare user \ - name="${RABBITMQ_USERNAME}" \ - password="${RABBITMQ_PASSWORD}" \ - tags="user" - -echo "Managing: vHost: ${RABBITMQ_VHOST}" -rabbitmqadmin_cli \ - declare vhost \ - name="${RABBITMQ_VHOST}" - -echo "Managing: Permissions: ${RABBITMQ_USERNAME} on ${RABBITMQ_VHOST}" -rabbitmqadmin_cli \ - declare permission \ - vhost="${RABBITMQ_VHOST}" \ - user="${RABBITMQ_USERNAME}" \ - configure=".*" \ - write=".*" \ - read=".*" -{{- end }} diff --git a/helm-toolkit/templates/scripts/_rally_test.sh.tpl b/helm-toolkit/templates/scripts/_rally_test.sh.tpl deleted file mode 100644 index 76e6bb3c4c..0000000000 --- a/helm-toolkit/templates/scripts/_rally_test.sh.tpl +++ /dev/null @@ -1,63 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.scripts.rally_test" -}} -#!/bin/bash -set -ex -{{- $rallyTests := index . 0 }} - -: "${RALLY_ENV_NAME:="openstack-helm"}" - -rally-manage db create -cat > /tmp/rally-config.json << EOF -{ - "type": "ExistingCloud", - "auth_url": "${OS_AUTH_URL}", - "region_name": "${OS_REGION_NAME}", - "endpoint_type": "public", - "admin": { - "username": "${OS_USERNAME}", - "password": "${OS_PASSWORD}", - "project_name": "${OS_PROJECT_NAME}", - "user_domain_name": "${OS_USER_DOMAIN_NAME}", - "project_domain_name": "${OS_PROJECT_DOMAIN_NAME}" - }, - "users": [ - { - "username": "${SERVICE_OS_USERNAME}", - "password": "${SERVICE_OS_PASSWORD}", - "project_name": "${SERVICE_OS_PROJECT_NAME}", - "user_domain_name": "${SERVICE_OS_USER_DOMAIN_NAME}", - "project_domain_name": "${SERVICE_OS_PROJECT_DOMAIN_NAME}" - } - ] -} -EOF -rally deployment create --file /tmp/rally-config.json --name "${RALLY_ENV_NAME}" -rm -f /tmp/rally-config.json -rally deployment use "${RALLY_ENV_NAME}" -rally deployment check -{{- if $rallyTests.run_tempest }} -rally verify create-verifier --name "${RALLY_ENV_NAME}-tempest" --type tempest -SERVICE_TYPE="$(rally deployment check | grep "${RALLY_ENV_NAME}" | awk -F \| '{print $3}' | tr -d ' ' | tr -d '\n')" -rally verify start --pattern "tempest.api.${SERVICE_TYPE}*" -rally verify delete-verifier --id "${RALLY_ENV_NAME}-tempest" --force -{{- end }} -rally task validate /etc/rally/rally_tests.yaml -rally task start /etc/rally/rally_tests.yaml -rally deployment destroy --deployment "${RALLY_ENV_NAME}" -rally task sla-check -{{- end }} diff --git a/helm-toolkit/templates/snippets/_image.tpl b/helm-toolkit/templates/snippets/_image.tpl deleted file mode 100644 index d2d8e47eb6..0000000000 --- a/helm-toolkit/templates/snippets/_image.tpl +++ /dev/null @@ -1,28 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.image" -}} -{{- $envAll := index . 0 -}} -{{- $image := index . 1 -}} -{{- $imageTag := index $envAll.Values.images.tags $image -}} -{{- if and ($envAll.Values.images.local_registry.active) (not (has $image $envAll.Values.images.local_registry.exclude )) -}} -{{- $registryPrefix := printf "%s:%s" (tuple "local_image_registry" "node" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup") (tuple "local_image_registry" "node" "registry" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup") -}} -image: {{ printf "%s/%s" $registryPrefix $imageTag | quote }} -{{- else -}} -image: {{ $imageTag | quote }} -{{- end }} -imagePullPolicy: {{ $envAll.Values.images.pull_policy }} -{{- end -}} diff --git a/helm-toolkit/templates/snippets/_keystone_openrc_env_vars.tpl b/helm-toolkit/templates/snippets/_keystone_openrc_env_vars.tpl deleted file mode 100644 index dfded64339..0000000000 --- a/helm-toolkit/templates/snippets/_keystone_openrc_env_vars.tpl +++ /dev/null @@ -1,56 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.keystone_openrc_env_vars" }} -{{- $ksUserSecret := .ksUserSecret }} -- name: OS_IDENTITY_API_VERSION - value: "3" -- name: OS_AUTH_URL - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_AUTH_URL -- name: OS_REGION_NAME - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_REGION_NAME -- name: OS_PROJECT_DOMAIN_NAME - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_PROJECT_DOMAIN_NAME -- name: OS_PROJECT_NAME - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_PROJECT_NAME -- name: OS_USER_DOMAIN_NAME - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_USER_DOMAIN_NAME -- name: OS_USERNAME - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_USERNAME -- name: OS_PASSWORD - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_PASSWORD -{{- end }} diff --git a/helm-toolkit/templates/snippets/_keystone_secret_openrc.tpl b/helm-toolkit/templates/snippets/_keystone_secret_openrc.tpl deleted file mode 100644 index 66568f213f..0000000000 --- a/helm-toolkit/templates/snippets/_keystone_secret_openrc.tpl +++ /dev/null @@ -1,29 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.keystone_secret_openrc" }} -{{- $userClass := index . 0 -}} -{{- $identityEndpoint := index . 1 -}} -{{- $context := index . 2 -}} -{{- $userContext := index $context.Values.endpoints.identity.auth $userClass }} -OS_AUTH_URL: {{ tuple "identity" $identityEndpoint "api" $context | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | b64enc }} -OS_REGION_NAME: {{ $userContext.region_name | b64enc }} -OS_PROJECT_DOMAIN_NAME: {{ $userContext.project_domain_name | b64enc }} -OS_PROJECT_NAME: {{ $userContext.project_name | b64enc }} -OS_USER_DOMAIN_NAME: {{ $userContext.user_domain_name | b64enc }} -OS_USERNAME: {{ $userContext.username | b64enc }} -OS_PASSWORD: {{ $userContext.password | b64enc }} -{{- end }} diff --git a/helm-toolkit/templates/snippets/_keystone_user_create_env_vars.tpl b/helm-toolkit/templates/snippets/_keystone_user_create_env_vars.tpl deleted file mode 100644 index dd16e68c37..0000000000 --- a/helm-toolkit/templates/snippets/_keystone_user_create_env_vars.tpl +++ /dev/null @@ -1,49 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.keystone_user_create_env_vars" }} -{{- $ksUserSecret := .ksUserSecret }} -- name: SERVICE_OS_REGION_NAME - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_REGION_NAME -- name: SERVICE_OS_PROJECT_DOMAIN_NAME - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_PROJECT_DOMAIN_NAME -- name: SERVICE_OS_PROJECT_NAME - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_PROJECT_NAME -- name: SERVICE_OS_USER_DOMAIN_NAME - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_USER_DOMAIN_NAME -- name: SERVICE_OS_USERNAME - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_USERNAME -- name: SERVICE_OS_PASSWORD - valueFrom: - secretKeyRef: - name: {{ $ksUserSecret }} - key: OS_PASSWORD -{{- end }} diff --git a/helm-toolkit/templates/snippets/_kubernetes_entrypoint_init_container.tpl b/helm-toolkit/templates/snippets/_kubernetes_entrypoint_init_container.tpl deleted file mode 100644 index 79dd63a544..0000000000 --- a/helm-toolkit/templates/snippets/_kubernetes_entrypoint_init_container.tpl +++ /dev/null @@ -1,79 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.kubernetes_entrypoint_init_container" -}} -{{- $envAll := index . 0 -}} -{{- $component := index . 1 -}} -{{- $mounts := index . 2 -}} - -{{- $_ := set $envAll.Values "__kubernetes_entrypoint_init_container" dict -}} -{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" dict -}} -{{- if and ($envAll.Values.images.local_registry.active) (ne $component "image_repo_sync") -}} -{{- if eq $component "pod_dependency" -}} -{{- $_ := include "helm-toolkit.utils.merge" ( tuple $envAll.Values.__kubernetes_entrypoint_init_container.deps ( index $envAll.Values.pod_dependency ) $envAll.Values.dependencies.dynamic.common.local_image_registry ) -}} -{{- else -}} -{{- $_ := include "helm-toolkit.utils.merge" ( tuple $envAll.Values.__kubernetes_entrypoint_init_container.deps ( index $envAll.Values.dependencies.static $component ) $envAll.Values.dependencies.dynamic.common.local_image_registry ) -}} -{{- end -}} -{{- else -}} -{{- if eq $component "pod_dependency" -}} -{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.pod_dependency ) -}} -{{- else -}} -{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.dependencies.static $component ) -}} -{{- end -}} -{{- end -}} -{{- $deps := $envAll.Values.__kubernetes_entrypoint_init_container.deps }} - -- name: init -{{ tuple $envAll "dep_check" | include "helm-toolkit.snippets.image" | indent 2 }} - env: - - name: POD_NAME - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - - name: INTERFACE_NAME - value: eth0 - - name: PATH - value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/ - - name: DEPENDENCY_SERVICE - value: "{{ tuple $deps.services $envAll | include "helm-toolkit.utils.comma_joined_service_list" }}" -{{- if $deps.jobs -}} - {{- if kindIs "string" (index $deps.jobs 0) }} - - name: DEPENDENCY_JOBS - value: "{{ include "helm-toolkit.utils.joinListWithComma" $deps.jobs }}" - {{- else }} - - name: DEPENDENCY_JOBS_JSON - value: {{- toJson $deps.jobs | quote -}} - {{- end -}} -{{- end }} - - name: DEPENDENCY_DAEMONSET - value: "{{ include "helm-toolkit.utils.joinListWithComma" $deps.daemonset }}" - - name: DEPENDENCY_CONTAINER - value: "{{ include "helm-toolkit.utils.joinListWithComma" $deps.container }}" - - name: DEPENDENCY_POD_JSON - value: {{ if $deps.pod }}{{ toJson $deps.pod | quote }}{{ else }}""{{ end }} - - name: COMMAND - value: "echo done" - command: - - kubernetes-entrypoint - volumeMounts: -{{ toYaml $mounts | indent 4 }} -{{- end -}} diff --git a/helm-toolkit/templates/snippets/_kubernetes_kubectl_params.tpl b/helm-toolkit/templates/snippets/_kubernetes_kubectl_params.tpl deleted file mode 100644 index 988292943f..0000000000 --- a/helm-toolkit/templates/snippets/_kubernetes_kubectl_params.tpl +++ /dev/null @@ -1,22 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.kubernetes_kubectl_params" -}} -{{- $envAll := index . 0 -}} -{{- $application := index . 1 -}} -{{- $component := index . 2 -}} -{{ print "-l application=" $application " -l component=" $component }} -{{- end -}} diff --git a/helm-toolkit/templates/snippets/_kubernetes_metadata_labels.tpl b/helm-toolkit/templates/snippets/_kubernetes_metadata_labels.tpl deleted file mode 100644 index 19d32ab4e4..0000000000 --- a/helm-toolkit/templates/snippets/_kubernetes_metadata_labels.tpl +++ /dev/null @@ -1,24 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.kubernetes_metadata_labels" -}} -{{- $envAll := index . 0 -}} -{{- $application := index . 1 -}} -{{- $component := index . 2 -}} -release_group: {{ $envAll.Values.release_group | default $envAll.Release.Name }} -application: {{ $application }} -component: {{ $component }} -{{- end -}} diff --git a/helm-toolkit/templates/snippets/_kubernetes_pod_anti_affinity.tpl b/helm-toolkit/templates/snippets/_kubernetes_pod_anti_affinity.tpl deleted file mode 100644 index 4981015ca7..0000000000 --- a/helm-toolkit/templates/snippets/_kubernetes_pod_anti_affinity.tpl +++ /dev/null @@ -1,42 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.kubernetes_pod_anti_affinity" -}} -{{- $envAll := index . 0 -}} -{{- $application := index . 1 -}} -{{- $component := index . 2 -}} -{{- $antiAffinityType := index $envAll.Values.pod.affinity.anti.type $component | default $envAll.Values.pod.affinity.anti.type.default }} -{{- $antiAffinityKey := index $envAll.Values.pod.affinity.anti.topologyKey $component | default $envAll.Values.pod.affinity.anti.topologyKey.default }} -podAntiAffinity: - {{ $antiAffinityType }}: - - podAffinityTerm: - labelSelector: - matchExpressions: - - key: release_group - operator: In - values: - - {{ $envAll.Values.release_group | default $envAll.Release.Name }} - - key: application - operator: In - values: - - {{ $application }} - - key: component - operator: In - values: - - {{ $component }} - topologyKey: {{ $antiAffinityKey }} - weight: 10 -{{- end -}} diff --git a/helm-toolkit/templates/snippets/_kubernetes_pod_rbac_roles.tpl b/helm-toolkit/templates/snippets/_kubernetes_pod_rbac_roles.tpl deleted file mode 100644 index f9f48ef7b6..0000000000 --- a/helm-toolkit/templates/snippets/_kubernetes_pod_rbac_roles.tpl +++ /dev/null @@ -1,68 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.kubernetes_pod_rbac_roles" -}} -{{- $envAll := index . 0 -}} -{{- $deps := index . 1 -}} -{{- $saName := index . 2 | replace "_" "-" }} -{{- $saNamespace := index . 3 -}} -{{- $releaseName := $envAll.Release.Name }} ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: RoleBinding -metadata: - name: {{ $releaseName }}-{{ $saName }} - namespace: {{ $saNamespace }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: {{ $releaseName }}-{{ $saNamespace }}-{{ $saName }} -subjects: - - kind: ServiceAccount - name: {{ $saName }} - namespace: {{ $saNamespace }} ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: Role -metadata: - name: {{ $releaseName }}-{{ $saNamespace }}-{{ $saName }} - namespace: {{ $saNamespace }} -rules: - - apiGroups: - - "" - - extensions - - batch - - apps - verbs: - - get - - list - resources: - {{- range $k, $v := $deps -}} - {{ if eq $v "daemonsets" }} - - daemonsets - {{- end -}} - {{ if eq $v "jobs" }} - - jobs - {{- end -}} - {{ if or (eq $v "pods") (eq $v "daemonsets") (eq $v "jobs") }} - - pods - {{- end -}} - {{ if eq $v "services" }} - - services - - endpoints - {{- end -}} - {{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/snippets/_kubernetes_pod_rbac_serviceaccount.tpl b/helm-toolkit/templates/snippets/_kubernetes_pod_rbac_serviceaccount.tpl deleted file mode 100644 index b4cf1a65b2..0000000000 --- a/helm-toolkit/templates/snippets/_kubernetes_pod_rbac_serviceaccount.tpl +++ /dev/null @@ -1,69 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" -}} -{{- $envAll := index . 0 -}} -{{- $component := index . 1 -}} -{{- $saName := index . 2 -}} -{{- $saNamespace := $envAll.Release.Namespace }} -{{- $randomKey := randAlphaNum 32 }} -{{- $allNamespace := dict $randomKey "" }} - -{{- $_ := set $envAll.Values "__kubernetes_entrypoint_init_container" dict -}} -{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" dict -}} -{{- if and ($envAll.Values.images.local_registry.active) (ne $component "image_repo_sync") -}} -{{- if eq $component "pod_dependency" -}} -{{- $_ := include "helm-toolkit.utils.merge" ( tuple $envAll.Values.__kubernetes_entrypoint_init_container.deps ( index $envAll.Values.pod_dependency ) $envAll.Values.dependencies.dynamic.common.local_image_registry ) -}} -{{- else -}} -{{- $_ := include "helm-toolkit.utils.merge" ( tuple $envAll.Values.__kubernetes_entrypoint_init_container.deps ( index $envAll.Values.dependencies.static $component ) $envAll.Values.dependencies.dynamic.common.local_image_registry ) -}} -{{- end -}} -{{- else -}} -{{- if eq $component "pod_dependency" -}} -{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.pod_dependency ) -}} -{{- else -}} -{{- $_ := set $envAll.Values.__kubernetes_entrypoint_init_container "deps" ( index $envAll.Values.dependencies.static $component ) -}} -{{- end -}} -{{- end -}} -{{- $deps := $envAll.Values.__kubernetes_entrypoint_init_container.deps }} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ $saName }} - namespace: {{ $saNamespace }} -{{- range $k, $v := $deps -}} -{{- if eq $k "services" }} -{{- range $serv := $v }} -{{- $endpointMap := index $envAll.Values.endpoints $serv.service }} -{{- $endpointNS := $endpointMap.namespace | default $saNamespace }} -{{- if not (contains "services" ((index $allNamespace $endpointNS) | default "")) }} -{{- $_ := set $allNamespace $endpointNS (printf "%s%s" "services," ((index $allNamespace $endpointNS) | default "")) }} -{{- end -}} -{{- end -}} -{{- else if and (eq $k "jobs") $v }} -{{- $_ := set $allNamespace $saNamespace (printf "%s%s" "jobs," ((index $allNamespace $saNamespace) | default "")) }} -{{- else if and (eq $k "daemonset") $v }} -{{- $_ := set $allNamespace $saNamespace (printf "%s%s" "daemonsets," ((index $allNamespace $saNamespace) | default "")) }} -{{- else if and (eq $k "pod") $v }} -{{- $_ := set $allNamespace $saNamespace (printf "%s%s" "pods," ((index $allNamespace $saNamespace) | default "")) }} -{{- end -}} -{{- end -}} -{{- $_ := unset $allNamespace $randomKey }} -{{- range $ns, $vv := $allNamespace }} -{{- $resourceList := (splitList "," (trimSuffix "," $vv)) }} -{{- tuple $envAll $resourceList $saName $ns | include "helm-toolkit.snippets.kubernetes_pod_rbac_roles" }} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/snippets/_kubernetes_resources.tpl b/helm-toolkit/templates/snippets/_kubernetes_resources.tpl deleted file mode 100644 index fe62b8dbda..0000000000 --- a/helm-toolkit/templates/snippets/_kubernetes_resources.tpl +++ /dev/null @@ -1,29 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.kubernetes_resources" -}} -{{- $envAll := index . 0 -}} -{{- $component := index . 1 -}} -{{- if $envAll.Values.pod.resources.enabled -}} -resources: - limits: - cpu: {{ $component.limits.cpu | quote }} - memory: {{ $component.limits.memory | quote }} - requests: - cpu: {{ $component.requests.cpu | quote }} - memory: {{ $component.requests.memory | quote }} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/snippets/_kubernetes_upgrades_daemonset.tpl b/helm-toolkit/templates/snippets/_kubernetes_upgrades_daemonset.tpl deleted file mode 100644 index eaef2a5585..0000000000 --- a/helm-toolkit/templates/snippets/_kubernetes_upgrades_daemonset.tpl +++ /dev/null @@ -1,35 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.kubernetes_upgrades_daemonset" -}} -{{- $envAll := index . 0 -}} -{{- $component := index . 1 -}} -{{- $upgradeMap := index $envAll.Values.pod.lifecycle.upgrades.daemonsets $component -}} -{{- $pod_replacement_strategy := $envAll.Values.pod.lifecycle.upgrades.daemonsets.pod_replacement_strategy -}} -{{- with $upgradeMap -}} -{{- if .enabled }} -minReadySeconds: {{ .min_ready_seconds }} -updateStrategy: - type: {{ $pod_replacement_strategy }} - {{- if $pod_replacement_strategy }} - {{- if eq $pod_replacement_strategy "RollingUpdate" }} - rollingUpdate: - maxUnavailable: {{ .max_unavailable }} - {{- end }} - {{- end }} -{{- end }} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/snippets/_kubernetes_upgrades_deployment.tpl b/helm-toolkit/templates/snippets/_kubernetes_upgrades_deployment.tpl deleted file mode 100644 index 3184b0d08e..0000000000 --- a/helm-toolkit/templates/snippets/_kubernetes_upgrades_deployment.tpl +++ /dev/null @@ -1,29 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.snippets.kubernetes_upgrades_deployment" -}} -{{- $envAll := index . 0 -}} -{{- with $envAll.Values.pod.lifecycle.upgrades.deployments -}} -revisionHistoryLimit: {{ .revision_history }} -strategy: - type: {{ .pod_replacement_strategy }} - {{- if eq .pod_replacement_strategy "RollingUpdate" }} - rollingUpdate: - maxUnavailable: {{ .rolling_update.max_unavailable }} - maxSurge: {{ .rolling_update.max_surge }} - {{- end }} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/snippets/_prometheus_pod_annotations.tpl b/helm-toolkit/templates/snippets/_prometheus_pod_annotations.tpl deleted file mode 100644 index 9e09326f65..0000000000 --- a/helm-toolkit/templates/snippets/_prometheus_pod_annotations.tpl +++ /dev/null @@ -1,35 +0,0 @@ -{{/* -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. -*/}} - -# Appends annotations for configuring prometheus scrape jobs via pod -# annotations. The required annotations are: -# * `prometheus.io/scrape`: Only scrape pods that have a value of `true` -# * `prometheus.io/path`: If the metrics path is not `/metrics` override this. -# * `prometheus.io/port`: Scrape the pod on the indicated port instead of the -# pod's declared ports (default is a port-free target if none are declared). - -{{- define "helm-toolkit.snippets.prometheus_pod_annotations" -}} -{{- $config := index . 0 -}} -{{- if $config.scrape }} -prometheus.io/scrape: {{ $config.scrape | quote }} -{{- end }} -{{- if $config.path }} -prometheus.io/path: {{ $config.path | quote }} -{{- end }} -{{- if $config.port }} -prometheus.io/port: {{ $config.port | quote }} -{{- end }} -{{- end -}} diff --git a/helm-toolkit/templates/snippets/_prometheus_service_annotations.tpl b/helm-toolkit/templates/snippets/_prometheus_service_annotations.tpl deleted file mode 100644 index 1255dccb9d..0000000000 --- a/helm-toolkit/templates/snippets/_prometheus_service_annotations.tpl +++ /dev/null @@ -1,37 +0,0 @@ -{{/* -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. -*/}} - -# Appends annotations for configuring prometheus scrape endpoints via -# annotations. The required annotations are: -# * `prometheus.io/scrape`: Only scrape services that have a value of `true` -# * `prometheus.io/scheme`: If the metrics endpoint is secured then you will need -# to set this to `https` & most likely set the `tls_config` of the scrape config. -# * `prometheus.io/path`: If the metrics path is not `/metrics` override this. -# * `prometheus.io/port`: If the metrics are exposed on a different port to the -# service then set this appropriately. - -{{- define "helm-toolkit.snippets.prometheus_service_annotations" -}} -{{- $config := index . 0 -}} -{{- if $config.scrape }} -prometheus.io/scrape: {{ $config.scrape | quote }} -{{- end }} -{{- if $config.scheme }} -prometheus.io/scheme: {{ $config.scheme | quote }} -{{- end }} -{{- if $config.path }} -prometheus.io/path: {{ $config.path | quote }} -{{- end }} -{{- if $config.port }} -prometheus.io/port: {{ $config.port | quote }} -{{- end }} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_comma_joined_service_list.tpl b/helm-toolkit/templates/utils/_comma_joined_service_list.tpl deleted file mode 100644 index 7f965eade7..0000000000 --- a/helm-toolkit/templates/utils/_comma_joined_service_list.tpl +++ /dev/null @@ -1,21 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.comma_joined_service_list" -}} -{{- $deps := index . 0 -}} -{{- $envAll := index . 1 -}} -{{- range $k, $v := $deps -}}{{- if $k -}},{{- end -}}{{ tuple $v.service $v.endpoint $envAll | include "helm-toolkit.endpoints.service_name_endpoint_with_namespace_lookup" }}{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_configmap_templater.tpl b/helm-toolkit/templates/utils/_configmap_templater.tpl deleted file mode 100644 index 9f168b18ea..0000000000 --- a/helm-toolkit/templates/utils/_configmap_templater.tpl +++ /dev/null @@ -1,32 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.configmap_templater" }} -{{- $keyRoot := index . 0 -}} -{{- $configTemplate := index . 1 -}} -{{- $context := index . 2 -}} -{{ if $keyRoot.override -}} -{{ $keyRoot.override | indent 4 }} -{{- else -}} -{{- if $keyRoot.prefix -}} -{{ $keyRoot.prefix | indent 4 }} -{{- end }} -{{ tuple $configTemplate $context | include "helm-toolkit.utils.template" | indent 4 }} -{{- end }} -{{- if $keyRoot.append -}} -{{ $keyRoot.append | indent 4 }} -{{- end }} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_daemonset_overrides.tpl b/helm-toolkit/templates/utils/_daemonset_overrides.tpl deleted file mode 100644 index 448b60f815..0000000000 --- a/helm-toolkit/templates/utils/_daemonset_overrides.tpl +++ /dev/null @@ -1,271 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.daemonset_overrides" }} - {{- $daemonset := index . 0 }} - {{- $daemonset_yaml := index . 1 }} - {{- $configmap_include := index . 2 }} - {{- $configmap_name := index . 3 }} - {{- $context := index . 4 }} - {{- $_ := unset $context ".Files" }} - {{- $_ := set $context.Values "__daemonset_yaml" $daemonset_yaml }} - {{- $daemonset_root_name := printf (print $context.Chart.Name "_" $daemonset) }} - {{- $_ := set $context.Values "__daemonset_list" list }} - {{- $_ := set $context.Values "__default" dict }} - {{- if hasKey $context.Values.conf "overrides" }} - {{- range $key, $val := $context.Values.conf.overrides }} - - {{- if eq $key $daemonset_root_name }} - {{- range $type, $type_data := . }} - - {{- if eq $type "hosts" }} - {{- range $host_data := . }} - {{/* dictionary that will contain all info needed to generate this - iteration of the daemonset */}} - {{- $current_dict := dict }} - - {{/* set daemonset name */}} - {{- $_ := set $current_dict "name" $host_data.name }} - - {{/* apply overrides */}} - {{- $override_conf_copy := $host_data.conf }} - {{- $root_conf_copy := omit $context.Values.conf "overrides" }} - {{- $merged_dict := merge $override_conf_copy $root_conf_copy }} - {{- $root_conf_copy2 := dict "conf" $merged_dict }} - {{- $context_values := omit $context.Values "conf" }} - {{- $root_conf_copy3 := merge $context_values $root_conf_copy2 }} - {{- $root_conf_copy4 := dict "Values" $root_conf_copy3 }} - {{- $_ := set $current_dict "nodeData" $root_conf_copy4 }} - - {{/* Schedule to this host explicitly. */}} - {{- $nodeSelector_dict := dict }} - - {{- $_ := set $nodeSelector_dict "key" "kubernetes.io/hostname" }} - {{- $_ := set $nodeSelector_dict "operator" "In" }} - - {{- $values_list := list $host_data.name }} - {{- $_ := set $nodeSelector_dict "values" $values_list }} - - {{- $list_aggregate := list $nodeSelector_dict }} - {{- $_ := set $current_dict "matchExpressions" $list_aggregate }} - - {{/* store completed daemonset entry/info into global list */}} - {{- $list_aggregate := append $context.Values.__daemonset_list $current_dict }} - {{- $_ := set $context.Values "__daemonset_list" $list_aggregate }} - - {{- end }} - {{- end }} - - {{- if eq $type "labels" }} - {{- $_ := set $context.Values "__label_list" . }} - {{- range $label_data := . }} - {{/* dictionary that will contain all info needed to generate this - iteration of the daemonset. */}} - {{- $_ := set $context.Values "__current_label" dict }} - - {{/* set daemonset name */}} - {{- $_ := set $context.Values.__current_label "name" $label_data.label.key }} - - {{/* apply overrides */}} - {{- $override_conf_copy := $label_data.conf }} - {{- $root_conf_copy := omit $context.Values.conf "overrides" }} - {{- $merged_dict := merge $override_conf_copy $root_conf_copy }} - {{- $root_conf_copy2 := dict "conf" $merged_dict }} - {{- $context_values := omit $context.Values "conf" }} - {{- $root_conf_copy3 := merge $context_values $root_conf_copy2 }} - {{- $root_conf_copy4 := dict "Values" $root_conf_copy3 }} - {{- $_ := set $context.Values.__current_label "nodeData" $root_conf_copy4 }} - - {{/* Schedule to the provided label value(s) */}} - {{- $label_dict := omit $label_data.label "NULL" }} - {{- $_ := set $label_dict "operator" "In" }} - {{- $list_aggregate := list $label_dict }} - {{- $_ := set $context.Values.__current_label "matchExpressions" $list_aggregate }} - - {{/* Do not schedule to other specified labels, with higher - precedence as the list position increases. Last defined label - is highest priority. */}} - {{- $other_labels := without $context.Values.__label_list $label_data }} - {{- range $label_data2 := $other_labels }} - {{- $label_dict := omit $label_data2.label "NULL" }} - - {{- $_ := set $label_dict "operator" "NotIn" }} - - {{- $list_aggregate := append $context.Values.__current_label.matchExpressions $label_dict }} - {{- $_ := set $context.Values.__current_label "matchExpressions" $list_aggregate }} - {{- end }} - {{- $_ := set $context.Values "__label_list" $other_labels }} - - {{/* Do not schedule to any other specified hosts */}} - {{- range $type, $type_data := $val }} - {{- if eq $type "hosts" }} - {{- range $host_data := . }} - {{- $label_dict := dict }} - - {{- $_ := set $label_dict "key" "kubernetes.io/hostname" }} - {{- $_ := set $label_dict "operator" "NotIn" }} - - {{- $values_list := list $host_data.name }} - {{- $_ := set $label_dict "values" $values_list }} - - {{- $list_aggregate := append $context.Values.__current_label.matchExpressions $label_dict }} - {{- $_ := set $context.Values.__current_label "matchExpressions" $list_aggregate }} - {{- end }} - {{- end }} - {{- end }} - - {{/* store completed daemonset entry/info into global list */}} - {{- $list_aggregate := append $context.Values.__daemonset_list $context.Values.__current_label }} - {{- $_ := set $context.Values "__daemonset_list" $list_aggregate }} - {{- $_ := unset $context.Values "__current_label" }} - - {{- end }} - {{- end }} - {{- end }} - - {{/* scheduler exceptions for the default daemonset */}} - {{- $_ := set $context.Values.__default "matchExpressions" list }} - - {{- range $type, $type_data := . }} - {{/* Do not schedule to other specified labels */}} - {{- if eq $type "labels" }} - {{- range $label_data := . }} - {{- $default_dict := omit $label_data.label "NULL" }} - - {{- $_ := set $default_dict "operator" "NotIn" }} - - {{- $list_aggregate := append $context.Values.__default.matchExpressions $default_dict }} - {{- $_ := set $context.Values.__default "matchExpressions" $list_aggregate }} - {{- end }} - {{- end }} - {{/* Do not schedule to other specified hosts */}} - {{- if eq $type "hosts" }} - {{- range $host_data := . }} - {{- $default_dict := dict }} - - {{- $_ := set $default_dict "key" "kubernetes.io/hostname" }} - {{- $_ := set $default_dict "operator" "NotIn" }} - - {{- $values_list := list $host_data.name }} - {{- $_ := set $default_dict "values" $values_list }} - - {{- $list_aggregate := append $context.Values.__default.matchExpressions $default_dict }} - {{- $_ := set $context.Values.__default "matchExpressions" $list_aggregate }} - {{- end }} - {{- end }} - {{- end }} - {{- end }} - {{- end }} - {{- end }} - - {{/* generate the default daemonset */}} - - {{/* set name */}} - {{- $_ := set $context.Values.__default "name" "default" }} - - {{/* no overrides apply, so copy as-is */}} - {{- $root_conf_copy1 := omit $context.Values.conf "overrides" }} - {{- $root_conf_copy2 := dict "conf" $root_conf_copy1 }} - {{- $context_values := omit $context.Values "conf" }} - {{- $root_conf_copy3 := merge $context_values $root_conf_copy2 }} - {{- $root_conf_copy4 := dict "Values" $root_conf_copy3 }} - {{- $_ := set $context.Values.__default "nodeData" $root_conf_copy4 }} - - {{/* add to global list */}} - {{- $list_aggregate := append $context.Values.__daemonset_list $context.Values.__default }} - {{- $_ := set $context.Values "__daemonset_list" $list_aggregate }} - - {{- $_ := set $context.Values "__last_configmap_name" $configmap_name }} - {{- range $current_dict := $context.Values.__daemonset_list }} - - {{- $context_novalues := omit $context "Values" }} - {{- $merged_dict := merge $current_dict.nodeData $context_novalues }} - {{- $_ := set $current_dict "nodeData" $merged_dict }} - - {{/* name needs to be a DNS-1123 compliant name. Ensure lower case */}} - {{- $name_format1 := printf (print $daemonset_root_name "-" $current_dict.name) | lower }} - {{/* labels may contain underscores which would be invalid here, so we replace them with dashes - there may be other valid label names which would make for an invalid DNS-1123 name - but these will be easier to handle in future with sprig regex* functions - (not availabile in helm 2.5.1) */}} - {{- $name_format2 := $name_format1 | replace "_" "-" }} - {{/* To account for the case where the same label is defined multiple times in overrides - (but with different label values), we add a sha of the scheduling data to ensure - name uniqueness */}} - {{- $_ := set $current_dict "dns_1123_name" dict }} - {{- if hasKey $current_dict "matchExpressions" }} - {{- $_ := set $current_dict "dns_1123_name" (printf (print $name_format2 "-" ($current_dict.matchExpressions | quote | sha256sum | trunc 8))) }} - {{- else }} - {{- $_ := set $current_dict "dns_1123_name" $name_format2 }} - {{- end }} - - {{/* set daemonset metadata name */}} - {{- if not $context.Values.__daemonset_yaml.metadata }}{{- $_ := set $context.Values.__daemonset_yaml "metadata" dict }}{{- end }} - {{- if not $context.Values.__daemonset_yaml.metadata.name }}{{- $_ := set $context.Values.__daemonset_yaml.metadata "name" dict }}{{- end }} - {{- $_ := set $context.Values.__daemonset_yaml.metadata "name" $current_dict.dns_1123_name }} - - {{/* set container name - assume not more than one container is defined */}} - {{- $container := first $context.Values.__daemonset_yaml.spec.template.spec.containers }} - {{- $_ := set $container "name" $current_dict.dns_1123_name }} - {{- $cont_list := list $container }} - {{- $_ := set $context.Values.__daemonset_yaml.spec.template.spec "containers" $cont_list }} - - {{/* cross-reference configmap name to container volume definitions */}} - {{- $_ := set $context.Values "__volume_list" list }} - {{- range $current_volume := $context.Values.__daemonset_yaml.spec.template.spec.volumes }} - {{- $_ := set $context.Values "__volume" $current_volume }} - {{- if hasKey $context.Values.__volume "configMap" }} - {{- if eq $context.Values.__volume.configMap.name $context.Values.__last_configmap_name }} - {{- $_ := set $context.Values.__volume.configMap "name" $current_dict.dns_1123_name }} - {{- end }} - {{- end }} - {{- $updated_list := append $context.Values.__volume_list $context.Values.__volume }} - {{- $_ := set $context.Values "__volume_list" $updated_list }} - {{- end }} - {{- $_ := set $context.Values.__daemonset_yaml.spec.template.spec "volumes" $context.Values.__volume_list }} - - - {{/* populate scheduling restrictions */}} - {{- if hasKey $current_dict "matchExpressions" }} - {{- if not $context.Values.__daemonset_yaml.spec.template.spec }}{{- $_ := set $context.Values.__daemonset_yaml.spec.template "spec" dict }}{{- end }} - {{- if not $context.Values.__daemonset_yaml.spec.template.spec.affinity }}{{- $_ := set $context.Values.__daemonset_yaml.spec.template.spec "affinity" dict }}{{- end }} - {{- if not $context.Values.__daemonset_yaml.spec.template.spec.affinity.nodeAffinity }}{{- $_ := set $context.Values.__daemonset_yaml.spec.template.spec.affinity "nodeAffinity" dict }}{{- end }} - {{- if not $context.Values.__daemonset_yaml.spec.template.spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution }}{{- $_ := set $context.Values.__daemonset_yaml.spec.template.spec.affinity.nodeAffinity "requiredDuringSchedulingIgnoredDuringExecution" dict }}{{- end }} - {{- $match_exprs := dict }} - {{- $_ := set $match_exprs "matchExpressions" $current_dict.matchExpressions }} - {{- $appended_match_expr := list $match_exprs }} - {{- $_ := set $context.Values.__daemonset_yaml.spec.template.spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution "nodeSelectorTerms" $appended_match_expr }} - {{- end }} - - {{/* input value hash for current set of values overrides */}} - {{- if not $context.Values.__daemonset_yaml.spec }}{{- $_ := set $context.Values.__daemonset_yaml "spec" dict }}{{- end }} - {{- if not $context.Values.__daemonset_yaml.spec.template }}{{- $_ := set $context.Values.__daemonset_yaml.spec "template" dict }}{{- end }} - {{- if not $context.Values.__daemonset_yaml.spec.template.metadata }}{{- $_ := set $context.Values.__daemonset_yaml.spec.template "metadata" dict }}{{- end }} - {{- if not $context.Values.__daemonset_yaml.spec.template.metadata.annotations }}{{- $_ := set $context.Values.__daemonset_yaml.spec.template.metadata "annotations" dict }}{{- end }} - {{- $cmap := list $current_dict.dns_1123_name $current_dict.nodeData | include $configmap_include }} - {{- $values_hash := $cmap | quote | sha256sum }} - {{- $_ := set $context.Values.__daemonset_yaml.spec.template.metadata.annotations "configmap-etc-hash" $values_hash }} - - {{/* generate configmap */}} ---- -{{ $cmap }} - {{/* generate daemonset yaml */}} ---- -{{ $context.Values.__daemonset_yaml | toYaml }} - {{- $_ := set $context.Values "__last_configmap_name" $current_dict.dns_1123_name }} - {{- end }} -{{- end }} diff --git a/helm-toolkit/templates/utils/_dependency_resolver.tpl b/helm-toolkit/templates/utils/_dependency_resolver.tpl deleted file mode 100644 index b1b3bd4e50..0000000000 --- a/helm-toolkit/templates/utils/_dependency_resolver.tpl +++ /dev/null @@ -1,36 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.dependency_resolver" }} -{{- $envAll := index . "envAll" -}} -{{- $dependencyMixinParam := index . "dependencyMixinParam" -}} -{{- $dependencyKey := index . "dependencyKey" -}} -{{- if $dependencyMixinParam -}} -{{- $_ := set $envAll.Values "pod_dependency" dict -}} -{{- if kindIs "string" $dependencyMixinParam }} -{{- $_ := include "helm-toolkit.utils.merge" (tuple $envAll.Values.pod_dependency ( index $envAll.Values.dependencies.static $dependencyKey ) ( index $envAll.Values.dependencies.dynamic.targeted $dependencyMixinParam $dependencyKey ) ) -}} -{{- else if kindIs "slice" $dependencyMixinParam }} -{{- range $k, $v := $dependencyMixinParam -}} -{{- if not $envAll.Values.__deps }}{{- $_ := set $envAll.Values "__deps" ( index $envAll.Values.dependencies.static $dependencyKey ) }}{{- end }} -{{- $_ := include "helm-toolkit.utils.merge" (tuple $envAll.Values.pod_dependency $envAll.Values.__deps ( index $envAll.Values.dependencies.dynamic.targeted $v $dependencyKey ) ) -}} -{{- $_ := set $envAll.Values "__deps" $envAll.Values.pod_dependency -}} -{{- end }} -{{- end }} -{{- else -}} -{{- $_ := set $envAll.Values "pod_dependency" ( index $envAll.Values.dependencies.static $dependencyKey ) -}} -{{- end -}} -{{ $envAll.Values.pod_dependency | toYaml }} -{{- end }} diff --git a/helm-toolkit/templates/utils/_hash.tpl b/helm-toolkit/templates/utils/_hash.tpl deleted file mode 100644 index 1041ec0006..0000000000 --- a/helm-toolkit/templates/utils/_hash.tpl +++ /dev/null @@ -1,23 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.hash" -}} -{{- $name := index . 0 -}} -{{- $context := index . 1 -}} -{{- $last := base $context.Template.Name }} -{{- $wtf := $context.Template.Name | replace $last $name -}} -{{- include $wtf $context | sha256sum | quote -}} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_image_sync_list.tpl b/helm-toolkit/templates/utils/_image_sync_list.tpl deleted file mode 100644 index 54dea4287b..0000000000 --- a/helm-toolkit/templates/utils/_image_sync_list.tpl +++ /dev/null @@ -1,27 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.image_sync_list" -}} -{{- $imageExcludeList := .Values.images.local_registry.exclude -}} -{{- $imageDict := .Values.images.tags -}} -{{- $local := dict "first" true -}} -{{- range $k, $v := $imageDict -}} -{{- if not $local.first -}},{{- end -}} -{{- if (not (has $k $imageExcludeList )) -}} -{{- index $imageDict $k -}} -{{- $_ := set $local "first" false -}} -{{- end -}}{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_joinListWithComma.tpl b/helm-toolkit/templates/utils/_joinListWithComma.tpl deleted file mode 100644 index 1a1e099583..0000000000 --- a/helm-toolkit/templates/utils/_joinListWithComma.tpl +++ /dev/null @@ -1,20 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.joinListWithComma" -}} -{{- $local := dict "first" true -}} -{{- range $k, $v := . -}}{{- if not $local.first -}},{{- end -}}{{- $v -}}{{- $_ := set $local "first" false -}}{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_joinListWithSpace.tpl b/helm-toolkit/templates/utils/_joinListWithSpace.tpl deleted file mode 100644 index 5875a7cb10..0000000000 --- a/helm-toolkit/templates/utils/_joinListWithSpace.tpl +++ /dev/null @@ -1,20 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.joinListWithSpace" -}} -{{- $local := dict "first" true -}} -{{- range $k, $v := . -}}{{- if not $local.first -}}{{- " " -}}{{- end -}}{{- $v -}}{{- $_ := set $local "first" false -}}{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_merge.tpl b/helm-toolkit/templates/utils/_merge.tpl deleted file mode 100644 index 3d58288493..0000000000 --- a/helm-toolkit/templates/utils/_merge.tpl +++ /dev/null @@ -1,100 +0,0 @@ -{{/* -Copyright 2018 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. -*/}} - -{{/* -Takes a tuple of values and merges into the first (target) one each subsequent -(source) one in order. If all values to merge are maps, then the tuple can be -passed as is and the target will be the result, otherwise pass a map with a -"values" key containing the tuple of values to merge, and the merge result will -be assigned to the "result" key of the passed map. - -When merging maps, for each key in the source, if the target does not define -that key, the source value is assigned. If both define the key, then the key -values are merged using this algorithm (recursively) and the result is assigned -to the target key. Slices are merged by appending them and removing any -duplicates. Any other values are merged by simply keeping the source, and -throwing away the target. -*/}} -{{- define "helm-toolkit.utils.merge" -}} - {{- $local := dict -}} - {{- if kindIs "map" $ -}} - {{- $_ := set $local "values" $.values -}} - {{- else -}} - {{- $_ := set $local "values" $ -}} - {{- end -}} - - {{- $target := first $local.values -}} - {{- range $item := rest $local.values -}} - {{- $call := dict "target" $target "source" . -}} - {{- $_ := include "helm-toolkit.utils._merge" $call -}} - {{- $_ := set $local "result" $call.result -}} - {{- end -}} - - {{- if kindIs "map" $ -}} - {{- $_ := set $ "result" $local.result -}} - {{- end -}} -{{- end -}} - -{{- define "helm-toolkit.utils._merge" -}} - {{- $local := dict -}} - - {{- $_ := set $ "result" $.source -}} - - {{/* - TODO: Should we `fail` when trying to merge a collection (map or slice) with - either a different kind of collection or a scalar? - */}} - - {{- if and (kindIs "map" $.target) (kindIs "map" $.source) -}} - {{- range $key, $sourceValue := $.source -}} - {{- if not (hasKey $.target $key) -}} - {{- $_ := set $local "newTargetValue" $sourceValue -}} - {{- if kindIs "map" $sourceValue -}} - {{- $copy := dict -}} - {{- $call := dict "target" $copy "source" $sourceValue -}} - {{- $_ := include "helm-toolkit.utils._merge.shallow" $call -}} - {{- $_ := set $local "newTargetValue" $copy -}} - {{- end -}} - {{- else -}} - {{- $targetValue := index $.target $key -}} - {{- $call := dict "target" $targetValue "source" $sourceValue -}} - {{- $_ := include "helm-toolkit.utils._merge" $call -}} - {{- $_ := set $local "newTargetValue" $call.result -}} - {{- end -}} - {{- $_ := set $.target $key $local.newTargetValue -}} - {{- end -}} - {{- $_ := set $ "result" $.target -}} - {{- else if and (kindIs "slice" $.target) (kindIs "slice" $.source) -}} - {{- $call := dict "target" $.target "source" $.source -}} - {{- $_ := include "helm-toolkit.utils._merge.append_slice" $call -}} - {{- $_ := set $ "result" (uniq $call.result) -}} - {{- end -}} -{{- end -}} - -{{- define "helm-toolkit.utils._merge.shallow" -}} - {{- range $key, $value := $.source -}} - {{- $_ := set $.target $key $value -}} - {{- end -}} -{{- end -}} - -{{- define "helm-toolkit.utils._merge.append_slice" -}} - {{- $local := dict -}} - {{- $_ := set $local "result" $.target -}} - {{- range $value := $.source -}} - {{- $_ := set $local "result" (append $local.result $value) -}} - {{- end -}} - {{- $_ := set $ "result" $local.result -}} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_template.tpl b/helm-toolkit/templates/utils/_template.tpl deleted file mode 100644 index 3f5f348d0d..0000000000 --- a/helm-toolkit/templates/utils/_template.tpl +++ /dev/null @@ -1,23 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.template" -}} -{{- $name := index . 0 -}} -{{- $context := index . 1 -}} -{{- $last := base $context.Template.Name }} -{{- $wtf := $context.Template.Name | replace $last $name -}} -{{ include $wtf $context }} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_to_ini.tpl b/helm-toolkit/templates/utils/_to_ini.tpl deleted file mode 100644 index cc9e3f8379..0000000000 --- a/helm-toolkit/templates/utils/_to_ini.tpl +++ /dev/null @@ -1,30 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.to_ini" -}} -{{- range $section, $values := . -}} -{{- if kindIs "map" $values -}} -[{{ $section }}] -{{range $key, $value := $values -}} -{{- if kindIs "slice" $value -}} -{{ $key }} = {{ include "helm-toolkit.utils.joinListWithComma" $value }} -{{else -}} -{{ $key }} = {{ $value }} -{{end -}} -{{- end -}} -{{- end -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_to_k8s_env_vars.tpl b/helm-toolkit/templates/utils/_to_k8s_env_vars.tpl deleted file mode 100644 index 5fe11114d6..0000000000 --- a/helm-toolkit/templates/utils/_to_k8s_env_vars.tpl +++ /dev/null @@ -1,27 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.to_k8s_env_vars" -}} -{{range $key, $value := . -}} -{{- if kindIs "slice" $value -}} -- name: {{ $key }} - value: {{ include "helm-toolkit.utils.joinListWithComma" $value | quote }} -{{else -}} -- name: {{ $key }} - value: {{ $value | quote }} -{{ end -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_to_kv_list.tpl b/helm-toolkit/templates/utils/_to_kv_list.tpl deleted file mode 100644 index 6f29dc65d0..0000000000 --- a/helm-toolkit/templates/utils/_to_kv_list.tpl +++ /dev/null @@ -1,42 +0,0 @@ -{{/* -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 returns key value pair in the INI format (key = value) -# as needed by openstack config files -# -# Sample key value pair format: -# conf: -# libvirt: -# log_level: 3 -# Usage: -# { include "helm-toolkit.utils.to_kv_list" .Values.conf.libvirt } -# returns: log_level = 3 - -{{- define "helm-toolkit.utils.to_kv_list" -}} -{{- range $key, $value := . -}} -{{- if kindIs "slice" $value }} -{{ $key }} = {{ include "helm-toolkit.utils.joinListWithComma" $value | quote }} -{{- else if kindIs "string" $value }} -{{- if regexMatch "^[0-9]+$" $value }} -{{ $key }} = {{ $value }} -{{- else }} -{{ $key }} = {{ $value | quote }} -{{- end }} -{{- else }} -{{ $key }} = {{ $value }} -{{- end }} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_to_oslo_conf.tpl b/helm-toolkit/templates/utils/_to_oslo_conf.tpl deleted file mode 100644 index 96f0c01d4f..0000000000 --- a/helm-toolkit/templates/utils/_to_oslo_conf.tpl +++ /dev/null @@ -1,36 +0,0 @@ -{{/* -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. -*/}} - -{{- define "helm-toolkit.utils.to_oslo_conf" -}} -{{- range $section, $values := . -}} -{{- if kindIs "map" $values -}} -[{{ $section }}] -{{ range $key, $value := $values -}} -{{- if kindIs "slice" $value -}} -{{ $key }} = {{ include "helm-toolkit.utils.joinListWithComma" $value }} -{{ else if kindIs "map" $value -}} -{{- if eq $value.type "multistring" }} -{{- range $k, $multistringValue := $value.values -}} -{{ $key }} = {{ $multistringValue }} -{{ end -}} -{{- end -}} -{{- else -}} -{{ $key }} = {{ $value }} -{{ end -}} -{{- end -}} -{{- end -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/templates/utils/_values_template_renderer.tpl b/helm-toolkit/templates/utils/_values_template_renderer.tpl deleted file mode 100644 index 4cc5471ed9..0000000000 --- a/helm-toolkit/templates/utils/_values_template_renderer.tpl +++ /dev/null @@ -1,81 +0,0 @@ -{{/* -Copyright 2018 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 renders out configuration sections into a format suitable for -incorporation into a config-map. This allows various forms of input to be -rendered out as appropriate, as illustrated in the following example: - -With the input: - - conf: - some: - config_to_render: | - #We can use all of gotpl here: eg macros, ranges etc. - Listen 0.0.0.0:{{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} - config_to_complete: - #here we can fill out params, but things need to be valid yaml as input - '{{ .Release.Name }}': '{{ printf "%s-%s" .Release.Namespace "namespace" }}' - static_config: - #this is just passed though as yaml to the configmap - foo: bar - -And the template: - - {{- $envAll := . }} - --- - apiVersion: v1 - kind: ConfigMap - metadata: - name: application-etc - data: - {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.some.config_to_render "key" "config_to_render.conf") | indent 2 }} - {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.some.config_to_complete "key" "config_to_complete.yaml") | indent 2 }} - {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.some.static_config "key" "static_config.yaml") | indent 2 }} - -The rendered output will match: - - apiVersion: v1 - kind: ConfigMap - metadata: - name: application-etc - data: - config_to_render.conf: | - #We can use all of gotpl here: eg macros, ranges etc. - Listen 0.0.0.0:80 - - config_to_complete.yaml: | - 'RELEASE-NAME': 'default-namespace' - - static_config.yaml: | - foo: bar - -*/}} - -{{- define "helm-toolkit.snippets.values_template_renderer" -}} -{{- $envAll := index . "envAll" -}} -{{- $template := index . "template" -}} -{{- $key := index . "key" -}} -{{- with $envAll -}} -{{- $templateRendered := tpl ( $template | toYaml ) . }} -{{- if hasPrefix "|\n" $templateRendered }} -{{ $key }}: {{ $templateRendered }} -{{- else }} -{{ $key }}: | -{{ $templateRendered | indent 2 }} -{{- end -}} -{{- end -}} -{{- end -}} diff --git a/helm-toolkit/values.yaml b/helm-toolkit/values.yaml deleted file mode 100644 index 9a2b0c22df..0000000000 --- a/helm-toolkit/values.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -# Default values for utils. -# This is a YAML-formatted file. -# Declare name/value pairs to be passed into your templates. -# name: value - -global: - region: cluster - tld: local - -endpoints: - fqdn: null - diff --git a/tools/deployment/armada/multinode/armada-ceph.yaml b/tools/deployment/armada/multinode/armada-ceph.yaml index bcd9709a92..0da9c80627 100644 --- a/tools/deployment/armada/multinode/armada-ceph.yaml +++ b/tools/deployment/armada/multinode/armada-ceph.yaml @@ -11,7 +11,7 @@ data: values: {} source: type: local - location: ${OSH_PATH} + location: ${OSH_INFRA_PATH} subpath: helm-toolkit reference: master dependencies: [] diff --git a/tools/deployment/armada/multinode/armada-cluster-ingress.yaml b/tools/deployment/armada/multinode/armada-cluster-ingress.yaml index 6eb60e4f11..740ab449e0 100644 --- a/tools/deployment/armada/multinode/armada-cluster-ingress.yaml +++ b/tools/deployment/armada/multinode/armada-cluster-ingress.yaml @@ -11,7 +11,7 @@ data: values: {} source: type: local - location: ${OSH_PATH} + location: ${OSH_INFRA_PATH} subpath: helm-toolkit reference: master dependencies: [] diff --git a/tools/deployment/armada/multinode/armada-lma.yaml b/tools/deployment/armada/multinode/armada-lma.yaml index 2cefc3afd3..90e30c9e53 100644 --- a/tools/deployment/armada/multinode/armada-lma.yaml +++ b/tools/deployment/armada/multinode/armada-lma.yaml @@ -9,23 +9,6 @@ data: namespace: helm-toolkit timeout: 300 values: {} - source: - type: local - location: ${OSH_PATH} - subpath: helm-toolkit - reference: master - dependencies: [] ---- -schema: armada/Chart/v1 -metadata: - schema: metadata/Document/v1 - name: osh-infra-helm-toolkit -data: - chart_name: osh-infra-helm-toolkit - release: osh-infra-helm-toolkit - namespace: helm-toolkit - timeout: 300 - values: {} source: type: local location: ${OSH_INFRA_PATH} @@ -198,7 +181,7 @@ data: subpath: elasticsearch reference: master dependencies: - - osh-infra-helm-toolkit + - helm-toolkit --- schema: armada/Chart/v1 metadata: @@ -244,7 +227,7 @@ data: subpath: fluent-logging reference: master dependencies: - - osh-infra-helm-toolkit + - helm-toolkit --- schema: armada/Chart/v1 metadata: @@ -282,7 +265,7 @@ data: subpath: kibana reference: master dependencies: - - osh-infra-helm-toolkit + - helm-toolkit --- schema: armada/Chart/v1 metadata: @@ -314,7 +297,7 @@ data: subpath: prometheus reference: master dependencies: - - osh-infra-helm-toolkit + - helm-toolkit --- schema: armada/Chart/v1 metadata: @@ -343,7 +326,7 @@ data: subpath: prometheus-kube-state-metrics reference: master dependencies: - - osh-infra-helm-toolkit + - helm-toolkit --- schema: armada/Chart/v1 metadata: @@ -372,7 +355,7 @@ data: subpath: prometheus-node-exporter reference: master dependencies: - - osh-infra-helm-toolkit + - helm-toolkit --- schema: armada/Chart/v1 metadata: @@ -401,7 +384,7 @@ data: subpath: prometheus-alertmanager reference: master dependencies: - - osh-infra-helm-toolkit + - helm-toolkit --- schema: armada/Chart/v1 metadata: @@ -449,7 +432,7 @@ data: subpath: grafana reference: master dependencies: - - osh-infra-helm-toolkit + - helm-toolkit --- schema: armada/ChartGroup/v1 metadata: diff --git a/tools/deployment/armada/multinode/armada-osh.yaml b/tools/deployment/armada/multinode/armada-osh.yaml index fd89f3c811..5767dc1369 100644 --- a/tools/deployment/armada/multinode/armada-osh.yaml +++ b/tools/deployment/armada/multinode/armada-osh.yaml @@ -9,23 +9,6 @@ data: namespace: helm-toolkit timeout: 300 values: {} - source: - type: local - location: ${OSH_PATH} - subpath: helm-toolkit - reference: master - dependencies: [] ---- -schema: armada/Chart/v1 -metadata: - schema: metadata/Document/v1 - name: osh-infra-helm-toolkit -data: - chart_name: osh-infra-helm-toolkit - release: osh-infra-helm-toolkit - namespace: helm-toolkit - timeout: 300 - values: {} source: type: local location: ${OSH_INFRA_PATH} @@ -1378,7 +1361,7 @@ data: subpath: prometheus-openstack-exporter reference: master dependencies: - - osh-infra-helm-toolkit + - helm-toolkit --- schema: armada/ChartGroup/v1 metadata: