Skip to content

Commit

Permalink
chore: update helm chart template
Browse files Browse the repository at this point in the history
  • Loading branch information
blackhorseya committed May 20, 2023
1 parent ae4a342 commit 0434411
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 164 deletions.
14 changes: 7 additions & 7 deletions deployments/charts/irent/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- if .Values.restful.app.ingress.enabled }}
{{- range $host := .Values.restful.app.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
http{{ if $.Values.restful.app.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
{{- else if contains "NodePort" .Values.restful.app.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "irent.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
{{- else if contains "LoadBalancer" .Values.restful.app.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "irent.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "irent.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
echo http://$SERVICE_IP:{{ .Values.restful.app.service.port }}
{{- else if contains "ClusterIP" .Values.restful.app.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "irent.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "irent.fullname" . }}
name: {{ include "irent.fullname" . }}-rental-cronjob
labels:
app: {{ include "irent.name" . }}-rental-cronjob
{{- include "irent.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
replicas: 1
selector:
matchLabels:
{{- include "irent.selectorLabels" . | nindent 6 }}
Expand All @@ -18,6 +17,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ include "irent.name" . }}-rental-cronjob
{{- include "irent.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
Expand All @@ -31,22 +31,10 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
image: "{{ .Values.cronjob.rental.image.repository }}:{{ .Values.cronjob.rental.image.tag | default .Values.version }}"
imagePullPolicy: {{ .Values.cronjob.rental.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- toYaml .Values.cronjob.rental.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
28 changes: 0 additions & 28 deletions deployments/charts/irent/templates/hpa.yaml

This file was deleted.

72 changes: 72 additions & 0 deletions deployments/charts/irent/templates/restful/app/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "irent.fullname" . }}-app-restful
labels:
app: {{ include "irent.name" . }}-app-restful
{{- include "irent.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ include "irent.name" . }}-app-restful
{{- include "irent.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ include "irent.name" . }}-app-restful
{{- include "irent.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "irent.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.restful.app.image.repository }}:{{ .Values.restful.app.image.tag | default .Values.version }}"
imagePullPolicy: {{ .Values.restful.app.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.restful.app.service.port }}
protocol: TCP
{{- if .Values.restful.app.startupProbe.enabled }}
startupProbe: {{- omit .Values.restful.app.startupProbe "enabled" | toYaml | nindent 12 }}
httpGet:
path: /api/health
port: http
{{- end }}
{{- if .Values.restful.app.livenessProbe.enabled }}
livenessProbe: {{- omit .Values.restful.app.livenessProbe "enabled" | toYaml | nindent 12 }}
httpGet:
path: /api/health
port: http
{{- end }}
{{- if .Values.restful.app.readinessProbe.enabled }}
readinessProbe: {{- omit .Values.restful.app.readinessProbe "enabled" | toYaml | nindent 12 }}
httpGet:
path: /api/health
port: http
{{- end }}
resources:
{{- toYaml .Values.restful.app.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "irent.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- if .Values.restful.app.ingress.enabled -}}
{{- $fullName := printf "%s-%s" (include "irent.fullname" .) "app-restful" -}}
{{- $svcPort := .Values.restful.app.service.port -}}
{{- if and .Values.restful.app.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.restful.app.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.restful.app.ingress.annotations "kubernetes.io/ingress.class" .Values.restful.app.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
Expand All @@ -17,18 +17,19 @@ kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app: {{ include "irent.name" . }}-app-restful
{{- include "irent.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
{{- with .Values.restful.app.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- if and .Values.restful.app.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.restful.app.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
{{- if .Values.restful.app.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
{{- range .Values.restful.app.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
Expand All @@ -37,7 +38,7 @@ spec:
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
{{- range .Values.restful.app.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
Expand Down
17 changes: 17 additions & 0 deletions deployments/charts/irent/templates/restful/app/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "irent.fullname" . }}-app-restful
labels:
app: {{ include "irent.name" . }}-app-restful
{{- include "irent.labels" . | nindent 4 }}
spec:
type: {{ .Values.restful.app.service.type }}
ports:
- port: {{ .Values.restful.app.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ include "irent.name" . }}-app-restful
{{- include "irent.selectorLabels" . | nindent 4 }}
15 changes: 0 additions & 15 deletions deployments/charts/irent/templates/service.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions deployments/charts/irent/templates/tests/test-connection.yaml

This file was deleted.

Loading

0 comments on commit 0434411

Please sign in to comment.