forked from uc-cdis/gen3-helm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add monogdb common chart dependencies
- Loading branch information
1 parent
8dc85d0
commit 9006ea9
Showing
15 changed files
with
1,340 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
{{/* | ||
Copyright Broadcom, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: APACHE-2.0 | ||
*/}} | ||
|
||
{{/* vim: set filetype=mustache: */}} | ||
|
||
{{/* | ||
Return a soft nodeAffinity definition | ||
{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} | ||
*/}} | ||
{{- define "common.affinities.nodes.soft" -}} | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- preference: | ||
matchExpressions: | ||
- key: {{ .key }} | ||
operator: In | ||
values: | ||
{{- range .values }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
weight: 1 | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a hard nodeAffinity definition | ||
{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} | ||
*/}} | ||
{{- define "common.affinities.nodes.hard" -}} | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: {{ .key }} | ||
operator: In | ||
values: | ||
{{- range .values }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a nodeAffinity definition | ||
{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} | ||
*/}} | ||
{{- define "common.affinities.nodes" -}} | ||
{{- if eq .type "soft" }} | ||
{{- include "common.affinities.nodes.soft" . -}} | ||
{{- else if eq .type "hard" }} | ||
{{- include "common.affinities.nodes.hard" . -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a topologyKey definition | ||
{{ include "common.affinities.topologyKey" (dict "topologyKey" "BAR") -}} | ||
*/}} | ||
{{- define "common.affinities.topologyKey" -}} | ||
{{ .topologyKey | default "kubernetes.io/hostname" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a soft podAffinity/podAntiAffinity definition | ||
{{ include "common.affinities.pods.soft" (dict "component" "FOO" "customLabels" .Values.podLabels "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "extraPodAffinityTerms" .Values.extraPodAffinityTerms "context" $) -}} | ||
*/}} | ||
{{- define "common.affinities.pods.soft" -}} | ||
{{- $component := default "" .component -}} | ||
{{- $customLabels := default (dict) .customLabels -}} | ||
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} | ||
{{- $extraPodAffinityTerms := default (list) .extraPodAffinityTerms -}} | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- podAffinityTerm: | ||
labelSelector: | ||
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" .context )) | nindent 10 }} | ||
{{- if not (empty $component) }} | ||
{{ printf "app.kubernetes.io/component: %s" $component }} | ||
{{- end }} | ||
{{- range $key, $value := $extraMatchLabels }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }} | ||
weight: 1 | ||
{{- range $extraPodAffinityTerms }} | ||
- podAffinityTerm: | ||
labelSelector: | ||
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" $.context )) | nindent 10 }} | ||
{{- if not (empty $component) }} | ||
{{ printf "app.kubernetes.io/component: %s" $component }} | ||
{{- end }} | ||
{{- range $key, $value := .extraMatchLabels }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }} | ||
weight: {{ .weight | default 1 -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a hard podAffinity/podAntiAffinity definition | ||
{{ include "common.affinities.pods.hard" (dict "component" "FOO" "customLabels" .Values.podLabels "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "extraPodAffinityTerms" .Values.extraPodAffinityTerms "context" $) -}} | ||
*/}} | ||
{{- define "common.affinities.pods.hard" -}} | ||
{{- $component := default "" .component -}} | ||
{{- $customLabels := default (dict) .customLabels -}} | ||
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} | ||
{{- $extraPodAffinityTerms := default (list) .extraPodAffinityTerms -}} | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" .context )) | nindent 8 }} | ||
{{- if not (empty $component) }} | ||
{{ printf "app.kubernetes.io/component: %s" $component }} | ||
{{- end }} | ||
{{- range $key, $value := $extraMatchLabels }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }} | ||
{{- range $extraPodAffinityTerms }} | ||
- labelSelector: | ||
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" $.context )) | nindent 8 }} | ||
{{- if not (empty $component) }} | ||
{{ printf "app.kubernetes.io/component: %s" $component }} | ||
{{- end }} | ||
{{- range $key, $value := .extraMatchLabels }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a podAffinity/podAntiAffinity definition | ||
{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} | ||
*/}} | ||
{{- define "common.affinities.pods" -}} | ||
{{- if eq .type "soft" }} | ||
{{- include "common.affinities.pods.soft" . -}} | ||
{{- else if eq .type "hard" }} | ||
{{- include "common.affinities.pods.hard" . -}} | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
{{/* | ||
Copyright Broadcom, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: APACHE-2.0 | ||
*/}} | ||
|
||
{{/* vim: set filetype=mustache: */}} | ||
|
||
{{/* | ||
Return the target Kubernetes version | ||
*/}} | ||
{{- define "common.capabilities.kubeVersion" -}} | ||
{{- default (default .Capabilities.KubeVersion.Version .Values.kubeVersion) ((.Values.global).kubeVersion) -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for poddisruptionbudget. | ||
*/}} | ||
{{- define "common.capabilities.policy.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.21-0" $kubeVersion) -}} | ||
{{- print "policy/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "policy/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for networkpolicy. | ||
*/}} | ||
{{- define "common.capabilities.networkPolicy.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.7-0" $kubeVersion) -}} | ||
{{- print "extensions/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "networking.k8s.io/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for cronjob. | ||
*/}} | ||
{{- define "common.capabilities.cronjob.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.21-0" $kubeVersion) -}} | ||
{{- print "batch/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "batch/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for daemonset. | ||
*/}} | ||
{{- define "common.capabilities.daemonset.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.14-0" $kubeVersion) -}} | ||
{{- print "extensions/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "apps/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for deployment. | ||
*/}} | ||
{{- define "common.capabilities.deployment.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.14-0" $kubeVersion) -}} | ||
{{- print "extensions/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "apps/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for statefulset. | ||
*/}} | ||
{{- define "common.capabilities.statefulset.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.14-0" $kubeVersion) -}} | ||
{{- print "apps/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "apps/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for ingress. | ||
*/}} | ||
{{- define "common.capabilities.ingress.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if (.Values.ingress).apiVersion -}} | ||
{{- .Values.ingress.apiVersion -}} | ||
{{- else if and (not (empty $kubeVersion)) (semverCompare "<1.14-0" $kubeVersion) -}} | ||
{{- print "extensions/v1beta1" -}} | ||
{{- else if and (not (empty $kubeVersion)) (semverCompare "<1.19-0" $kubeVersion) -}} | ||
{{- print "networking.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "networking.k8s.io/v1" -}} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for RBAC resources. | ||
*/}} | ||
{{- define "common.capabilities.rbac.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.17-0" $kubeVersion) -}} | ||
{{- print "rbac.authorization.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "rbac.authorization.k8s.io/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for CRDs. | ||
*/}} | ||
{{- define "common.capabilities.crd.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.19-0" $kubeVersion) -}} | ||
{{- print "apiextensions.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "apiextensions.k8s.io/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for APIService. | ||
*/}} | ||
{{- define "common.capabilities.apiService.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.10-0" $kubeVersion) -}} | ||
{{- print "apiregistration.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "apiregistration.k8s.io/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for Horizontal Pod Autoscaler. | ||
*/}} | ||
{{- define "common.capabilities.hpa.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" .context -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.23-0" $kubeVersion) -}} | ||
{{- if .beta2 -}} | ||
{{- print "autoscaling/v2beta2" -}} | ||
{{- else -}} | ||
{{- print "autoscaling/v2beta1" -}} | ||
{{- end -}} | ||
{{- else -}} | ||
{{- print "autoscaling/v2" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for Vertical Pod Autoscaler. | ||
*/}} | ||
{{- define "common.capabilities.vpa.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" .context -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.23-0" $kubeVersion) -}} | ||
{{- if .beta2 -}} | ||
{{- print "autoscaling/v2beta2" -}} | ||
{{- else -}} | ||
{{- print "autoscaling/v2beta1" -}} | ||
{{- end -}} | ||
{{- else -}} | ||
{{- print "autoscaling/v2" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Returns true if PodSecurityPolicy is supported | ||
*/}} | ||
{{- define "common.capabilities.psp.supported" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if or (empty $kubeVersion) (semverCompare "<1.25-0" $kubeVersion) -}} | ||
{{- true -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Returns true if AdmissionConfiguration is supported | ||
*/}} | ||
{{- define "common.capabilities.admissionConfiguration.supported" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if or (empty $kubeVersion) (not (semverCompare "<1.23-0" $kubeVersion)) -}} | ||
{{- true -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for AdmissionConfiguration. | ||
*/}} | ||
{{- define "common.capabilities.admissionConfiguration.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.23-0" $kubeVersion) -}} | ||
{{- print "apiserver.config.k8s.io/v1alpha1" -}} | ||
{{- else if and (not (empty $kubeVersion)) (semverCompare "<1.25-0" $kubeVersion) -}} | ||
{{- print "apiserver.config.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "apiserver.config.k8s.io/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for PodSecurityConfiguration. | ||
*/}} | ||
{{- define "common.capabilities.podSecurityConfiguration.apiVersion" -}} | ||
{{- $kubeVersion := include "common.capabilities.kubeVersion" . -}} | ||
{{- if and (not (empty $kubeVersion)) (semverCompare "<1.23-0" $kubeVersion) -}} | ||
{{- print "pod-security.admission.config.k8s.io/v1alpha1" -}} | ||
{{- else if and (not (empty $kubeVersion)) (semverCompare "<1.25-0" $kubeVersion) -}} | ||
{{- print "pod-security.admission.config.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "pod-security.admission.config.k8s.io/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Returns true if the used Helm version is 3.3+. | ||
A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure. | ||
This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error. | ||
**To be removed when the catalog's minimun Helm version is 3.3** | ||
*/}} | ||
{{- define "common.capabilities.supportsHelmVersion" -}} | ||
{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }} | ||
{{- true -}} | ||
{{- end -}} | ||
{{- end -}} |
Oops, something went wrong.