Skip to content

feat(cf-common): global topology spread constaints #116

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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/cf-common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: v0.0.0
description: Codefresh library chart
name: cf-common
version: 0.28.0
version: 0.29.0
type: library
keywords:
- codefresh
Expand Down
82 changes: 41 additions & 41 deletions charts/cf-common/templates/classic/_env_var_secret_ref.tpl
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{{- /*
MONGODB_HOST env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.mongodb-host-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.mongodb-host-env-var-secret-name" }}
{{- if or .Values.mongodbHostSecretKeyRef .Values.global.mongodbHostSecretKeyRef }}
{{- printf (coalesce .Values.mongodbHostSecretKeyRef.name .Values.global.mongodbHostSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
MONGODB_HOST env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.mongodb-host-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.mongodb-host-env-var-secret-key" }}
{{- if or .Values.mongodbHostSecretKeyRef .Values.global.mongodbHostSecretKeyRef }}
{{- printf (coalesce .Values.mongodbHostSecretKeyRef.key .Values.global.mongodbHostSecretKeyRef.key) }}
{{- else }}
Expand All @@ -23,18 +23,18 @@ MONGODB_HOST env var secret key
{{- /*
MONGODB_USER env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.mongodb-user-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.mongodb-user-env-var-secret-name" }}
{{- if or .Values.mongodbUserSecretKeyRef .Values.global.mongodbUserSecretKeyRef }}
{{- printf (coalesce .Values.mongodbUserSecretKeyRef.name .Values.global.mongodbUserSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
MONGODB_USER env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.mongodb-user-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.mongodb-user-env-var-secret-key" }}
{{- if or .Values.mongodbUserSecretKeyRef .Values.global.mongodbUserSecretKeyRef }}
{{- printf (coalesce .Values.mongodbUserSecretKeyRef.key .Values.global.mongodbUserSecretKeyRef.key) }}
{{- else }}
Expand All @@ -45,18 +45,18 @@ MONGODB_USER env var secret key
{{- /*
MONGODB_PASSWORD env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.mongodb-password-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.mongodb-password-env-var-secret-name" }}
{{- if or .Values.mongodbPasswordSecretKeyRef .Values.global.mongodbPasswordSecretKeyRef }}
{{- printf (coalesce .Values.mongodbPasswordSecretKeyRef.name .Values.global.mongodbPasswordSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
MONGODB_PASSWORD env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.mongodb-password-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.mongodb-password-env-var-secret-key" }}
{{- if or .Values.mongodbPasswordSecretKeyRef .Values.global.mongodbPasswordSecretKeyRef }}
{{- printf (coalesce .Values.mongodbPasswordSecretKeyRef.key .Values.global.mongodbPasswordSecretKeyRef.key) }}
{{- else }}
Expand All @@ -67,7 +67,7 @@ MONGODB_PASSWORD env var secret key
{{- /*
MONGO_URI env var value
*/}}
{{- define "cf-common-0.28.0.classic.mongo-uri-env-var-value" }}
{{- define "cf-common-0.29.0.classic.mongo-uri-env-var-value" }}
{{- /*
Check for legacy global.mongoURI
*/}}
Expand All @@ -84,7 +84,7 @@ New secret implementation
{{- /*
MONGO_URI_ARCHIVE env var value
*/}}
{{- define "cf-common-0.28.0.classic.mongo-uri-archive-env-var-value" }}
{{- define "cf-common-0.29.0.classic.mongo-uri-archive-env-var-value" }}
{{- /*
Check for legacy global.mongoURIArchive or global.mongoURI
*/}}
Expand All @@ -102,18 +102,18 @@ New secret implementation
{{- /*
REDIS_URL env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.redis-url-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.redis-url-env-var-secret-name" }}
{{- if or .Values.redisUrlSecretKeyRef .Values.global.redisUrlSecretKeyRef }}
{{- printf (coalesce .Values.redisUrlSecretKeyRef.name .Values.global.redisUrlSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
REDIS_URL env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.redis-url-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.redis-url-env-var-secret-key" }}
{{- if or .Values.redisUrlSecretKeyRef .Values.global.redisUrlSecretKeyRef }}
{{- printf (coalesce .Values.redisUrlSecretKeyRef.key .Values.global.redisUrlSecretKeyRef.key) }}
{{- else }}
Expand All @@ -124,18 +124,18 @@ REDIS_URL env var secret key
{{- /*
REDIS_PASSWORD env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.redis-password-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.redis-password-env-var-secret-name" }}
{{- if or .Values.redisPasswordSecretKeyRef .Values.global.redisPasswordSecretKeyRef }}
{{- printf (coalesce .Values.redisPasswordSecretKeyRef.name .Values.global.redisPasswordSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
REDIS_PASSWORD env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.redis-password-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.redis-password-env-var-secret-key" }}
{{- if or .Values.redisPasswordSecretKeyRef .Values.global.redisPasswordSecretKeyRef }}
{{- printf (coalesce .Values.redisPasswordSecretKeyRef.key .Values.global.redisPasswordSecretKeyRef.key) }}
{{- else }}
Expand All @@ -146,18 +146,18 @@ REDIS_PASSWORD env var secret key
{{- /*
POSTGRES_HOSTNAME env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.postgres-hostname-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.postgres-hostname-env-var-secret-name" }}
{{- if or .Values.postgresHostnameSecretKeyRef .Values.global.postgresHostnameSecretKeyRef }}
{{- printf (coalesce .Values.postgresHostnameSecretKeyRef.name .Values.global.postgresHostnameSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
POSTGRES_HOSTNAME env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.postgres-hostname-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.postgres-hostname-env-var-secret-key" }}
{{- if or .Values.postgresHostnameSecretKeyRef .Values.global.postgresHostnameSecretKeyRef }}
{{- printf (coalesce .Values.postgresHostnameSecretKeyRef.key .Values.global.postgresHostnameSecretKeyRef.key) }}
{{- else }}
Expand All @@ -168,18 +168,18 @@ POSTGRES_HOSTNAME env var secret key
{{- /*
POSTGRES_PASSWORD env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.postgres-password-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.postgres-password-env-var-secret-name" }}
{{- if or .Values.postgresPasswordSecretKeyRef .Values.global.postgresPasswordSecretKeyRef }}
{{- printf (coalesce .Values.postgresPasswordSecretKeyRef.name .Values.global.postgresPasswordSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
POSTGRES_PASSWORD env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.postgres-password-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.postgres-password-env-var-secret-key" }}
{{- if or .Values.postgresPasswordSecretKeyRef .Values.global.postgresPasswordSecretKeyRef }}
{{- printf (coalesce .Values.postgresPasswordSecretKeyRef.key .Values.global.postgresPasswordSecretKeyRef.key) }}
{{- else }}
Expand All @@ -190,18 +190,18 @@ POSTGRES_PASSWORD env var secret key
{{- /*
POSTGRES_USER env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.postgres-user-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.postgres-user-env-var-secret-name" }}
{{- if or .Values.postgresUserSecretKeyRef .Values.global.postgresUserSecretKeyRef }}
{{- printf (coalesce .Values.postgresUserSecretKeyRef.name .Values.global.postgresUserSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
POSTGRES_USER env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.postgres-user-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.postgres-user-env-var-secret-key" }}
{{- if or .Values.postgresUserSecretKeyRef .Values.global.postgresUserSecretKeyRef }}
{{- printf (coalesce .Values.postgresUserSecretKeyRef.key .Values.global.postgresUserSecretKeyRef.key) }}
{{- else }}
Expand All @@ -212,18 +212,18 @@ POSTGRES_USER env var secret key
{{- /*
RABBITMQ_HOSTNAME env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.rabbitmq-hostname-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.rabbitmq-hostname-env-var-secret-name" }}
{{- if or .Values.rabbitmqHostnameSecretKeyRef .Values.global.rabbitmqHostnameSecretKeyRef }}
{{- printf (coalesce .Values.rabbitmqHostnameSecretKeyRef.name .Values.global.rabbitmqHostnameSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
RABBITMQ_HOSTNAME env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.rabbitmq-hostname-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.rabbitmq-hostname-env-var-secret-key" }}
{{- if or .Values.rabbitmqHostnameSecretKeyRef .Values.global.rabbitmqHostnameSecretKeyRef }}
{{- printf (coalesce .Values.rabbitmqHostnameSecretKeyRef.key .Values.global.rabbitmqHostnameSecretKeyRef.key) }}
{{- else }}
Expand All @@ -234,18 +234,18 @@ RABBITMQ_HOSTNAME env var secret key
{{- /*
RABBITMQ_PASSWORD env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.rabbitmq-password-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.rabbitmq-password-env-var-secret-name" }}
{{- if or .Values.rabbitmqPasswordSecretKeyRef .Values.global.rabbitmqPasswordSecretKeyRef }}
{{- printf (coalesce .Values.rabbitmqPasswordSecretKeyRef.name .Values.global.rabbitmqPasswordSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
RABBITMQ_PASSWORD env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.rabbitmq-password-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.rabbitmq-password-env-var-secret-key" }}
{{- if or .Values.rabbitmqPasswordSecretKeyRef .Values.global.rabbitmqPasswordSecretKeyRef }}
{{- printf (coalesce .Values.rabbitmqPasswordSecretKeyRef.key .Values.global.rabbitmqPasswordSecretKeyRef.key) }}
{{- else }}
Expand All @@ -256,18 +256,18 @@ RABBITMQ_PASSWORD env var secret key
{{- /*
RABBITMQ_USERNAME env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.rabbitmq-username-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.rabbitmq-username-env-var-secret-name" }}
{{- if or .Values.rabbitmqUsernameSecretKeyRef .Values.global.rabbitmqUsernameSecretKeyRef }}
{{- printf (coalesce .Values.rabbitmqUsernameSecretKeyRef.name .Values.global.rabbitmqUsernameSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
RABBITMQ_USERNAME env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.rabbitmq-username-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.rabbitmq-username-env-var-secret-key" }}
{{- if or .Values.rabbitmqUsernameSecretKeyRef .Values.global.rabbitmqUsernameSecretKeyRef }}
{{- printf (coalesce .Values.rabbitmqUsernameSecretKeyRef.key .Values.global.rabbitmqUsernameSecretKeyRef.key) }}
{{- else }}
Expand All @@ -278,18 +278,18 @@ RABBITMQ_USERNAME env var secret key
{{- /*
FIREBASE_SECRET env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.firebase-secret-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.firebase-secret-env-var-secret-name" }}
{{- if or .Values.firebaseSecretSecretKeyRef .Values.global.firebaseSecretSecretKeyRef }}
{{- printf (coalesce .Values.firebaseSecretSecretKeyRef.name .Values.global.firebaseSecretSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
FIREBASE_SECRET env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.firebase-secret-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.firebase-secret-env-var-secret-key" }}
{{- if or .Values.firebaseSecretSecretKeyRef .Values.global.firebaseSecretSecretKeyRef }}
{{- printf (coalesce .Values.firebaseSecretSecretKeyRef.key .Values.global.firebaseSecretSecretKeyRef.key) }}
{{- else }}
Expand All @@ -300,18 +300,18 @@ FIREBASE_SECRET env var secret key
{{- /*
FIREBASE_URL env var secret name
*/}}
{{- define "cf-common-0.28.0.classic.firebase-url-env-var-secret-name" }}
{{- define "cf-common-0.29.0.classic.firebase-url-env-var-secret-name" }}
{{- if or .Values.firebaseUrlSecretKeyRef .Values.global.firebaseUrlSecretKeyRef }}
{{- printf (coalesce .Values.firebaseUrlSecretKeyRef.name .Values.global.firebaseUrlSecretKeyRef.name) }}
{{- else }}
{{- printf "%s-%s" (include "cf-common-0.28.0.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.29.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
FIREBASE_URL env var secret key
*/}}
{{- define "cf-common-0.28.0.classic.firebase-url-env-var-secret-key" }}
{{- define "cf-common-0.29.0.classic.firebase-url-env-var-secret-key" }}
{{- if or .Values.firebaseUrlSecretKeyRef .Values.global.firebaseUrlSecretKeyRef }}
{{- printf (coalesce .Values.firebaseUrlSecretKeyRef.key .Values.global.firebaseUrlSecretKeyRef.key) }}
{{- else }}
Expand Down
10 changes: 5 additions & 5 deletions charts/cf-common/templates/classic/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Calculate RabbitMQ URI (for On-Prem)
Must me called from chart root context.
Usage:
{{ include "cf-common-0.28.0.classic.calculateRabbitMqUri" . }}
{{ include "cf-common-0.29.0.classic.calculateRabbitMqUri" . }}
*/}}

