Skip to content

Commit

Permalink
Fixed minor issues in shared-library & workflow
Browse files Browse the repository at this point in the history
* Fixed 422 scenario in release workflow when commits not tied to a release are detected in other charts, helm/chart-releaser#111.
* Fixed helm docs rendering of ingress properties showing as json instead of individual values.
* Fixed extra whitespace in copy paste example in each template docs.
* Fixed missing template docs in test connection pod and notes templates.
* Fixed a typo in each template docs.
* Fixed job name not using correct template for naming convention.
* Fixed incorrect indentation for env field in job template, which was 14 instead of 12.
* Removed template.metadata.name field from job because it's not used by k8s, kubernetes/kubernetes#108977.
  • Loading branch information
StevenJDH authored May 6, 2024
1 parent 3b699cf commit 7838232
Show file tree
Hide file tree
Showing 25 changed files with 99 additions and 68 deletions.
1 change: 1 addition & 0 deletions .github/workflows/chart-releaser-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ jobs:
uses: helm/chart-releaser-action@v1
with:
charts_dir: charts
skip_existing: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion charts/shared-library/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type: library
# 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: 0.1.2
version: 0.1.3

# Includes pre-releases to support version schemes used like with AWS EKS as per https://github.com/helm/helm/issues/10375#issuecomment-974203557.
kubeVersion: ">= 1.19.0-0"
Expand Down
8 changes: 4 additions & 4 deletions charts/shared-library/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Shared Library Helm Chart

