Skip to content

Commit

Permalink
feat(cf-common): tpl on image
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-klimko committed Jan 19, 2024
1 parent 9eebf9f commit 211c5fe
Show file tree
Hide file tree
Showing 41 changed files with 301 additions and 302 deletions.
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.17.1
version: 0.18.0
type: library
keywords:
- codefresh
Expand Down
4 changes: 2 additions & 2 deletions charts/cf-common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Codefresh library chart

![Version: 0.17.1](https://img.shields.io/badge/Version-0.17.1-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: v0.0.0](https://img.shields.io/badge/AppVersion-v0.0.0-informational?style=flat-square)
![Version: 0.18.0](https://img.shields.io/badge/Version-0.18.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: v0.0.0](https://img.shields.io/badge/AppVersion-v0.0.0-informational?style=flat-square)

## Installing the Chart

Expand All @@ -18,7 +18,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
# Chart.yaml
dependencies:
- name: cf-common
version: 0.17.1
version: 0.18.0
repository: https://chartmuseum.codefresh.io/cf-common
```
Expand Down
80 changes: 40 additions & 40 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.17.1.classic.mongodb-host-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
MONGODB_HOST env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.mongodb-host-env-var-secret-key" }}
{{- define "cf-common-0.18.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.17.1.classic.mongodb-user-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
MONGODB_USER env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.mongodb-user-env-var-secret-key" }}
{{- define "cf-common-0.18.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.17.1.classic.mongodb-password-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
MONGODB_PASSWORD env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.mongodb-password-env-var-secret-key" }}
{{- define "cf-common-0.18.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.17.1.classic.mongo-uri-env-var-value" }}
{{- define "cf-common-0.18.0.classic.mongo-uri-env-var-value" }}
{{- /*
Check for legacy global.mongoURI
*/}}
Expand All @@ -84,18 +84,18 @@ New secret implementation
{{- /*
REDIS_URL env var secret name
*/}}
{{- define "cf-common-0.17.1.classic.redis-url-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
REDIS_URL env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.redis-url-env-var-secret-key" }}
{{- define "cf-common-0.18.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 @@ -106,18 +106,18 @@ REDIS_URL env var secret key
{{- /*
REDIS_PASSWORD env var secret name
*/}}
{{- define "cf-common-0.17.1.classic.redis-password-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
REDIS_PASSWORD env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.redis-password-env-var-secret-key" }}
{{- define "cf-common-0.18.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 @@ -128,18 +128,18 @@ REDIS_PASSWORD env var secret key
{{- /*
POSTGRES_HOSTNAME env var secret name
*/}}
{{- define "cf-common-0.17.1.classic.postgres-hostname-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
POSTGRES_HOSTNAME env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.postgres-hostname-env-var-secret-key" }}
{{- define "cf-common-0.18.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 @@ -150,18 +150,18 @@ POSTGRES_HOSTNAME env var secret key
{{- /*
POSTGRES_PASSWORD env var secret name
*/}}
{{- define "cf-common-0.17.1.classic.postgres-password-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
POSTGRES_PASSWORD env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.postgres-password-env-var-secret-key" }}
{{- define "cf-common-0.18.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 @@ -172,18 +172,18 @@ POSTGRES_PASSWORD env var secret key
{{- /*
POSTGRES_USER env var secret name
*/}}
{{- define "cf-common-0.17.1.classic.postgres-user-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
POSTGRES_USER env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.postgres-user-env-var-secret-key" }}
{{- define "cf-common-0.18.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 @@ -194,18 +194,18 @@ POSTGRES_USER env var secret key
{{- /*
RABBITMQ_HOSTNAME env var secret name
*/}}
{{- define "cf-common-0.17.1.classic.rabbitmq-hostname-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
RABBITMQ_HOSTNAME env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.rabbitmq-hostname-env-var-secret-key" }}
{{- define "cf-common-0.18.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 @@ -216,18 +216,18 @@ RABBITMQ_HOSTNAME env var secret key
{{- /*
RABBITMQ_PASSWORD env var secret name
*/}}
{{- define "cf-common-0.17.1.classic.rabbitmq-password-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
RABBITMQ_PASSWORD env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.rabbitmq-password-env-var-secret-key" }}
{{- define "cf-common-0.18.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 @@ -238,18 +238,18 @@ RABBITMQ_PASSWORD env var secret key
{{- /*
RABBITMQ_USERNAME env var secret name
*/}}
{{- define "cf-common-0.17.1.classic.rabbitmq-username-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
RABBITMQ_USERNAME env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.rabbitmq-username-env-var-secret-key" }}
{{- define "cf-common-0.18.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 @@ -260,18 +260,18 @@ RABBITMQ_USERNAME env var secret key
{{- /*
FIREBASE_SECRET env var secret name
*/}}
{{- define "cf-common-0.17.1.classic.firebase-secret-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
FIREBASE_SECRET env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.firebase-secret-env-var-secret-key" }}
{{- define "cf-common-0.18.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 @@ -282,18 +282,18 @@ FIREBASE_SECRET env var secret key
{{- /*
FIREBASE_URL env var secret name
*/}}
{{- define "cf-common-0.17.1.classic.firebase-url-env-var-secret-name" }}
{{- define "cf-common-0.18.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.17.1.names.fullname" .) "secret" }}
{{- printf "%s-%s" (include "cf-common-0.18.0.names.fullname" .) "secret" }}
{{- end }}
{{- end }}

{{- /*
FIREBASE_URL env var secret key
*/}}
{{- define "cf-common-0.17.1.classic.firebase-url-env-var-secret-key" }}
{{- define "cf-common-0.18.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.17.1.classic.calculateRabbitMqUri" . }}
{{ include "cf-common-0.18.0.classic.calculateRabbitMqUri" . }}
*/}}

{{- define "cf-common-0.17.1.classic.calculateRabbitMqUri" }}
{{- define "cf-common-0.18.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.17.1.classic.calculateMongoUri" (dict "dbName" $.Values.global.pipelineManagerService "mongoURI" $.Values.global.mongoURI) }}
{{ include "cf.common-0.18.0.classic.calculateMongoUri" (dict "dbName" $.Values.global.pipelineManagerService "mongoURI" $.Values.global.mongoURI) }}
*/}}
{{- define "cf-common-0.17.1.classic.calculateMongoUri" -}}
{{- define "cf-common-0.18.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.17.1.classic.calculateConsulUri" }}
{{- define "cf-common-0.18.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.17.1.annotations.podAnnotations" . | nindent }}
annotations: {{ include "cf-common-0.18.0.annotations.podAnnotations" . | nindent }}
*/}}
{{- define "cf-common-0.17.1.annotations.podAnnotations" -}}
{{- define "cf-common-0.18.0.annotations.podAnnotations" -}}

{{- if .Values.podAnnotations -}}
{{- include "cf-common-0.17.1.tplrender" (dict "Values" .Values.podAnnotations "context" $) | nindent 0 }}
{{- include "cf-common-0.18.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.17.1.tplrender" (dict "Values" $configMapItem.data "context" $) | sha256sum) -}}
{{- $_ := set $configMapFound $configMapIndex ( include "cf-common-0.18.0.tplrender" (dict "Values" $configMapItem.data "context" $) | sha256sum) -}}
{{- end -}}

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

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

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

0 comments on commit 211c5fe

Please sign in to comment.