{{- define "cf-common-0.28.0.classic.calculateRabbitMqUri" }}
{{- define "cf-common-0.29.0.classic.calculateRabbitMqUri" }}

{{- $rabbitmqProtocol := .Values.global.rabbitmqProtocol | default "amqp" -}}
{{- $rabbitmqUsername := .Values.global.rabbitmqUsername -}}
Expand All @@ -23,9 +23,9 @@ coalesce here for backward compatibility
{{/*
Calculate Mongo Uri (for On-Prem)
Usage:
{{ include "cf.common-0.28.0.classic.calculateMongoUri" (dict "dbName" $.Values.global.pipelineManagerService "mongoURI" $.Values.global.mongoURI) }}
{{ include "cf.common-0.29.0.classic.calculateMongoUri" (dict "dbName" $.Values.global.pipelineManagerService "mongoURI" $.Values.global.mongoURI) }}
*/}}
{{- define "cf-common-0.28.0.classic.calculateMongoUri" -}}
{{- define "cf-common-0.29.0.classic.calculateMongoUri" -}}
{{- if contains "?" .mongoURI -}}
{{- $mongoURI := (splitList "?" .mongoURI) -}}
{{- printf "%s%s?%s" (first $mongoURI) .dbName (last $mongoURI) }}
Expand All @@ -39,7 +39,7 @@ Usage:
{{/*
Calculate Consul host Uri (for On-Prem)
*/}}
{{- define "cf-common-0.28.0.classic.calculateConsulUri" }}
{{- define "cf-common-0.29.0.classic.calculateConsulUri" }}
{{- if .Values.global.consulHost }}
{{- printf "http://%s:%v" .Values.global.consulHost .Values.global.consulHttpPort -}}
{{- else }}
Expand Down
10 changes: 5 additions & 5 deletions charts/cf-common/templates/common/_annotations.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
Render checksum annotation
Must be called from chart root context.
Usage:
annotations: {{ include "cf-common-0.28.0.annotations.podAnnotations" . | nindent }}
annotations: {{ include "cf-common-0.29.0.annotations.podAnnotations" . | nindent }}
*/}}
{{- define "cf-common-0.28.0.annotations.podAnnotations" -}}
{{- define "cf-common-0.29.0.annotations.podAnnotations" -}}