![Version: 0.1.2](https://img.shields.io/badge/Version-0.1.2-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)
![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)

A contract-based Helm library chart for Kubernetes.

Expand Down Expand Up @@ -32,7 +32,7 @@ In the `Chart.yaml` file of a helm chart project, add the following dependency:
```yaml
dependencies:
- name: shared-library
version: 0.1.2
version: 0.1.3
repository: "https://StevenJDH.github.io/helm-charts"
```
Expand Down Expand Up @@ -91,8 +91,8 @@ helm dep update .
| ingress.annotations | object | `{}` | annotations to be added to the Ingress resource. |
| ingress.className | string | `"nginx"` | className is the name of the Ingress class. |
| ingress.enabled | bool | `true` | Indicates whether or not an Ingress resource is created. |
| ingress.hosts[0] | object | `{"host":"","paths":[{"path":"/","pathType":"Prefix"}]}` | host is the hostname of a request that must match exactly or use a wildcard as the subdomain. |
| ingress.hosts[0].paths[0] | object | `{"path":"/","pathType":"Prefix"}` | path is part of a list of one or more paths that are associated with a backend service. |
| ingress.hosts[0].host | string | `""` | host is the hostname of a request that must match exactly or use a wildcard as the subdomain. |
| ingress.hosts[0].paths[0].path | string | `"/"` | path is part of a list of one or more paths that are associated with a backend service. |
| ingress.hosts[0].paths[0].pathType | string | `"Prefix"` | pathType is a field that can specify how Ingress paths should be matched. Reference [Path types](https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types). |
| ingress.tls | list | `[]` | tls is a list of hosts that needs to explicitly match the host in the rules section. It also contains a secret with references to tls.crt and tls.key to use for TLS. |
| job.annotations | object | `{}` | annotations to be added to the Job resource. |
Expand Down
4 changes: 2 additions & 2 deletions charts/shared-library/example/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ 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: 0.1.2
version: 0.1.3

# 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
Expand All @@ -54,5 +54,5 @@ icon: https://cncf-branding.netlify.app/img/projects/helm/icon/color/helm-icon-c

dependencies:
- name: shared-library
version: 0.1.2
version: 0.1.3
repository: "file://../"
8 changes: 4 additions & 4 deletions charts/shared-library/example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Shared Library Example Helm Chart

![Version: 0.1.2](https://img.shields.io/badge/Version-0.1.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.25.4](https://img.shields.io/badge/AppVersion-1.25.4-informational?style=flat-square)
![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.25.4](https://img.shields.io/badge/AppVersion-1.25.4-informational?style=flat-square)

An example chart using the shared-library.

Expand All @@ -14,7 +14,7 @@ Kubernetes: `>= 1.19.0-0`

| Repository | Name | Version |
|------------|------|---------|
| file://../ | shared-library | 0.1.2 |
| file://../ | shared-library | 0.1.3 |

## Usage example
Prepare the example project:
Expand Down Expand Up @@ -86,8 +86,8 @@ helm upgrade --install my-example . \
| ingress.annotations | object | `{}` | annotations to be added to the Ingress resource. |
| ingress.className | string | `"nginx"` | className is the name of the Ingress class. |
| ingress.enabled | bool | `true` | Indicates whether or not an Ingress resource is created. |
| ingress.hosts[0] | object | `{"host":"","paths":[{"path":"/","pathType":"Prefix"}]}` | host is the hostname of a request that must match exactly or use a wildcard as the subdomain. |
| ingress.hosts[0].paths[0] | object | `{"path":"/","pathType":"Prefix"}` | path is part of a list of one or more paths that are associated with a backend service. |
| ingress.hosts[0].host | string | `""` | host is the hostname of a request that must match exactly or use a wildcard as the subdomain. |
| ingress.hosts[0].paths[0].path | string | `"/"` | path is part of a list of one or more paths that are associated with a backend service. |
| ingress.hosts[0].paths[0].pathType | string | `"Prefix"` | pathType is a field that can specify how Ingress paths should be matched. Reference [Path types](https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types). |
| ingress.tls | list | `[]` | tls is a list of hosts that needs to explicitly match the host in the rules section. It also contains a secret with references to tls.crt and tls.key to use for TLS. |
| job.annotations | object | `{}` | annotations to be added to the Job resource. |
Expand Down
33 changes: 16 additions & 17 deletions charts/shared-library/example/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: NetworkPolicy
metadata:
name: example
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand All @@ -30,7 +30,7 @@ kind: PodDisruptionBudget
metadata:
name: example-pdb
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand All @@ -56,7 +56,7 @@ metadata:
azure.workload.identity/client-id: ""
azure.workload.identity/service-account-token-expiration: "3600"
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand All @@ -69,7 +69,7 @@ kind: Secret
metadata:
name: example-secret
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand All @@ -85,7 +85,7 @@ kind: ConfigMap
metadata:
name: example-config
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand All @@ -100,7 +100,7 @@ kind: Service
metadata:
name: example-svc
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand Down Expand Up @@ -128,9 +128,9 @@ kind: Deployment
metadata:
name: example
annotations:
rollme: "RrAUJ"
rollme: "TmWtR"
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand Down Expand Up @@ -208,7 +208,7 @@ kind: Job
metadata:
name: example-job
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand All @@ -220,9 +220,8 @@ spec:
activeDeadlineSeconds: 120
template:
metadata:
name: example-job
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand All @@ -248,9 +247,9 @@ spec:
apiVersion: batch/v1
kind: CronJob
metadata:
name: example
name: example-cj
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand All @@ -260,7 +259,7 @@ spec:
jobTemplate:
metadata:
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand All @@ -272,7 +271,7 @@ spec:
template:
metadata:
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand Down Expand Up @@ -303,7 +302,7 @@ kind: Ingress
metadata:
name: example-ingress
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand Down Expand Up @@ -331,7 +330,7 @@ metadata:
annotations:
"helm.sh/hook": test
labels:
helm.sh/chart: example-0.1.2
helm.sh/chart: example-0.1.3
app.kubernetes.io/name: example
app.kubernetes.io/instance: example
app.kubernetes.io/version: "1.25.4"
Expand Down
2 changes: 1 addition & 1 deletion charts/shared-library/example/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ spec:
{{- if and (semverCompare ">=1.20.0-0" .Capabilities.KubeVersion.Version) (.Values.service.appProtocol) }}
appProtocol: http
{{- end }}
{{- end -}}
{{- end -}}
*/ -}}
8 changes: 4 additions & 4 deletions charts/shared-library/example/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ ingress:
# kubernetes.io/tls-acme: "true"

hosts:
# -- host is the hostname of a request that must match exactly or use a wildcard as the subdomain.
- host: ""
- # -- host is the hostname of a request that must match exactly or use a wildcard as the subdomain.
host: ""
paths:
# -- path is part of a list of one or more paths that are associated with a backend service.
- path: /
- # -- path is part of a list of one or more paths that are associated with a backend service.
path: /
# -- pathType is a field that can specify how Ingress paths should be matched.
# Reference [Path types](https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types).
pathType: Prefix
Expand Down
10 changes: 10 additions & 0 deletions charts/shared-library/templates/_NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}

