Skip to content

Commit

Permalink
Update chart version to v0.3.2 and refactor templates to use .Values.…
Browse files Browse the repository at this point in the history
…name for consistency
  • Loading branch information
qjoly committed Dec 14, 2024
1 parent 23858e5 commit ae0b3b7
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion charts/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ maintainers:
- name: QJOLY
email: [email protected]
name: common
version: v0.3.1
version: v0.3.2
appVersion: "0"
kubeVersion: ">= 1.18"
home: https://github.com/RubxKube/common-charts
Expand Down
10 changes: 5 additions & 5 deletions charts/common/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: {{ .Release.Name }}
name: {{ .Values.name }}
labels:
app: {{ .Release.Name }}
app: {{ .Values.name }}
spec:
replicas: {{ .Values.deployment.minReplicas }}
selector:
matchLabels:
app: {{ .Release.Name }}
app: {{ .Values.name }}
strategy:
{{- toYaml .Values.deployment.strategy | nindent 4 }}
template:
metadata:
labels:
app: {{ .Release.Name }}
app: {{ .Values.name }}
spec:
{{- if .Values.image.repositorySettings.isPrivate }}
imagePullSecrets:
- name: "{{ .Values.image.repositorySettings.secretName }}"
{{- end }}
containers:
- name: {{ .Release.Name }}
- name: {{ .Values.name }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- if .Values.deployment.port }}
Expand Down
4 changes: 2 additions & 2 deletions charts/common/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Release.Name }}
name: {{ .Values.name }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Release.Name }}
name: {{ .Values.name }}
minReplicas: {{ .Values.hpa.minReplicas }}
maxReplicas: {{ .Values.hpa.maxReplicas }}
metrics:
Expand Down
6 changes: 3 additions & 3 deletions charts/common/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}
name: {{ .Values.name }}
labels:
app: {{ .Release.Name }}
app: {{ .Values.name }}
{{- if .Values.ingress.annotations }}
annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
Expand All @@ -21,7 +21,7 @@ spec:
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}
name: {{ .Values.name }}
port:
number: {{ .Values.app.containerPort }}
{{- if .Values.ingress.tls.enabled }}
Expand Down
6 changes: 3 additions & 3 deletions charts/common/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
name: {{ .Values.name }}
labels:
app: {{ .Release.Name }}
app: {{ .Values.name }}
{{- if .Values.service.extraLabels }}
{{ .Values.service.extraLabels | toYaml | nindent 4 }}
{{- end }}
spec:
selector:
app: {{ .Release.Name }}
app: {{ .Values.name }}
ports:
- targetPort: {{ .Values.deployment.port }}
port: {{ .Values.service.servicePort }}
Expand Down
12 changes: 6 additions & 6 deletions charts/common/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
apiVersion: v1
kind: Pod
metadata:
name: test-connection-wget-{{ .Release.Name }}
name: test-connection-wget-{{ .Values.name }}
labels:
app: {{ .Release.Name }}
app: {{ .Values.name }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ .Release.Name }}:{{ .Values.service.servicePort }}']
args: ['{{ .Values.name }}:{{ .Values.service.servicePort }}']
restartPolicy: Never
{{ end }}
{{- if (.Values.tests.curlHostHeader.enabled) }}
---
apiVersion: v1
kind: Pod
metadata:
name: test-connection-curl-{{ .Release.Name }}
name: test-connection-curl-{{ .Values.name }}
labels:
app: {{ .Release.Name }}
app: {{ .Values.name }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: curl
image: curlimages/curl:7.70.0
command: ['curl']
args: ['{{ .Release.Name }}:{{ .Values.service.servicePort }}{{ .Values.tests.curlHostHeader.path }}', '-H', '"Host:{{ .Values.ingress.hostName }}:{{ .Values.service.servicePort }}"']
args: ['{{ .Values.name }}:{{ .Values.service.servicePort }}{{ .Values.tests.curlHostHeader.path }}', '-H', '"Host:{{ .Values.ingress.hostName }}:{{ .Values.service.servicePort }}"']
restartPolicy: Never
{{ end }}
6 changes: 6 additions & 0 deletions charts/common/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
define: &containerPort 80

Check warning on line 1 in charts/common/values.yaml

View workflow job for this annotation

GitHub Actions / lint

1:1 [document-start] missing document start "---"


# Name of the application
# Since this chart is a template, you can change the name of the application
# by changing the value of the name variable
name: "my-app"

service:
type: ClusterIP
enabled: true
Expand Down

0 comments on commit ae0b3b7

Please sign in to comment.