-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from startechnica/st-common
[st common] Bump version to 0.1.9
- Loading branch information
Showing
30 changed files
with
2,129 additions
and
146 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
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
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
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,155 @@ | ||
{{/* | ||
Copyright (c) 2025 Firmansyah Nainggolan. All Rights Reserved. | ||
SPDX-License-Identifier: APACHE-2.0 | ||
*/}} | ||
|
||
{{/* vim: set filetype=mustache: */}} | ||
|
||
{{/* | ||
Return a soft nodeAffinity definition | ||
{{ include "st-common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} | ||
*/}} | ||
{{- define "st-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 "st-common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} | ||
*/}} | ||
{{- define "st-common.affinities.nodes.hard" -}} | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: {{ .key }} | ||
operator: In | ||
values: | ||
{{- range .values }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a nodeAffinity definition | ||
{{ include "st-common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} | ||
*/}} | ||
{{- define "st-common.affinities.nodes" -}} | ||
{{- if eq .type "soft" }} | ||
{{- include "st-common.affinities.nodes.soft" . -}} | ||
{{- else if eq .type "hard" }} | ||
{{- include "st-common.affinities.nodes.hard" . -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a topologyKey definition | ||
{{ include "st-common.affinities.topologyKey" (dict "topologyKey" "BAR") -}} | ||
*/}} | ||
{{- define "st-common.affinities.topologyKey" -}} | ||
{{ .topologyKey | default "kubernetes.io/hostname" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a soft podAffinity/podAntiAffinity definition | ||
{{ include "st-common.affinities.pods.soft" (dict "component" "FOO" "customLabels" .Values.podLabels "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "extraPodAffinityTerms" .Values.extraPodAffinityTerms "extraNamespaces" (list "namespace1" "namespace2") "context" $) -}} | ||
*/}} | ||
{{- define "st-common.affinities.pods.soft" -}} | ||
{{- $component := default "" .component -}} | ||
{{- $customLabels := default (dict) .customLabels -}} | ||
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} | ||
{{- $extraPodAffinityTerms := default (list) .extraPodAffinityTerms -}} | ||
{{- $extraNamespaces := default (list) .extraNamespaces -}} | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- podAffinityTerm: | ||
labelSelector: | ||
matchLabels: {{- (include "st-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 }} | ||
{{- if $extraNamespaces }} | ||
namespaces: | ||
- {{ .context.Release.Namespace }} | ||
{{- with $extraNamespaces }} | ||
{{ include "st-common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
topologyKey: {{ include "st-common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }} | ||
weight: 1 | ||
{{- range $extraPodAffinityTerms }} | ||
- podAffinityTerm: | ||
labelSelector: | ||
matchLabels: {{- (include "st-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 "st-common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }} | ||
weight: {{ .weight | default 1 -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a hard podAffinity/podAntiAffinity definition | ||
{{ include "st-common.affinities.pods.hard" (dict "component" "FOO" "customLabels" .Values.podLabels "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "extraPodAffinityTerms" .Values.extraPodAffinityTerms "extraNamespaces" (list "namespace1" "namespace2") "context" $) -}} | ||
*/}} | ||
{{- define "st-common.affinities.pods.hard" -}} | ||
{{- $component := default "" .component -}} | ||
{{- $customLabels := default (dict) .customLabels -}} | ||
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} | ||
{{- $extraPodAffinityTerms := default (list) .extraPodAffinityTerms -}} | ||
{{- $extraNamespaces := default (list) .extraNamespaces -}} | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchLabels: {{- (include "st-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 }} | ||
{{- if $extraNamespaces }} | ||
namespaces: | ||
- {{ .context.Release.Namespace }} | ||
{{- with $extraNamespaces }} | ||
{{ include "st-common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
topologyKey: {{ include "st-common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }} | ||
{{- range $extraPodAffinityTerms }} | ||
- labelSelector: | ||
matchLabels: {{- (include "st-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 "st-common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return a podAffinity/podAntiAffinity definition | ||
{{ include "st-common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} | ||
*/}} | ||
{{- define "st-common.affinities.pods" -}} | ||
{{- if eq .type "soft" }} | ||
{{- include "st-common.affinities.pods.soft" . -}} | ||
{{- else if eq .type "hard" }} | ||
{{- include "st-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,33 @@ | ||
{{- /* | ||
Copyright (c) 2025 Firmansyah Nainggolan. All Rights Reserved. | ||
SPDX-License-Identifier: APACHE-2.0 | ||
*/}} | ||
|
||
{{/* vim: set filetype=mustache: */}} | ||
|
||
{{/* Return the appropriate apiVersion for Argo Application */}} | ||
{{- define "st-common.capabilities.argoprojApplication.apiVersion" -}} | ||
{{- if .Capabilities.APIVersions.Has "argoproj.io/v1alpha1" -}} | ||
{{- print "argoproj.io/v1alpha1" -}} | ||
{{- else -}} | ||
{{- false -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* Return the appropriate apiVersion for Argo ApplicationSet */}} | ||
{{- define "st-common.capabilities.argoprojApplicationSet.apiVersion" -}} | ||
{{- if .Capabilities.APIVersions.Has "argoproj.io/v1alpha1" -}} | ||
{{- print "argoproj.io/v1alpha1" -}} | ||
{{- else -}} | ||
{{- false -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* Return the appropriate apiVersion for Argo AppProject */}} | ||
{{- define "st-common.capabilities.argoprojAppProject.apiVersion" -}} | ||
{{- if .Capabilities.APIVersions.Has "argoproj.io/v1alpha1" -}} | ||
{{- print "argoproj.io/v1alpha1" -}} | ||
{{- else -}} | ||
{{- false -}} | ||
{{- 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
Oops, something went wrong.