{{- if .Values.podAnnotations -}}
{{- include "cf-common-0.28.0.tplrender" (dict "Values" .Values.podAnnotations "context" $) | nindent 0 }}
{{- include "cf-common-0.29.0.tplrender" (dict "Values" .Values.podAnnotations "context" $) | nindent 0 }}
{{- end -}}

{{- $configMapFound := dict -}}
{{- range $configMapIndex, $configMapItem := .Values.configMaps -}}

{{- if $configMapItem.enabled -}}
{{- $_ := set $configMapFound $configMapIndex ( include "cf-common-0.28.0.tplrender" (dict "Values" $configMapItem.data "context" $) | sha256sum) -}}
{{- $_ := set $configMapFound $configMapIndex ( include "cf-common-0.29.0.tplrender" (dict "Values" $configMapItem.data "context" $) | sha256sum) -}}
{{- end -}}

{{- if $configMapFound -}}
Expand All @@ -27,7 +27,7 @@ annotations: {{ include "cf-common-0.28.0.annotations.podAnnotations" . | ninden
{{- range $secretIndex, $secretItem := .Values.secrets -}}

{{- if $secretItem.enabled -}}
{{- $_ := set $secretFound $secretIndex ( include "cf-common-0.28.0.tplrender" (dict "Values" $secretItem.stringData "context" $) | sha256sum) -}}
{{- $_ := set $secretFound $secretIndex ( include "cf-common-0.29.0.tplrender" (dict "Values" $secretItem.stringData "context" $) | sha256sum) -}}
{{- end -}}

{{- if $secretFound -}}
Expand Down
Loading
Loading