Skip to content

Commit 8c8dfdd

Browse files
Merge pull request #7 from Infisical/misc/add-helm-chart-for-pki-issuer
misc: add helm chart for pki issuer
2 parents e47d56d + 868c657 commit 8c8dfdd

25 files changed

Lines changed: 899 additions & 7 deletions
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release Infisical PKI Issuer Helm Chart
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
test-helm:
7+
name: Test Helm Chart
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Set up Helm
16+
uses: azure/setup-helm@v4.2.0
17+
with:
18+
version: v3.17.0
19+
20+
- uses: actions/setup-python@v5.3.0
21+
with:
22+
python-version: "3.x"
23+
check-latest: true
24+
25+
- name: Set up chart-testing
26+
uses: helm/chart-testing-action@v2.7.0
27+
28+
- name: Run chart-testing (lint)
29+
run: ct lint --config ct.yaml --charts helm-charts/infisical-pki-issuer
30+
31+
- name: Create kind cluster
32+
uses: helm/kind-action@v1.12.0
33+
34+
- name: Run chart-testing (install)
35+
run: ct install --config ct.yaml --charts helm-charts/infisical-pki-issuer
36+
37+
release-helm:
38+
name: Release Helm Chart
39+
needs: test-helm
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v2
44+
45+
- name: Install Helm
46+
uses: azure/setup-helm@v3
47+
with:
48+
version: v3.10.0
49+
50+
- name: Install python
51+
uses: actions/setup-python@v4
52+
53+
- name: Install Cloudsmith CLI
54+
run: pip install --upgrade cloudsmith-cli
55+
56+
- name: Build and push helm package to CloudSmith
57+
run: cd helm-charts && sh upload-infisical-pki-issuer-chart.sh
58+
env:
59+
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Run Helm Chart Tests for Infisical PKI Issuer
2+
on:
3+
pull_request:
4+
paths:
5+
- "helm-charts/infisical-pki-issuer/**"
6+
- ".github/workflows/run-helm-chart-tests.yaml"
7+
8+
jobs:
9+
test-helm:
10+
name: Test Helm Chart
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Helm
19+
uses: azure/setup-helm@v4.2.0
20+
with:
21+
version: v3.17.0
22+
23+
- uses: actions/setup-python@v5.3.0
24+
with:
25+
python-version: "3.x"
26+
check-latest: true
27+
28+
- name: Set up chart-testing
29+
uses: helm/chart-testing-action@v2.7.0
30+
31+
- name: Run chart-testing (lint)
32+
run: ct lint --config ct.yaml --charts helm-charts/infisical-pki-issuer
33+
34+
- name: Create kind cluster
35+
uses: helm/kind-action@v1.12.0
36+
37+
- name: Run chart-testing (install)
38+
run: ct install --config ct.yaml --charts helm-charts/infisical-pki-issuer

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,13 @@ deploy: ${INSTALL_YAML} ## Deploy controller to the K8s cluster specified in ~/
198198
undeploy: ${INSTALL_YAML} ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
199199
kubectl delete -f ${INSTALL_YAML} --ignore-not-found=$(ignore-not-found)
200200

201+
##@ Helm Chart
202+
203+
.PHONY: helm-chart
204+
helm-chart: manifests kustomize helmify ## Generate Helm chart
205+
mkdir -p helm-charts/infisical-pki-issuer
206+
$(KUSTOMIZE) build config/default | $(HELMIFY) helm-charts/infisical-pki-issuer
207+
201208
##@ Build Dependencies
202209

203210
LOCAL_OS := $(shell go env GOOS)
@@ -213,6 +220,7 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
213220
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
214221
ENVTEST ?= $(LOCALBIN)/setup-envtest
215222
KIND ?= $(LOCALBIN)/kind
223+
HELMIFY ?= $(LOCALBIN)/helmify
216224

217225
## Tool Versions
218226
KUSTOMIZE_VERSION ?= v3.8.7
@@ -249,3 +257,8 @@ $(ENVTEST): $(LOCALBIN)
249257
kind: $(LOCALBIN) ## Download Kind locally if necessary.
250258
curl -fsSL -o ${KIND} https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-${LOCAL_OS}-${LOCAL_ARCH}
251259
chmod +x ${KIND}
260+
261+
.PHONY: helmify
262+
helmify: $(HELMIFY) ## Download helmify locally if necessary.
263+
$(HELMIFY): $(LOCALBIN)
264+
test -s $(LOCALBIN)/helmify || GOBIN=$(LOCALBIN) go install github.com/arttor/helmify/cmd/helmify@latest

build/install.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ metadata:
553553
app.kubernetes.io/managed-by: kustomize
554554
app.kubernetes.io/name: infisical-issuer
555555
control-plane: controller-manager
556-
name: infisical-issuer-controller-manager-metrics-service
556+
name: infisical-issuer-metrics
557557
namespace: infisical-issuer-system
558558
spec:
559559
ports:

config/default/metrics_service.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ metadata:
55
control-plane: controller-manager
66
app.kubernetes.io/name: infisical-issuer
77
app.kubernetes.io/managed-by: kustomize
8-
name: controller-manager-metrics-service
8+
name: controller-metrics
99
namespace: system
1010
spec:
1111
ports:
12-
- name: https
13-
port: 8443
14-
protocol: TCP
15-
targetPort: 8443
12+
- name: https
13+
port: 8443
14+
protocol: TCP
15+
targetPort: 8443
1616
selector:
1717
control-plane: controller-manager

config/manager/kustomization.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
resources:
2-
- manager.yaml
2+
- manager.yaml
3+
apiVersion: kustomize.config.k8s.io/v1beta1
4+
kind: Kustomization
5+
images:
6+
- name: controller
7+
newName: docker.io/infisical/pki-issuer
8+
newTag: latest

ct.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Chart testing configuration
2+
chart-dirs:
3+
- helm-charts
4+
5+
# Test against these Kubernetes versions
6+
kube-versions:
7+
- v1.30.0
8+
- v1.31.0
9+
- v1.32.0
10+
- v1.33.0
11+
12+
validate-maintainers: false
13+
14+
kubectl-timeout: 300s
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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/
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v2
2+
name: infisical-pki-issuer
3+
description: A Helm chart for Infisical PKI Issuer
4+
# A chart can be either an 'application' or a 'library' chart.
5+
#
6+
# Application charts are a collection of templates that can be packaged into versioned archives
7+
# to be deployed.
8+
#
9+
# Library charts provide useful utilities or functions for the chart developer. They're included as
10+
# a dependency of application charts to inject those utilities and functions into the rendering
11+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
12+
type: application
13+
# This is the chart version. This version number should be incremented each time you make changes
14+
# to the chart and its templates, including the app version.
15+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16+
version: 0.1.0
17+
# This is the version number of the application being deployed. This version number should be
18+
# incremented each time you make changes to the application. Versions are not expected to
19+
# follow Semantic Versioning. They should reflect the version the application is using.
20+
# It is recommended to use it with quotes.
21+
appVersion: "0.1.0"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "infisical-pki-issuer.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "infisical-pki-issuer.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "infisical-pki-issuer.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "infisical-pki-issuer.labels" -}}
37+
helm.sh/chart: {{ include "infisical-pki-issuer.chart" . }}
38+
{{ include "infisical-pki-issuer.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "infisical-pki-issuer.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "infisical-pki-issuer.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "infisical-pki-issuer.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "infisical-pki-issuer.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}

0 commit comments

Comments
 (0)