Skip to content

Commit

Permalink
Enabling github Action for linting and releasing Charts
Browse files Browse the repository at this point in the history
  • Loading branch information
Farnaz Babaeian committed Mar 1, 2024
1 parent c6e00ea commit 3dfe5ed
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 20 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/charts-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Lint and Test Charts
on:
pull_request:
paths:
- 'charts/**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.14.1

- uses: actions/setup-python@v4
with:
python-version: '3.10'
check-latest: true

# see example https://github.com/helm/chart-testing-action
- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/[email protected]

- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }}
34 changes: 34 additions & 0 deletions .github/workflows/charts-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release Charts

on:
push:
branches:
- main
paths:
- 'charts/**'

jobs:
release:
permissions:
contents: write

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Run chart-releaser
uses: helm/[email protected]
with:
version: v1.6.0
charts_dir: charts
env:
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CR_GENERATE_RELEASE_NOTES: true
22 changes: 22 additions & 0 deletions .helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
25 changes: 7 additions & 18 deletions charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
apiVersion: v2
name: cloud-controller-manager
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.0.0
appVersion: 1.0.0
sources:
- https://github.com/FarnazBGH/helm
keywords:
- cloudControlerManger
- cloudProvider
- cloudStack
13 changes: 11 additions & 2 deletions charts/templates/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ metadata:
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
type: {{ .Values.strategy.type }}
{{- if eq .Values.strategy.type "RollingUpdate" }}
rollingUpdate:
maxUnavailable: {{ .Values.strategy.rollingUpdate.maxUnavailable }}
maxSurge: {{ .Values.strategy.rollingUpdate.maxSurge }}
{{- end }}
revisionHistoryLimit: 2
selector:
matchLabels:
Expand Down Expand Up @@ -98,8 +105,10 @@ spec:
{{- if .Values.extraInitContainers }}
initContainers: {{ toYaml .Values.extraInitContainers | nindent 6 }}
{{- end }}
hostNetwork: true
{{- if .Values.priorityClassName }}
hostNetwork: {{ .Values.hostNetwork}}
{{- if .Values.hostNetwork }}
dnsPolicy: {{ .Values.dnsPolicy}}
{{- end }} {{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
{{- if or (.Values.extraVolumes) (.Values.secret.enabled) }}
Expand Down
21 changes: 21 additions & 0 deletions charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ nameOverride: ""
## Set number of replicas (If replicaCount set to 1 by default leader-elect will be false)
replicaCount: 1

strategy:
# RollingUpdate strategy replaces old pods with new ones gradually,
# without incurring downtime.
type: RollingUpdate
rollingUpdate:
# maxUnavailable is the maximum number of pods that can be
# unavailable during the update process.
maxUnavailable: 0
# maxSurge is the maximum number of pods that can be
# created over the desired number of pods.
maxSurge: 1

## Annotations to apply to all resources
commonAnnotations: {}
# commonAnnotations:
Expand Down Expand Up @@ -124,6 +136,13 @@ extraVolumeMounts: []
# mountPath: /etc/kubernetes/pki
# readOnly: true

# Using host netwok setting
hostNetwork: true

# "ClusterFirstWithHostNet": For Pods running with hostNetwork, you should explicitly set its DNS policy to "ClusterFirstWithHostNet"
# ref: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy
dnsPolicy: ClusterFirstWithHostNet

# List of controllers should be enabled.
# Use '*' to enable all controllers.
# Prefix a controller with '-' to disable it.
Expand All @@ -137,6 +156,8 @@ enabledControllers:
cluster:
name: kubernetes

# Set ClusterRole name
clusterRoleName: system:cloud-controller-manager

# Set ServiceAccount name
serviceAccountName: cloud-controller-manager

0 comments on commit 3dfe5ed

Please sign in to comment.