Skip to content

Commit

Permalink
test: add chart testing and relevant ci
Browse files Browse the repository at this point in the history
Signed-off-by: Zespre Schmidt <[email protected]>
  • Loading branch information
starbops committed Dec 31, 2024
1 parent 7add229 commit ff37587
Show file tree
Hide file tree
Showing 18 changed files with 94 additions and 134 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/chart-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Chart CI

on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
check-latest: true
- name: Set up chart-testing
uses: helm/chart-testing-action@v2
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --chart-dirs deploy/charts/ --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --chart-dirs deploy/charts/ --charts deploy/charts/kubevirtbmc
- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1
- name: Install cert-manager
if: steps.list-changed.outputs.changed == 'true'
run: helm install cert-manager cert-manager --repo=https://charts.jetstack.io --namespace=cert-manager --create-namespace --version=v1.14.2 --set=installCRDs=true --wait
- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --chart-dirs deploy/charts/ --charts deploy/charts/kubevirtbmc
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: lint-test
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1
with:
charts_dir: deploy/charts
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
22 changes: 0 additions & 22 deletions chart/templates/NOTES.txt

This file was deleted.

43 changes: 0 additions & 43 deletions chart/templates/ingress.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions chart/templates/tests/test-connection.yaml

This file was deleted.

File renamed without changes.
9 changes: 4 additions & 5 deletions chart/Chart.yaml → deploy/charts/kubevirtbmc/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
apiVersion: v2
name: kubevirtbmc
version: 0.0.0-dev
description: A Helm chart for KubeVirtBMC
type: application
keywords:
- kubernetes
- kubevirt
- ipmi
- redfish
- Kubernetes
- KubeVirt
- IPMI
- Redfish
home: https://github.com/starbops/kubevirtbmc
sources:
- https://github.com/starbops/kubevirtbmc
Expand Down
1 change: 1 addition & 0 deletions deploy/charts/kubevirtbmc/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
KubeVirtBMC is installed successfully. You can now create virtual machines with BMC support.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ roleRef:
name: {{ include "chart.name" . }}-vm-watcher
subjects:
- kind: ServiceAccount
name: {{ include "chart.name" . }}-manager
name: {{ include "chart.serviceAccountName" . }}-manager
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -226,7 +226,7 @@ roleRef:
name: {{ include "chart.name" . }}-proxy-role
subjects:
- kind: ServiceAccount
name: {{ include "chart.name" . }}-manager
name: {{ include "chart.serviceAccountName" . }}-manager
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -243,7 +243,7 @@ roleRef:
name: {{ include "chart.name" . }}-pod-svc-manager
subjects:
- kind: ServiceAccount
name: {{ include "chart.name" . }}-manager
name: {{ include "chart.serviceAccountName" . }}-manager
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -260,7 +260,7 @@ roleRef:
name: {{ include "chart.name" . }}-vmbmc-manager
subjects:
- kind: ServiceAccount
name: {{ include "chart.name" . }}-manager
name: {{ include "chart.serviceAccountName" . }}-manager
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -304,5 +304,5 @@ roleRef:
name: {{ include "chart.name" . }}-leader-election-role
subjects:
- kind: ServiceAccount
name: {{ include "chart.name" . }}-manager
name: {{ include "chart.serviceAccountName" . }}-manager
namespace: {{ .Release.Namespace }}
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
apiVersion: v1
kind: Service
metadata:
labels:
{{- include "chart.labels" . | nindent 4 }}
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/part-of: {{ include "chart.name" . }}
name: {{ include "chart.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "chart.selectorLabels" . | nindent 4 }}
---
apiVersion: v1
kind: Service
metadata:
labels:
{{- include "chart.labels" . | nindent 4 }}
Expand All @@ -29,7 +10,7 @@ metadata:
spec:
ports:
- name: https
port: 8443
port: {{ .Values.service.metricsPort }}
protocol: TCP
targetPort: metrics-server
selector:
Expand All @@ -46,8 +27,9 @@ metadata:
namespace: {{ .Release.Namespace }}
spec:
ports:
- port: 443
- name: https
port: {{ .Values.service.webhookPort }}
protocol: TCP
targetPort: 9443
targetPort: webhook-server
selector:
{{- include "chart.selectorLabels" . | nindent 6 }}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.serviceMonitor.create -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand All @@ -18,3 +19,4 @@ spec:
selector:
matchLabels:
{{- include "chart.selectorLabels" . | nindent 6 }}
{{- end }}
File renamed without changes.
27 changes: 5 additions & 22 deletions chart/values.yaml → deploy/charts/kubevirtbmc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,9 @@ securityContext:
# runAsNonRoot: true
# runAsUser: 1000

# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/
service:
# This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
type: ClusterIP
# This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports
port: 80

# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
metricsPort: 8443
webhookPort: 443

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
Expand Down Expand Up @@ -127,3 +107,6 @@ nodeSelector: {}
tolerations: []

affinity: {}

serviceMonitor:
create: false

0 comments on commit ff37587

Please sign in to comment.