Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump helm-toolkit to 0.2.78 #2264

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
openstack_helm_dependencies: &openstack_helm_dependencies
- name: helm-toolkit
repository: https://tarballs.openstack.org/openstack-helm-infra
version: 0.2.69
version: 0.2.78

charts:
- name: barbican
Expand Down
2 changes: 1 addition & 1 deletion charts/barbican/charts/helm-toolkit/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ name: helm-toolkit
sources:
- https://opendev.org/openstack/openstack-helm-infra
- https://opendev.org/openstack/openstack-helm
version: 0.2.69
version: 0.2.78
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ limitations under the License.

{{/*
abstract: |
Resolves 'hostname:port' for an endpoint
Resolves 'hostname:port' for an endpoint, or several hostname:port pairs for statefulset e.g
'hostname1:port1,hostname2:port2,hostname3:port3',
examples:
- values: |
endpoints:
Expand Down Expand Up @@ -46,14 +47,43 @@ examples:
{{ tuple "oslo_db" "internal" "mysql" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" }}
return: |
127.0.0.1:3306
- values: |
endpoints:
oslo_cache:
hosts:
default: memcached
host_fqdn_override:
default: null
statefulset:
name: openstack-memcached-memcached
replicas: 3
port:
memcache:
default: 11211
usage: |
{{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" }}
return: |
openstack-memcached-memcached-0:11211,openstack-memcached-memcached-1:11211,openstack-memcached-memcached-2:11211
*/}}

{{- define "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" -}}
{{- $type := index . 0 -}}
{{- $endpoint := index . 1 -}}
{{- $port := index . 2 -}}
{{- $context := index . 3 -}}
{{- $endpointPort := tuple $type $endpoint $port $context | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{- $endpointHostname := tuple $type $endpoint $context | include "helm-toolkit.endpoints.endpoint_host_lookup" }}
{{- printf "%s:%s" $endpointHostname $endpointPort -}}
{{- $ssMap := index $context.Values.endpoints ( $type | replace "-" "_" ) "statefulset" | default false -}}
{{- $local := dict "endpointHosts" list -}}
{{- $endpointPort := tuple $type $endpoint $port $context | include "helm-toolkit.endpoints.endpoint_port_lookup" -}}
{{- if $ssMap -}}
{{- $endpointHostPrefix := $ssMap.name -}}
{{- $endpointHostSuffix := tuple $type $endpoint $context | include "helm-toolkit.endpoints.endpoint_host_lookup" }}
{{- range $podInt := until ( atoi (print $ssMap.replicas ) ) -}}
{{- $endpointHostname := printf "%s-%d.%s:%s" $endpointHostPrefix $podInt $endpointHostSuffix $endpointPort -}}
{{- $_ := set $local "endpointHosts" ( append $local.endpointHosts $endpointHostname ) -}}
{{- end -}}
{{- else -}}
{{- $endpointHostname := tuple $type $endpoint $context | include "helm-toolkit.endpoints.endpoint_host_lookup" -}}
{{- $_ := set $local "endpointHosts" ( append $local.endpointHosts (printf "%s:%s" $endpointHostname $endpointPort) ) -}}
{{- end -}}
{{ include "helm-toolkit.utils.joinListWithComma" $local.endpointHosts }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ return: |
{{- $context := index . 3 -}}
{{- $endpointMap := index $context.Values.endpoints ( $type | replace "-" "_" ) }}
{{- if kindIs "string" $endpointMap.path }}
{{- printf "%s" $endpointMap.path | default "/" -}}
{{- printf "%s" $endpointMap.path | default "" -}}
{{- else -}}
{{- $endpointPath := index $endpointMap.path $endpoint | default $endpointMap.path.default | default "/" }}
{{- $endpointPath := index $endpointMap.path $endpoint | default $endpointMap.path.default | default "" }}
{{- printf "%s" $endpointPath -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
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.
*/}}
{{/*
abstract: |
Renders out the configmap <service>-oslo-policy.
values: |
conf:
policy.d:
file1:
foo: bar
file2:
foo: baz
usage: |
{{- include "helm-toolkit.manifests.configmap_oslo_policy" (dict "envAll" $envAll "serviceName" "keystone") }}
return: |
---
apiVersion: v1
kind: Secret
metadata:
name: keystone-oslo-policy
data:
file1: base64of(foo: bar)
file2: base64of(foo: baz)
*/}}
{{- define "helm-toolkit.manifests.configmap_oslo_policy" -}}
{{- $envAll := index . "envAll" -}}
{{- $serviceName := index . "serviceName" -}}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $serviceName }}-oslo-policy
type: Opaque
data:
{{- range $key, $value := index $envAll.Values.conf "policy.d" }}
{{- if $value }}
{{ $key }}: {{ toYaml $value | b64enc }}
{{- else }}
{{ $key }}: {{ "\n" | b64enc }}
{{- end }}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,10 @@ spec:
{{- range $v := without (index $endpointHost.tls "dnsNames" | default list) $hostNameFull }}
{{- $vHosts = append $vHosts $v }}
{{- end }}
{{- if hasKey $envAll.Values.endpoints "alias_fqdn" }}
{{- $alias_host := $envAll.Values.endpoints.alias_fqdn }}
{{- $vHosts = append $vHosts $alias_host }}
{{- end }}
{{- $secretName := index $envAll.Values.secrets "tls" ( $backendServiceType | replace "-" "_" ) $backendService $endpoint }}
{{- $_ := required "You need to specify a secret in your values for the endpoint" $secretName }}
tls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ except ImportError:
PARSER_OPTS = {"strict": False}
import logging
from sqlalchemy import create_engine
from sqlalchemy import text

