Skip to content

Commit 40971da

Browse files
authored
initial commit for necessary charts (#1)
* externaldns * memcache * pgbouncer * common * rabbitmq * redis
1 parent b1f415e commit 40971da

168 files changed

Lines changed: 21029 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release Charts
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
11+
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
12+
permissions:
13+
contents: write
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Configure Git
22+
run: |
23+
git config user.name "$GITHUB_ACTOR"
24+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
25+
26+
- name: Install Helm
27+
uses: azure/setup-helm@v4
28+
env:
29+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
30+
31+
- name: Run chart-releaser
32+
uses: helm/chart-releaser-action@v1.6.0
33+
env:
34+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

charts/common/.helmignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
24+
# Changelog
25+
CHANGELOG.md
26+
# additional files
27+
README.md
28+
tests/
29+
*.ignore.yaml

charts/common/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog

charts/common/Chart.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: common
2+
# version should be equal to appVersion
3+
version: 0.0.1
4+
appVersion: 0.0.1
5+
apiVersion: v2
6+
description: A library Helm chart for common logic
7+
type: library
8+
sources:
9+
- https://github.com/code-tool/helm-charts/tree/main/charts/common

charts/common/README.md

Lines changed: 391 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
3+
{{/*
4+
Return a soft nodeAffinity definition
5+
{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
6+
*/}}
7+
{{- define "common.affinities.nodes.soft" -}}
8+
preferredDuringSchedulingIgnoredDuringExecution:
9+
- preference:
10+
matchExpressions:
11+
- key: {{ .key }}
12+
operator: In
13+
values:
14+
{{- range .values }}
15+
- {{ . | quote }}
16+
{{- end }}
17+
weight: 1
18+
{{- end -}}
19+
20+
{{/*
21+
Return a hard nodeAffinity definition
22+
{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
23+
*/}}
24+
{{- define "common.affinities.nodes.hard" -}}
25+
requiredDuringSchedulingIgnoredDuringExecution:
26+
nodeSelectorTerms:
27+
- matchExpressions:
28+
- key: {{ .key }}
29+
operator: In
30+
values:
31+
{{- range .values }}
32+
- {{ . | quote }}
33+
{{- end }}
34+
{{- end -}}
35+
36+
{{/*
37+
Return a nodeAffinity definition
38+
{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
39+
*/}}
40+
{{- define "common.affinities.nodes" -}}
41+
{{- if eq .type "soft" }}
42+
{{- include "common.affinities.nodes.soft" . -}}
43+
{{- else if eq .type "hard" }}
44+
{{- include "common.affinities.nodes.hard" . -}}
45+
{{- end -}}
46+
{{- end -}}
47+
48+
{{/*
49+
Return a topologyKey definition
50+
{{ include "common.affinities.topologyKey" (dict "topologyKey" "BAR") -}}
51+
*/}}
52+
{{- define "common.affinities.topologyKey" -}}
53+
{{ .topologyKey | default "kubernetes.io/hostname" -}}
54+
{{- end -}}
55+
56+
{{/*
57+
Return a soft podAffinity/podAntiAffinity definition
58+
{{ include "common.affinities.pods.soft" (dict "component" "FOO" "customLabels" .Values.podLabels "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "extraPodAffinityTerms" .Values.extraPodAffinityTerms "extraNamespaces" (list "namespace1" "namespace2") "context" $) -}}
59+
*/}}
60+
{{- define "common.affinities.pods.soft" -}}
61+
{{- $component := default "" .component -}}
62+
{{- $customLabels := default (dict) .customLabels -}}
63+
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
64+
{{- $extraPodAffinityTerms := default (list) .extraPodAffinityTerms -}}
65+
{{- $extraNamespaces := default (list) .extraNamespaces -}}
66+
preferredDuringSchedulingIgnoredDuringExecution:
67+
- podAffinityTerm:
68+
labelSelector:
69+
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" .context )) | nindent 10 }}
70+
{{- if not (empty $component) }}
71+
{{ printf "app.kubernetes.io/component: %s" $component }}
72+
{{- end }}
73+
{{- range $key, $value := $extraMatchLabels }}
74+
{{ $key }}: {{ $value | quote }}
75+
{{- end }}
76+
{{- if $extraNamespaces }}
77+
namespaces:
78+
- {{ .context.Release.Namespace }}
79+
{{- with $extraNamespaces }}
80+
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}
81+
{{- end }}
82+
{{- end }}
83+
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
84+
weight: 1
85+
{{- range $extraPodAffinityTerms }}
86+
- podAffinityTerm:
87+
labelSelector:
88+
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" $.context )) | nindent 10 }}
89+
{{- if not (empty $component) }}
90+
{{ printf "app.kubernetes.io/component: %s" $component }}
91+
{{- end }}
92+
{{- range $key, $value := .extraMatchLabels }}
93+
{{ $key }}: {{ $value | quote }}
94+
{{- end }}
95+
{{- if .namespaces }}
96+
namespaces:
97+
- {{ $.context.Release.Namespace }}
98+
{{- with .namespaces }}
99+
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}
100+
{{- end }}
101+
{{- end }}
102+
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
103+
weight: {{ .weight | default 1 -}}
104+
{{- end -}}
105+
{{- end -}}
106+
107+
{{/*
108+
Return a hard podAffinity/podAntiAffinity definition
109+
{{ include "common.affinities.pods.hard" (dict "component" "FOO" "customLabels" .Values.podLabels "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "extraPodAffinityTerms" .Values.extraPodAffinityTerms "extraNamespaces" (list "namespace1" "namespace2") "context" $) -}}
110+
*/}}
111+
{{- define "common.affinities.pods.hard" -}}
112+
{{- $component := default "" .component -}}
113+
{{- $customLabels := default (dict) .customLabels -}}
114+
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
115+
{{- $extraPodAffinityTerms := default (list) .extraPodAffinityTerms -}}
116+
{{- $extraNamespaces := default (list) .extraNamespaces -}}
117+
requiredDuringSchedulingIgnoredDuringExecution:
118+
- labelSelector:
119+
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" .context )) | nindent 8 }}
120+
{{- if not (empty $component) }}
121+
{{ printf "app.kubernetes.io/component: %s" $component }}
122+
{{- end }}
123+
{{- range $key, $value := $extraMatchLabels }}
124+
{{ $key }}: {{ $value | quote }}
125+
{{- end }}
126+
{{- if $extraNamespaces }}
127+
namespaces:
128+
- {{ .context.Release.Namespace }}
129+
{{- with $extraNamespaces }}
130+
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 6 }}
131+
{{- end }}
132+
{{- end }}
133+
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
134+
{{- range $extraPodAffinityTerms }}
135+
- labelSelector:
136+
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" $.context )) | nindent 8 }}
137+
{{- if not (empty $component) }}
138+
{{ printf "app.kubernetes.io/component: %s" $component }}
139+
{{- end }}
140+
{{- range $key, $value := .extraMatchLabels }}
141+
{{ $key }}: {{ $value | quote }}
142+
{{- end }}
143+
{{- if .namespaces }}
144+
namespaces:
145+
- {{ $.context.Release.Namespace }}
146+
{{- with .namespaces }}
147+
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 6 }}
148+
{{- end }}
149+
{{- end }}
150+
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
151+
{{- end -}}
152+
{{- end -}}
153+
154+
{{/*
155+
Return a podAffinity/podAntiAffinity definition
156+
{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
157+
*/}}
158+
{{- define "common.affinities.pods" -}}
159+
{{- if eq .type "soft" }}
160+
{{- include "common.affinities.pods.soft" . -}}
161+
{{- else if eq .type "hard" }}
162+
{{- include "common.affinities.pods.hard" . -}}
163+
{{- end -}}
164+
{{- end -}}

0 commit comments

Comments
 (0)