{{/*
Generates a NOTES output with useful information for a helm chart.

Usage:
{{- include "shared-library.notes" . }}

Params:
- context - Dict - Required. The context for the template evaluation.
*/}}

{{- define "shared-library.notes" -}}
You have deployed the following release: {{ .Release.Name }}.

Expand Down
4 changes: 2 additions & 2 deletions charts/shared-library/templates/_configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ metadata:
labels:
foo: bar
{{- include "shared-library.labels" . | nindent 4 }}
{{- end -}}
{{- end -}}

Params:
- context - Dict - Requried. The context for the template evaluation.
- context - Dict - Required. The context for the template evaluation.
- overriding named template - String - Required. Definition to merge into the included template.
*/}}

Expand Down
6 changes: 3 additions & 3 deletions charts/shared-library/templates/_cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ metadata:
labels:
foo: bar
{{- include "shared-library.labels" . | nindent 4 }}
{{- end -}}
{{- end -}}

Params:
- context - Dict - Requried. The context for the template evaluation.
- context - Dict - Required. The context for the template evaluation.
- overriding named template - String - Required. Definition to merge into the included template.
*/}}

Expand All @@ -42,7 +42,7 @@ Params:
apiVersion: {{ template "cronjob.apiVersion" . }}
kind: CronJob
metadata:
name: {{ include "shared-library.fullname" . }}
name: {{ include "shared-library.fullname" . }}-cj
{{- with .Values.cronjob.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
4 changes: 2 additions & 2 deletions charts/shared-library/templates/_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ metadata:
labels:
foo: bar
{{- include "shared-library.labels" . | nindent 4 }}
{{- end -}}
{{- end -}}

Params:
- context - Dict - Requried. The context for the template evaluation.
- context - Dict - Required. The context for the template evaluation.
- overriding named template - String - Required. Definition to merge into the included template.
*/}}

Expand Down
4 changes: 2 additions & 2 deletions charts/shared-library/templates/_hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ metadata:
labels:
foo: bar
{{- include "shared-library.labels" . | nindent 4 }}
{{- end -}}
{{- end -}}

Params:
- context - Dict - Requried. The context for the template evaluation.
- context - Dict - Required. The context for the template evaluation.
- overriding named template - String - Required. Definition to merge into the included template.
*/}}

Expand Down
4 changes: 2 additions & 2 deletions charts/shared-library/templates/_ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ metadata:
labels:
foo: bar
{{- include "shared-library.labels" . | nindent 4 }}
{{- end -}}
{{- end -}}

Params:
- context - Dict - Requried. The context for the template evaluation.
- context - Dict - Required. The context for the template evaluation.
- overriding named template - String - Required. Definition to merge into the included template.
*/}}

Expand Down
9 changes: 4 additions & 5 deletions charts/shared-library/templates/_job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ metadata:
labels:
foo: bar
{{- include "shared-library.labels" . | nindent 4 }}
{{- end -}}
{{- end -}}

Params:
- context - Dict - Requried. The context for the template evaluation.
- context - Dict - Required. The context for the template evaluation.
- overriding named template - String - Required. Definition to merge into the included template.
*/}}

{{- define "shared-library.job.tpl" -}}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "shared-library.name" . }}-job
name: {{ include "shared-library.fullname" . }}-job
{{- with .Values.job.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand All @@ -65,7 +65,6 @@ spec:
{{- end }}
template:
metadata:
name: {{ include "shared-library.name" . }}-job
{{- with .Values.job.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
Expand Down Expand Up @@ -110,7 +109,7 @@ spec:
{{- end }}
{{- with .Values.job.extraEnvs }}
env:
{{- toYaml . | nindent 14 }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if or .Values.configMap .Values.secrets }}
envFrom:
Expand Down
4 changes: 2 additions & 2 deletions charts/shared-library/templates/_keda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ metadata:
labels:
foo: bar
{{- include "shared-library.labels" . | nindent 4 }}
{{- end -}}
{{- end -}}

Params:
- context - Dict - Requried. The context for the template evaluation.
- context - Dict - Required. The context for the template evaluation.
- overriding named template - String - Required. Definition to merge into the included template.
*/}}

Expand Down
Loading

0 comments on commit 7838232

Please sign in to comment.