Skip to content

Commit c6720c7

Browse files
authored
feat: Add helm chart (#10)
1 parent a0cb8a9 commit c6720c7

36 files changed

+409
-283
lines changed

.github/workflows/checks.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ jobs:
5252
with:
5353
asdf_branch: v0.11.0
5454

55-
- name: Set up QEMU
56-
uses: docker/setup-qemu-action@v2
57-
with:
58-
platforms: arm64
59-
6055
- name: Run e2e tests
6156
run: make e2e-test
6257
env:
@@ -99,6 +94,14 @@ jobs:
9994
with:
10095
shfmt-version: ${{ fromJson(steps.versions.outputs.tools).shfmt }}
10196

97+
- name: Install asdf
98+
uses: asdf-vm/actions/setup@master
99+
with:
100+
asdf_branch: v0.11.0
101+
102+
- name: Install helm-docs
103+
run: make install-tool.helm-docs
104+
102105
- uses: pre-commit/[email protected]
103106
with:
104107
extra_args: --all-files --show-diff-on-failure

.github/workflows/goreleaser.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
uses: actions/setup-go@v3
4444
with:
4545
go-version: ${{ fromJson(steps.versions.outputs.tools).golang }}
46+
check-latest: false
4647
cache: true
4748

4849
- name: Run goreleaser

.pre-commit-config.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ repos:
2222
- id: check-yaml
2323
args: ["-m", "--unsafe"]
2424
stages: [commit]
25+
exclude: ^charts/.+/templates/
2526
- id: mixed-line-ending
2627
args: ["-f", "lf"]
2728
exclude: \.bat$
@@ -58,13 +59,13 @@ repos:
5859
hooks:
5960
- id: shellcheck
6061
stages: [commit]
61-
args: ["-e", "SC2211"]
62+
args: ["-e", "SC2211", "-x"]
6263
- repo: https://github.com/igorshubovych/markdownlint-cli
6364
rev: v0.33.0
6465
hooks:
6566
- id: markdownlint
6667
stages: [commit]
67-
exclude: ^CHANGELOG.md$
68+
exclude: ^(CHANGELOG.md|charts/.+/README.md)$
6869
- repo: https://github.com/Lucas-C/pre-commit-hooks
6970
rev: v1.4.2
7071
hooks:
@@ -84,6 +85,7 @@ repos:
8485
args:
8586
- --license-filepath
8687
- header.txt
88+
exclude: ^pkg/addons/templates/.+\.yaml$
8789
- id: insert-license
8890
name: License headers - Markdown
8991
stages: [commit]
@@ -94,3 +96,10 @@ repos:
9496
- header.txt
9597
- --comment-style
9698
- <!--|| -->
99+
- repo: https://github.com/norwoodj/helm-docs
100+
rev: v1.2.0
101+
hooks:
102+
- id: helm-docs
103+
args:
104+
# Make the tool search for charts only under the `example-charts` directory
105+
- --chart-search-root=charts

.tool-versions

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
clusterctl 1.3.3
2+
gcloud 416.0.0
3+
gcloud 416.0.0
14
ginkgo 2.8.0
25
gojq 0.12.11
36
golang 1.19.5
47
golangci-lint 1.50.1
58
goreleaser 1.15.0
69
helm 3.11.0
10+
helm-docs 1.11.0
711
kube-controller-tools 0.11.2
12+
kubectl 1.26.1
813
kustomize 4.5.7
914
pre-commit 3.0.2
1015
shfmt 3.6.0
1116
upx 4.0.2
12-
gcloud 416.0.0
13-
kubectl 1.26.1
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2023 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: v1
5+
6+
name: capi-runtime-extensions
7+
type: application
8+
description: A Helm chart for capi-runtime-extensions
9+
10+
home: https://github.com/d2iq-labs/capi-runtime-extensions
11+
maintainers:
12+
- name: Jimmi Dyson
13+
14+
url: https://eng.d2iq.com
15+
sources:
16+
- https://github.com/d2iq-labs/capi-runtime-extensions
17+
18+
appVersion: v0.0.0-dev
19+
version: v0.0.0-dev
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!--
2+
Copyright 2023 D2iQ, Inc. All rights reserved.
3+
SPDX-License-Identifier: Apache-2.0
4+
-->
5+
6+
# capi-runtime-extensions
7+
8+
![Version: v0.0.0-dev](https://img.shields.io/badge/Version-v0.0.0--dev-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.0.0-dev](https://img.shields.io/badge/AppVersion-v0.0.0--dev-informational?style=flat-square)
9+
10+
A Helm chart for capi-runtime-extensions
11+
12+
**Homepage:** <https://github.com/d2iq-labs/capi-runtime-extensions>
13+
14+
## Maintainers
15+
16+
| Name | Email | Url |
17+
| ---- | ------ | --- |
18+
| Jimmi Dyson | <[email protected]> | <https://eng.d2iq.com> |
19+
20+
## Source Code
21+
22+
* <https://github.com/d2iq-labs/capi-runtime-extensions>
23+
24+
## Values
25+
26+
| Key | Type | Default | Description |
27+
|-----|------|---------|-------------|
28+
| certificate.issuer.kind | string | `"Issuer"` | |
29+
| certificate.issuer.name | string | `nil` | |
30+
| certificate.issuer.selfSigned | bool | `true` | |
31+
| env | object | `{}` | |
32+
| image.pullPolicy | string | `"IfNotPresent"` | |
33+
| image.repository | string | `"ghcr.io/d2iq-labs/capi-runtime-extensions"` | |
34+
| image.tag | string | `nil` | |
35+
| imagePullSecrets | list | `[]` | Optional secrets used for pulling the container image |
36+
| nodeSelector | object | `{}` | |
37+
| priorityClassName | string | `""` | Optional priority class to be used for the pod. |
38+
| resources.limits.cpu | string | `"100m"` | |
39+
| resources.limits.memory | string | `"256Mi"` | |
40+
| resources.requests.cpu | string | `"100m"` | |
41+
| resources.requests.memory | string | `"128Mi"` | |
42+
| securityContext.runAsUser | int | `65532` | |
43+
| service.annotations | object | `{}` | |
44+
| service.port | int | `443` | |
45+
| service.type | string | `"ClusterIP"` | |
46+
| tolerations | list | `[]` | |
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--
2+
Copyright 2023 D2iQ, Inc. All rights reserved.
3+
SPDX-License-Identifier: Apache-2.0
4+
-->
5+
6+
{{ template "chart.header" . }}
7+
{{ template "chart.deprecationWarning" . }}
8+
9+
{{ template "chart.badgesSection" . }}
10+
11+
{{ template "chart.description" . }}
12+
13+
{{ template "chart.homepageLine" . }}
14+
15+
{{ template "chart.maintainersSection" . }}
16+
17+
{{ template "chart.sourcesSection" . }}
18+
19+
{{ template "chart.requirementsSection" . }}
20+
21+
{{ template "chart.valuesSection" . }}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "chart.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create chart name and version as used by the chart label.
11+
*/}}
12+
{{- define "chart.fullname" -}}
13+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
14+
{{- end -}}
15+
16+
{{/*
17+
Common labels
18+
*/}}
19+
{{- define "chart.labels" -}}
20+
app.kubernetes.io/name: {{ include "chart.name" . }}
21+
helm.sh/chart: {{ include "chart.fullname" . }}
22+
app.kubernetes.io/instance: {{ .Release.Name }}
23+
{{- if .Chart.AppVersion }}
24+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
25+
{{- end }}
26+
app.kubernetes.io/managed-by: {{ .Release.Service }}
27+
{{- end -}}
28+
29+
{{/*
30+
Selector labels
31+
*/}}
32+
{{- define "chart.selectorLabels" -}}
33+
app.kubernetes.io/name: {{ include "chart.name" . }}
34+
app.kubernetes.io/instance: {{ .Release.Name }}
35+
{{- end }}
36+
37+
{{/*
38+
Certificate issuer name
39+
*/}}
40+
{{- define "chart.issuerName" -}}
41+
{{- if .Values.certificate.issuer.selfSigned -}}
42+
{{- if .Values.certificate.issuer.name -}}
43+
{{ .Values.certificate.issuer.name }}
44+
{{- else -}}
45+
{{ template "chart.name" . }}-issuer
46+
{{- end -}}
47+
{{- else -}}
48+
{{ required "A valid .Values.certificates.issuer.name is required!" .Values.certificate.issuer.name }}
49+
{{- end -}}
50+
{{- end -}}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2023 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: cert-manager.io/v1
5+
kind: Certificate
6+
metadata:
7+
name: {{ template "chart.name" . }}-tls
8+
namespace: {{ .Release.Namespace }}
9+
labels:
10+
{{- include "chart.labels" . | nindent 4 }}
11+
spec:
12+
dnsNames:
13+
- {{ template "chart.name" . }}.{{ .Release.Namespace }}.svc
14+
- {{ template "chart.name" . }}.{{ .Release.Namespace }}.svc.cluster.local
15+
issuerRef:
16+
kind: {{ .Values.certificate.issuer.kind }}
17+
name: {{ template "chart.issuerName" . }}
18+
secretName: {{ template "chart.name" . }}-tls
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2023 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
kind: ClusterRole
5+
apiVersion: rbac.authorization.k8s.io/v1
6+
metadata:
7+
labels:
8+
{{ include "chart.labels" . | indent 4 }}
9+
name: {{ include "chart.name" . }}
10+
rules:
11+
- apiGroups: [""]
12+
resources: ["secrets"]
13+
verbs: ["watch", "list", "get"]
14+
- apiGroups:
15+
- addons.cluster.x-k8s.io
16+
- bootstrap.cluster.x-k8s.io
17+
- clusterctl.cluster.x-k8s.io
18+
- controlplane.cluster.x-k8s.io
19+
- infrastructure.cluster.x-k8s.io
20+
- ipam.cluster.x-k8s.io
21+
- runtime.cluster.x-k8s.io
22+
resources: ["*"]
23+
verbs: ["watch", "list", "get"]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2023 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
kind: ClusterRoleBinding
5+
apiVersion: rbac.authorization.k8s.io/v1
6+
metadata:
7+
labels:
8+
{{ include "chart.labels" . | indent 4 }}
9+
name: {{ include "chart.name" . }}
10+
roleRef:
11+
apiGroup: rbac.authorization.k8s.io
12+
kind: ClusterRole
13+
name: {{ include "chart.name" . }}
14+
subjects:
15+
- kind: ServiceAccount
16+
name: {{ include "chart.name" . }}
17+
namespace: {{ .Release.Namespace }}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Copyright 2023 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
apiVersion: apps/v1
4+
kind: Deployment
5+
metadata:
6+
labels:
7+
{{- include "chart.labels" . | nindent 4 }}
8+
name: {{ template "chart.name" . }}
9+
namespace: {{ .Release.Namespace }}
10+
spec:
11+
replicas: 1
12+
selector:
13+
matchLabels:
14+
{{- include "chart.selectorLabels" . | nindent 6 }}
15+
template:
16+
metadata:
17+
labels:
18+
{{- include "chart.selectorLabels" . | nindent 8 }}
19+
spec:
20+
nodeSelector:
21+
{{- toYaml .Values.commonNodeSelector | nindent 8 }}
22+
tolerations:
23+
{{- toYaml .Values.commonTolerations | nindent 8 }}
24+
serviceAccountName: {{ template "chart.name" . }}
25+
terminationGracePeriodSeconds: 10
26+
containers:
27+
- name: webhook
28+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default $.Chart.AppVersion }}"
29+
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
30+
{{- if .Values.env }}
31+
env:
32+
{{- range $key, $value := .Values.env }}
33+
- name: "{{ $key }}"
34+
value: "{{ $value }}"
35+
{{- end }}
36+
{{- end }}
37+
args:
38+
- --webhook-cert-dir=/certs/
39+
{{- range $key, $value := .Values.extraArgs }}
40+
- --{{ $key }}={{ $value }}
41+
{{- end }}
42+
ports:
43+
- containerPort: 9443
44+
name: https
45+
protocol: TCP
46+
resources:
47+
{{ with .Values.resources }}
48+
{{- toYaml . | nindent 10 }}
49+
{{- end }}
50+
volumeMounts:
51+
- mountPath: /certs
52+
name: cert
53+
readOnly: true
54+
# livenessProbe:
55+
# httpGet:
56+
# port: 9443
57+
# scheme: HTTPS
58+
# path: /healthz
59+
# readinessProbe:
60+
# httpGet:
61+
# port: 9443
62+
# scheme: HTTPS
63+
# path: /readyz
64+
securityContext:
65+
{{ with .Values.securityContext }}
66+
{{- toYaml . | nindent 8}}
67+
{{- end }}
68+
volumes:
69+
- name: cert
70+
secret:
71+
defaultMode: 420
72+
secretName: {{ template "chart.name" . }}-tls
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2023 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: runtime.cluster.x-k8s.io/v1alpha1
5+
kind: ExtensionConfig
6+
metadata:
7+
annotations:
8+
runtime.cluster.x-k8s.io/inject-ca-from-secret: {{ .Release.Namespace }}/{{ template "chart.name" . }}-tls
9+
name: {{ template "chart.name" . }}
10+
namespace: {{ .Release.Namespace }}
11+
spec:
12+
clientConfig:
13+
service:
14+
name: {{ template "chart.name" . }}
15+
namespace: {{ .Release.Namespace }}
16+
port: {{ .Values.service.port }}

0 commit comments

Comments
 (0)