Create common chart #1
27 changed files with 263 additions and 180 deletions
6
apps/sudoscientist-go-backend/Chart.lock
Normal file
6
apps/sudoscientist-go-backend/Chart.lock
Normal file
|
@ -0,0 +1,6 @@
|
|||
dependencies:
|
||||
- name: common
|
||||
repository: https://charts.minhas.io
|
||||
version: 0.1.0
|
||||
digest: sha256:406bfea256905aa3e1ea4e4af7420db7a78a674d3e967316970e52077012bb5d
|
||||
generated: "2023-01-03T04:06:37.22850766Z"
|
|
@ -7,5 +7,5 @@ appVersion: "1.16.0"
|
|||
# bjw-s common chart
|
||||
dependencies:
|
||||
- name: common
|
||||
version: 1.2.0
|
||||
repository: https://bjw-s.github.io/helm-charts/
|
||||
version: 0.1.0
|
||||
repository: https://charts.minhas.io
|
BIN
apps/sudoscientist-go-backend/charts/common-0.1.0.tgz
Normal file
BIN
apps/sudoscientist-go-backend/charts/common-0.1.0.tgz
Normal file
Binary file not shown.
0
apps/sudoscientist-go-backend/templates/NOTES.txt
Normal file
0
apps/sudoscientist-go-backend/templates/NOTES.txt
Normal file
1
apps/sudoscientist-go-backend/templates/_helpers.tpl
Normal file
1
apps/sudoscientist-go-backend/templates/_helpers.tpl
Normal file
|
@ -0,0 +1 @@
|
|||
{{ include "common.helpers" . }}
|
1
apps/sudoscientist-go-backend/templates/deployment.yaml
Normal file
1
apps/sudoscientist-go-backend/templates/deployment.yaml
Normal file
|
@ -0,0 +1 @@
|
|||
{{ include "common.deployment" . }}
|
|
@ -0,0 +1 @@
|
|||
{{ include "common.external-secrets" . }}
|
1
apps/sudoscientist-go-backend/templates/istio.yaml
Normal file
1
apps/sudoscientist-go-backend/templates/istio.yaml
Normal file
|
@ -0,0 +1 @@
|
|||
{{ include "common.istio" . }}
|
1
apps/sudoscientist-go-backend/templates/service.yaml
Normal file
1
apps/sudoscientist-go-backend/templates/service.yaml
Normal file
|
@ -0,0 +1 @@
|
|||
{{ include "common.service" . }}
|
23
library/common/.helmignore
Normal file
23
library/common/.helmignore
Normal file
|
@ -0,0 +1,23 @@
|
|||
# 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
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
5
library/common/Chart.yaml
Normal file
5
library/common/Chart.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
apiVersion: v2
|
||||
name: common
|
||||
description: Asara's common library chart
|
||||
type: library
|
||||
version: 0.1.0
|
7
library/common/templates/_NOTES.txt
Normal file
7
library/common/templates/_NOTES.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
1. Get the application URL by running these commands:
|
||||
{{- if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "common.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"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
{{- end }}
|
|
@ -1,16 +1,15 @@
|
|||
{{ define "common.deployment" }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "sudoscientist-go-backend.fullname" . }}
|
||||
labels:
|
||||
{{- include "sudoscientist-go-backend.labels" . | nindent 4 }}
|
||||
name: {{ .Values.common.fullname }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "sudoscientist-go-backend.selectorLabels" . | nindent 6 }}
|
||||
{{- include "common.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
|
@ -18,13 +17,13 @@ spec:
|
|||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "sudoscientist-go-backend.selectorLabels" . | nindent 8 }}
|
||||
{{- include "common.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "sudoscientist-go-backend.serviceAccountName" . }}
|
||||
serviceAccountName: {{ .Values.common.serviceAccountName }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
|
@ -63,3 +62,4 @@ spec:
|
|||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
83
library/common/templates/_external-secrets.yaml
Normal file
83
library/common/templates/_external-secrets.yaml
Normal file
|
@ -0,0 +1,83 @@
|
|||
{{ define "common.external-secrets" }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Values.common.serviceAccountName }}
|
||||
automountServiceAccountToken: false
|
||||
...
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
type: kubernetes.io/service-account-token
|
||||
metadata:
|
||||
name: serviceaccounttoken
|
||||
annotations:
|
||||
kubernetes.io/service-account.name: "{{ .Values.common.serviceAccountName }}"
|
||||
...
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ .Values.common.serviceAccountName }}-tokenreview-binding
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:auth-delegator
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Values.common.serviceAccountName }}
|
||||
namespace: {{ .Values.common.namespace }}
|
||||
...
|
||||
---
|
||||
apiVersion: redhatcop.redhat.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: {{ .Values.common.serviceAccountName }}
|
||||
namespace: {{ .Values.common.namespace }}
|
||||
spec:
|
||||
authentication:
|
||||
path: k8s-teapot
|
||||
role: {{ .Values.common.serviceAccountName }}
|
||||
policy: |-
|
||||
{{ .Values.common.vaultPolicy | indent 4 }}
|
||||
...
|
||||
---
|
||||
apiVersion: external-secrets.io/v1beta1
|
||||
kind: SecretStore
|
||||
metadata:
|
||||
name: {{ .Values.common.serviceAccountName }}
|
||||
spec:
|
||||
provider:
|
||||
vault:
|
||||
server: "https://vault.service.masked.name:8200"
|
||||
path: "kv"
|
||||
version: "v2"
|
||||
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUROVENDQWgyZ0F3SUJBZ0lVWXA4eG81dDJsSkZQM1NpRDFmSmlyZ0dVUUowd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0ZqRVVNQklHQTFVRUF4TUxiV0Z6YTJWa0xtNWhiV1V3SGhjTk1qQXdPREk1TVRreU16RXlXaGNOTXpBdwpPREkzTVRreU16UXlXakFXTVJRd0VnWURWUVFERXd0dFlYTnJaV1F1Ym1GdFpUQ0NBU0l3RFFZSktvWklodmNOCkFRRUJCUUFEZ2dFUEFEQ0NBUW9DZ2dFQkFNSTdvUitLSHZ2em5mbmFBWERNTzVxcFNUQ0FZQ3lmakZFb2hZSmYKbE9jbkxPTlhiM2Y2c1A1ZDFlbHRMK1VUcTBSVlU1VVAwYU5XN2hxRFRhNDFNUncwSkNEdEI2OHlLZFlxMmhaZgo5N2dBK2xqM01FSlU2UlRBS0xyZ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RVJUQkRNRUVHQ0NzR0FRVUYKQnpBQ2hqVm9kSFJ3T2k4dmRtRjFiSFF1WTI5c2RXMWlhV0V1YldGemEyVmtMbTVoYldVNk9ESXdNQzkyTVM5dwphMmxmY205dmRDOWpZVEJIQmdOVkhSOEVRREErTUR5Z09xQTRoalpvZEhSd09pOHZkbUYxYkhRdVkyOXNkVzFpCmFXRXViV0Z6YTJWa0xtNWhiV1U2T0RJd01DOTJNUzl3YTJsZmNtOXZkQzlqY213d0RRWUpLb1pJaHZjTkFRRUwKQlFBRGdnRUJBSzZITWdSK2hwd2paQ21mNU5zekRTSHI3ZFlLWlhQNExyY0hQV3M5NG5MTTMzVVo1NzJ1YkdIcwpkS2pSdzhZRDBjbmNyc3lwc1ltRWdSNTdVK0RIa3lzMzk0d2tiN1VPd3kxWnZkNUlJUlhkUDBjRHlsejBRenFNCkFQblFZTitpc21rb2xqaGs5ZXkwUWJvM0NtUGpNK1VRY0F4dVpRdEE0TStyaUMxK2prdWRlMXVZTDBzekM2WTkKNEtldGZ2Yk5rZWRTYVY1eUphUktDQmhSY0M0L0dqcEJHL29kUS81QWZCUEFGalpxaGNJSldCclZZYlRRVkM3OQpoTUExaXdXSlBtVDlMc2pNU1VmeEZUUHp4Um5OWFFpS0Z6NWtUMk9pUzFucWg4YU9jeVU5WUM5Mjhwa2lmTkpWCktva3VEZXpKRk03aWUzZCtFY0JrMVY5bEh3T1dkdG89Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
||||
auth:
|
||||
kubernetes:
|
||||
mountPath: "k8s-teapot"
|
||||
role: "{{ .Values.common.serviceAccountName }}"
|
||||
secretRef:
|
||||
name: "serviceaccounttoken"
|
||||
...
|
||||
---
|
||||
apiVersion: external-secrets.io/v1beta1
|
||||
kind: ExternalSecret
|
||||
metadata:
|
||||
name: {{ .Values.common.serviceAccountName }}
|
||||
spec:
|
||||
secretStoreRef:
|
||||
name: {{ .Values.common.serviceAccountName }}
|
||||
kind: SecretStore
|
||||
data:
|
||||
{{- range $v := .Values.common.secrets }}
|
||||
{{- with $v }}
|
||||
- secretKey: {{ .secretKey }}
|
||||
remoteRef:
|
||||
key: {{ .key }}
|
||||
property: {{ .property }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
...
|
||||
{{- end }}
|
|
@ -1,7 +1,7 @@
|
|||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "sudoscientist-go-backend.name" -}}
|
||||
{{- define "common.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
|
@ -10,7 +10,7 @@ Create a default fully qualified app name.
|
|||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "sudoscientist-go-backend.fullname" -}}
|
||||
{{- define "common.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
|
@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
|
|||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "sudoscientist-go-backend.chart" -}}
|
||||
{{- define "common.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "sudoscientist-go-backend.labels" -}}
|
||||
helm.sh/chart: {{ include "sudoscientist-go-backend.chart" . }}
|
||||
{{ include "sudoscientist-go-backend.selectorLabels" . }}
|
||||
{{- define "common.labels" -}}
|
||||
helm.sh/chart: {{ include "common.chart" . }}
|
||||
{{ include "common.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
|
@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "sudoscientist-go-backend.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "sudoscientist-go-backend.name" . }}
|
||||
{{- define "common.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "common.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "sudoscientist-go-backend.serviceAccountName" -}}
|
||||
{{- define "common.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "sudoscientist-go-backend.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- default (include "common.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
30
library/common/templates/_hpa.yaml
Normal file
30
library/common/templates/_hpa.yaml
Normal file
|
@ -0,0 +1,30 @@
|
|||
{{ define "common.hpa" }}
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2beta1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "common.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "common.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
63
library/common/templates/_istio.yaml
Normal file
63
library/common/templates/_istio.yaml
Normal file
|
@ -0,0 +1,63 @@
|
|||
{{- define "common.istio" }}
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: {{ .Values.common.fullname }}-cert
|
||||
namespace: istio-system
|
||||
spec:
|
||||
secretName: {{ .Values.common.fullname }}-cert
|
||||
commonName: {{ first .Values.common.domains }}
|
||||
dnsNames:
|
||||
{{- range $d := .Values.common.domains }}
|
||||
- {{ $d }}
|
||||
{{- end }}
|
||||
issuerRef:
|
||||
name: {{ .Values.common.domainIssuer }}
|
||||
kind: ClusterIssuer
|
||||
group: cert-manager.io
|
||||
...
|
||||
---
|
||||
apiVersion: networking.istio.io/v1beta1
|
||||
kind: Gateway
|
||||
metadata:
|
||||
name: {{ .Values.common.fullname }}-gateway
|
||||
spec:
|
||||
selector:
|
||||
istio: ingressgateway
|
||||
servers:
|
||||
- port:
|
||||
number: 443
|
||||
name: https
|
||||
protocol: HTTPS
|
||||
tls:
|
||||
mode: SIMPLE
|
||||
credentialName: {{ .Values.common.fullname }}-cert
|
||||
hosts:
|
||||
{{- range $d := .Values.common.domains }}
|
||||
- {{ $d }}
|
||||
{{- end }}
|
||||
...
|
||||
---
|
||||
apiVersion: networking.istio.io/v1beta1
|
||||
kind: VirtualService
|
||||
metadata:
|
||||
name: {{ .Values.common.fullname }}-gateway
|
||||
spec:
|
||||
hosts:
|
||||
{{- range $d := .Values.common.domains }}
|
||||
- {{ $d }}
|
||||
{{- end }}
|
||||
gateways:
|
||||
- {{ .Values.common.fullname }}-gateway
|
||||
http:
|
||||
- match:
|
||||
- uri:
|
||||
prefix: /
|
||||
route:
|
||||
- destination:
|
||||
port:
|
||||
number: 80
|
||||
host: {{ .Values.common.fullname }}
|
||||
...
|
||||
{{- end }}
|
15
library/common/templates/_service.yaml
Normal file
15
library/common/templates/_service.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
{{ define "common.service" }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.common.fullname }}
|
||||
spec:
|
||||
selector:
|
||||
{{- include "common.selectorLabels" . | nindent 6 }}
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
{{- end }}
|
|
@ -1,6 +0,0 @@
|
|||
dependencies:
|
||||
- name: common
|
||||
repository: https://bjw-s.github.io/helm-charts/
|
||||
version: 1.2.0
|
||||
digest: sha256:4a59834889563e94dab9d298b62e8a095be18c459593c42307f99d5f1ea51027
|
||||
generated: "2022-12-31T18:26:05.702450278Z"
|
Binary file not shown.
|
@ -1,22 +0,0 @@
|
|||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range $host := .Values.ingress.hosts }}
|
||||
{{- range .paths }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "sudoscientist-go-backend.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 }}
|
||||
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 "sudoscientist-go-backend.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "sudoscientist-go-backend.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "sudoscientist-go-backend.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"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
{{- end }}
|
|
@ -1,61 +0,0 @@
|
|||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "sudoscientist-go-backend.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}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "sudoscientist-go-backend.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
|
||||
pathType: {{ .pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- else }}
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1,15 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "sudoscientist-go-backend.fullname" . }}
|
||||
labels:
|
||||
{{- include "sudoscientist-go-backend.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "sudoscientist-go-backend.selectorLabels" . | nindent 4 }}
|
|
@ -1,12 +0,0 @@
|
|||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "sudoscientist-go-backend.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "sudoscientist-go-backend.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1,15 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{ include "sudoscientist-go-backend.fullname" . }}-test-connection"
|
||||
labels:
|
||||
{{- include "sudoscientist-go-backend.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
spec:
|
||||
containers:
|
||||
- name: wget
|
||||
image: busybox
|
||||
command: ['wget']
|
||||
args: ['{{ include "sudoscientist-go-backend.fullname" . }}:{{ .Values.service.port }}']
|
||||
restartPolicy: Never
|
|
@ -1,23 +0,0 @@
|
|||
image:
|
||||
# -- image repository
|
||||
repository: docker-repo.service.masked.name:5000/sudoscientist-go-backend
|
||||
# -- image pull policy
|
||||
pullPolicy: IfNotPresent
|
||||
# -- image tag
|
||||
# this example is not automatically updated, so be sure to use the latest image
|
||||
tag: latest
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
|
||||
serviceAccount:
|
||||
create: false
|
||||
|
||||
serviceAccountName: sudoscientist
|
||||
|
||||
autoscaling:
|
||||
enable: false
|
Loading…
Reference in a new issue