# Create logger, console handler and formatter
logger = logging.getLogger('OpenStack-Helm DB Drop')
Expand Down Expand Up @@ -125,7 +126,7 @@ except:
# Delete DB
try:
with root_engine.connect() as connection:
connection.execute("DROP DATABASE IF EXISTS {0}".format(database))
connection.execute(text("DROP DATABASE IF EXISTS {0}".format(database)))
try:
connection.commit()
except AttributeError:
Expand All @@ -138,7 +139,7 @@ except:
# Delete DB User
try:
with root_engine.connect() as connection:
connection.execute("DROP USER IF EXISTS {0}".format(user))
connection.execute(text("DROP USER IF EXISTS {0}".format(user)))
try:
connection.commit()
except AttributeError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ except ImportError:
PARSER_OPTS = {"strict": False}
import logging
from sqlalchemy import create_engine
from sqlalchemy import text

# Create logger, console handler and formatter
logger = logging.getLogger('OpenStack-Helm DB Init')
Expand Down Expand Up @@ -125,7 +126,7 @@ except:
# Create DB
try:
with root_engine.connect() as connection:
connection.execute("CREATE DATABASE IF NOT EXISTS {0}".format(database))
connection.execute(text("CREATE DATABASE IF NOT EXISTS {0}".format(database)))
try:
connection.commit()
except AttributeError:
Expand All @@ -139,10 +140,10 @@ except:
try:
with root_engine.connect() as connection:
connection.execute(
"CREATE USER IF NOT EXISTS \'{0}\'@\'%%\' IDENTIFIED BY \'{1}\' {2}".format(
user, password, mysql_x509))
text("CREATE USER IF NOT EXISTS \'{0}\'@\'%%\' IDENTIFIED BY \'{1}\' {2}".format(
user, password, mysql_x509)))
connection.execute(
"GRANT ALL ON `{0}`.* TO \'{1}\'@\'%%\'".format(database, user))
text("GRANT ALL ON `{0}`.* TO \'{1}\'@\'%%\'".format(database, user)))
try:
connection.commit()
except AttributeError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,19 @@ RABBITMQ_ADMIN_USERNAME=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \
awk -F'[//:]' '{print $4}')
RABBITMQ_ADMIN_PASSWORD=$(echo "${RABBITMQ_ADMIN_CONNECTION}" | \
awk -F'[@]' '{print $1}' | \
awk -F'[//:]' '{print $5}')
awk -F'[//:]' '{print $5}' | \
sed 's/%/\\x/g' | \
xargs -0 printf "%b")

# 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}')
awk -F'[//:]' '{print $5}' | \
sed 's/%/\\x/g' | \
xargs -0 printf "%b")

# Extract User vHost
RABBITMQ_VHOST=$(echo "${RABBITMQ_USER_CONNECTION}" | \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ return: |
release_group: {{ $envAll.Values.release_group | default $envAll.Release.Name }}
application: {{ $application }}
component: {{ $component }}
app.kubernetes.io/name: {{ $application }}
app.kubernetes.io/component: {{ $component }}
app.kubernetes.io/instance: {{ $envAll.Values.release_group | default $envAll.Release.Name }}
{{- if ($envAll.Values.pod).labels }}
{{- if hasKey $envAll.Values.pod.labels $component }}
{{ index $envAll.Values.pod "labels" $component | toYaml }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{/*
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.
*/}}
{{/*
abstract: |
Inserts kubernetes service parameters from values as is.
values: |
network:
serviceExample:
service:
type: loadBalancer
loadBalancerIP: 1.1.1.1
usage: |
---
apiVersion: v1
kind: Service
metadata:
name: 'serviceExample'
spec:
ports:
- name: s-example
port: 1111
{{ .Values.network.serviceExample | include "helm-toolkit.snippets.service_params" | indent 2 }}
return: |
type: loadBalancer
loadBalancerIP: 1.1.1.1
*/}}

{{- define "helm-toolkit.snippets.service_params" }}
{{- $serviceParams := dict }}
{{- if hasKey . "service" }}
{{- $serviceParams = .service }}
{{- end }}
{{- if hasKey . "node_port" }}
{{- if hasKey .node_port "enabled" }}
{{- if .node_port.enabled }}
{{- $_ := set $serviceParams "type" "NodePort" }}
{{- end }}
{{- end }}
{{- end }}
{{- if hasKey . "external_policy_local" }}
{{- if .external_policy_local }}
{{- $_ := set $serviceParams "externalTrafficPolicy" "Local" }}
{{- end }}
{{- end }}
{{- if $serviceParams }}
{{- $serviceParams | toYaml }}
{{- end }}
{{- end }}
Loading
Loading