Skip to content

Commit

Permalink
feat(whoami): use latest best practices (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien-prudhomme authored Nov 12, 2024
1 parent ad5e506 commit fbf7796
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 34 deletions.
6 changes: 3 additions & 3 deletions charts/whoami/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 1.10.1
appVersion: 1.10.3
description: Tiny Go webserver that prints os information and HTTP request to output
home: https://github.com/traefik/whoami
maintainers:
Expand All @@ -9,10 +9,10 @@ name: whoami
sources:
- https://github.com/traefik/whoami
- https://github.com/cowboysysop/charts/tree/master/charts/whoami
version: 5.1.2
version: 5.2.0
dependencies:
- name: common
version: 2.9.0
version: 2.21.0
repository: https://charts.bitnami.com/bitnami/
annotations:
artifacthub.io/signKey: |
Expand Down
20 changes: 18 additions & 2 deletions charts/whoami/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ The command deletes the release named `my-release` and frees all the kubernetes
| `replicaCount` | Number of replicas | `1` |
| `image.registry` | Image registry | `docker.io` |
| `image.repository` | Image repository | `traefik/whoami` |
| `image.tag` | Image tag | `v1.10.1` |
| `image.tag` | Image tag | `v1.10.3` |
| `image.digest` | Image digest | `""` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `pdb.create` | Specifies whether a pod disruption budget should be created | `false` |
Expand All @@ -117,10 +117,14 @@ The command deletes the release named `my-release` and frees all the kubernetes
| `serviceAccount.create` | Specifies whether a service account should be created | `true` |
| `serviceAccount.annotations` | Service account annotations | `{}` |
| `serviceAccount.name` | The name of the service account to use (Generated using the `whoami.fullname` template if not set) | `nil` |
| `hostAliases` | Pod host aliases | `[]` |
| `deploymentAnnotations` | Additional deployment annotations | `{}` |
| `podAnnotations` | Additional pod annotations | `{}` |
| `podLabels` | Additional pod labels | `{}` |
| `podSecurityContext` | Pod security context | `{}` |
| `priorityClassName` | Priority class name | `nil` |
| `runtimeClassName` | Runtime class name | `""` |
| `topologySpreadConstraints` | Topology Spread Constraints for pod assignment | `[]` |
| `securityContext` | Container security context | `{}` |
| `containerPorts.http` | Container port for HTTP | `80` |
| `livenessProbe.enabled` | Enable liveness probe | `true` |
Expand All @@ -144,6 +148,10 @@ The command deletes the release named `my-release` and frees all the kubernetes
| `service.annotations` | Service annotations | `{}` |
| `service.type` | Service type | `ClusterIP` |
| `service.clusterIP` | Static cluster IP address or None for headless service when service type is ClusterIP | `nil` |
| `service.ipFamilyPolicy` | Service IP family policy | `""` |
| `service.ipFamilies` | Service IP families | `[]` |
| `service.sessionAffinity` | Control where client requests go, to the same pod or round-robin | `None` |
| `service.sessionAffinityConfig` | Additional settings for the sessionAffinity | `{}` |
| `service.loadBalancerIP` | Static load balancer IP address when service type is LoadBalancer | `nil` |
| `service.loadBalancerSourceRanges` | Source IP address ranges when service type is LoadBalancer | `nil` |
| `service.externalTrafficPolicy` | External traffic routing policy when service type is LoadBalancer or NodePort | `Cluster` |
Expand All @@ -164,14 +172,16 @@ The command deletes the release named `my-release` and frees all the kubernetes
| `extraEnvVars` | Additional container environment variables | `[]` |
| `extraEnvVarsCM` | Name of existing ConfigMap containing additional container environment variables | `nil` |
| `extraEnvVarsSecret` | Name of existing Secret containing additional container environment variables | `nil` |
| `extraVolumes` | Optionally specify extra list of additional volumes | `[]` |
| `extraVolumeMounts` | Optionally specify extra list of additional volumeMounts | `[]` |

### Tests parameters

| Name | Description | Default |
| ------------------------ | ----------------- | -------------------- |
| `tests.image.registry` | Image registry | `ghcr.io` |
| `tests.image.repository` | Image repository | `cowboysysop/pytest` |
| `tests.image.tag` | Image tag | `1.0.35` |
| `tests.image.tag` | Image tag | `1.0.41` |
| `tests.image.digest` | Image digest | `""` |
| `tests.image.pullPolicy` | Image pull policy | `IfNotPresent` |

Expand All @@ -194,3 +204,9 @@ $ helm install my-release \
```

**TIP**: You can use the default [values.yaml](values.yaml).

## License

The source code of this chart is under [MIT License](LICENSE).

It also uses source code under Apache 2.0 License from the [Bitnami repository](https://github.com/bitnami/charts).
23 changes: 20 additions & 3 deletions charts/whoami/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ metadata:
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations:
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- if or .Values.deploymentAnnotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.deploymentAnnotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
Expand Down Expand Up @@ -37,10 +37,19 @@ spec:
{{- end }}
spec:
{{- include "common.images.pullSecrets" ( dict "images" ( list .Values.image ) "global" .Values.global ) | nindent 6 }}
{{- if .Values.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
{{- if .Values.runtimeClassName }}
runtimeClassName: {{ .Values.runtimeClassName | quote }}
{{- end }}
serviceAccountName: {{ include "whoami.serviceAccountName" . }}
{{- if .Values.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
Expand Down Expand Up @@ -111,6 +120,10 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
{{- if .Values.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand All @@ -123,3 +136,7 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- if .Values.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
{{- end }}
11 changes: 3 additions & 8 deletions charts/whoami/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.ingress.enabled -}}
{{- if .Values.ingress.enabled }}
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
Expand All @@ -9,13 +9,8 @@ metadata:
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.ingress.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.ingress.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.ingress.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.ingress.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
Expand Down
3 changes: 1 addition & 2 deletions charts/whoami/templates/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ metadata:
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations:
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.pdb.minAvailable }}
Expand Down
23 changes: 15 additions & 8 deletions charts/whoami/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@ metadata:
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.service.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.service.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
{{- if and (eq .Values.service.type "ClusterIP") .Values.service.clusterIP }}
clusterIP: {{ .Values.service.clusterIP }}
{{- end }}
{{- if .Values.service.ipFamilyPolicy }}
ipFamilyPolicy: {{ .Values.service.ipFamilyPolicy }}
{{- end }}
{{- if not (empty .Values.service.ipFamilies)}}
ipFamilies: {{- toYaml .Values.service.ipFamilies | nindent 4 }}
{{- end }}
{{- if .Values.service.sessionAffinity }}
sessionAffinity: {{ .Values.service.sessionAffinity }}
{{- end }}
{{- if .Values.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
Expand All @@ -29,7 +36,7 @@ spec:
{{- toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
{{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
{{- end }}
ports:
- port: {{ .Values.service.ports.http }}
Expand Down
9 changes: 2 additions & 7 deletions charts/whoami/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ metadata:
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.serviceAccount.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.serviceAccount.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.serviceAccount.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end -}}
32 changes: 31 additions & 1 deletion charts/whoami/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ serviceAccount:
## @param serviceAccount.name The name of the service account to use (Generated using the `whoami.fullname` template if not set)
name:

## @param hostAliases Pod host aliases
hostAliases: []

## @param deploymentAnnotations Additional deployment annotations
deploymentAnnotations: {}

## @param podAnnotations Additional pod annotations
podAnnotations: {}

Expand All @@ -87,6 +93,12 @@ podSecurityContext: {}
priorityClassName:
# priorityClassName : high-priority

## @param runtimeClassName Runtime class name
runtimeClassName: ""

## @param topologySpreadConstraints Topology Spread Constraints for pod assignment
topologySpreadConstraints: []

## @param securityContext Container security context
securityContext: {}
# capabilities:
Expand Down Expand Up @@ -168,6 +180,18 @@ service:
clusterIP:
# clusterIP: 10.43.0.100

## @param service.ipFamilyPolicy Service IP family policy
ipFamilyPolicy: ""

## @param service.ipFamilies Service IP families
ipFamilies: []

## @param service.sessionAffinity Control where client requests go, to the same pod or round-robin
sessionAffinity: None

## @param service.sessionAffinityConfig Additional settings for the sessionAffinity
sessionAffinityConfig: {}

## @param service.loadBalancerIP Static load balancer IP address when service type is LoadBalancer
loadBalancerIP:
# loadBalancerIP: 10.0.0.100
Expand Down Expand Up @@ -249,6 +273,12 @@ extraEnvVarsCM:
## @param extraEnvVarsSecret Name of existing Secret containing additional container environment variables
extraEnvVarsSecret:

## @param extraVolumes Optionally specify extra list of additional volumes
extraVolumes: []

## @param extraVolumeMounts Optionally specify extra list of additional volumeMounts
extraVolumeMounts: []

## @section Tests parameters

tests:
Expand All @@ -260,7 +290,7 @@ tests:
repository: cowboysysop/pytest

## @param tests.image.tag Image tag
tag: 1.0.35
tag: 1.0.41

## @param tests.image.digest Image digest
digest: ""
Expand Down

0 comments on commit fbf7796

Please sign in to comment.