add service ec-config-server
This commit is contained in:
42
apps/ec-config-server/env/k3s-cluster/templates/_helpers.tpl
vendored
Normal file
42
apps/ec-config-server/env/k3s-cluster/templates/_helpers.tpl
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{{- define "mr-config-server.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "mr-config-server.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "mr-config-server.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "mr-config-server.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "mr-config-server.labels" -}}
|
||||
helm.sh/chart: {{ include "mr-config-server.chart" . }}
|
||||
{{ include "mr-config-server.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "mr-config-server.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "mr-config-server.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "mr-config-server.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
13
apps/ec-config-server/env/k3s-cluster/templates/configmap.yaml
vendored
Normal file
13
apps/ec-config-server/env/k3s-cluster/templates/configmap.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "mr-config-server.fullname" . }}
|
||||
labels:
|
||||
{{- include "mr-config-server.labels" . | nindent 4 }}
|
||||
data:
|
||||
SPRING_PROFILES_ACTIVE: {{ .Values.spring.activeprofile }}
|
||||
{{- if .Values.environment }}
|
||||
{{- if .Values.environment.configNativeSearchLocation }}
|
||||
CONFIG_NATIVE_SEARCH_LOCATION: {{ .Values.environment.configNativeSearchLocation }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
89
apps/ec-config-server/env/k3s-cluster/templates/deployment.yaml
vendored
Normal file
89
apps/ec-config-server/env/k3s-cluster/templates/deployment.yaml
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "mr-config-server.fullname" . }}
|
||||
labels:
|
||||
{{- include "mr-config-server.labels" . | nindent 4 }}
|
||||
spec:
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: {{ .Values.rollingUpdate.maxUnavailable }}
|
||||
maxSurge: {{ .Values.rollingUpdate.maxSurge }}
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "mr-config-server.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "mr-config-server.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "mr-config-server.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ include "mr-config-server.fullname" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8100
|
||||
protocol: TCP
|
||||
startupProbe:
|
||||
failureThreshold: {{ .Values.deployment.startupProbe.failureThreshold }}
|
||||
httpGet:
|
||||
path: {{ .Values.deployment.livenesscheckpath }}
|
||||
port: {{ .Values.deployment.healthcheckport }}
|
||||
scheme: HTTP
|
||||
periodSeconds: {{ .Values.deployment.startupProbe.periodSeconds }}
|
||||
successThreshold: {{ .Values.deployment.startupProbe.successThreshold }}
|
||||
timeoutSeconds: {{ .Values.deployment.startupProbe.timeoutSeconds }}
|
||||
initialDelaySeconds: {{ .Values.deployment.startupProbe.initialDelaySeconds }}
|
||||
livenessProbe:
|
||||
failureThreshold: {{ .Values.deployment.livenessProbe.failureThreshold }}
|
||||
httpGet:
|
||||
path: {{ .Values.deployment.livenesscheckpath }}
|
||||
port: {{ .Values.deployment.healthcheckport }}
|
||||
scheme: HTTP
|
||||
periodSeconds: {{ .Values.deployment.livenessProbe.periodSeconds }}
|
||||
successThreshold: {{ .Values.deployment.livenessProbe.successThreshold }}
|
||||
timeoutSeconds: {{ .Values.deployment.livenessProbe.timeoutSeconds }}
|
||||
readinessProbe:
|
||||
failureThreshold: {{ .Values.deployment.readinessProbe.failureThreshold }}
|
||||
httpGet:
|
||||
path: {{ .Values.deployment.readinesscheckpath }}
|
||||
port: {{ .Values.deployment.healthcheckport }}
|
||||
scheme: HTTP
|
||||
periodSeconds: {{ .Values.deployment.readinessProbe.periodSeconds }}
|
||||
successThreshold: {{ .Values.deployment.readinessProbe.successThreshold }}
|
||||
timeoutSeconds: {{ .Values.deployment.readinessProbe.timeoutSeconds }}
|
||||
resources:
|
||||
{{- toYaml .Values.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 }}
|
||||
32
apps/ec-config-server/env/k3s-cluster/templates/horizontal-pod-autoscaler.yaml
vendored
Normal file
32
apps/ec-config-server/env/k3s-cluster/templates/horizontal-pod-autoscaler.yaml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "mr-config-server.fullname" . }}
|
||||
labels:
|
||||
{{- include "mr-config-server.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "mr-config-server.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
11
apps/ec-config-server/env/k3s-cluster/templates/pod-disruption-budget.yaml
vendored
Normal file
11
apps/ec-config-server/env/k3s-cluster/templates/pod-disruption-budget.yaml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{{- if .Values.pdb.enabled }}
|
||||
apiVersion: policy/v1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ .Chart.Name }}
|
||||
spec:
|
||||
minAvailable: {{ .Values.pdb.minAvailable }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "mr-config-server.name" . }}
|
||||
{{- end }}
|
||||
26
apps/ec-config-server/env/k3s-cluster/templates/service-account.yaml
vendored
Normal file
26
apps/ec-config-server/env/k3s-cluster/templates/service-account.yaml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "mr-config-server.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "mr-config-server.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ .Release.Namespace }}-config-reader-binding
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "mr-config-server.serviceAccountName" . }}
|
||||
apiGroup: ""
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
apiGroup: ""
|
||||
kind: ClusterRole
|
||||
name: config-reader
|
||||
{{- end }}
|
||||
19
apps/ec-config-server/env/k3s-cluster/templates/service.yaml
vendored
Normal file
19
apps/ec-config-server/env/k3s-cluster/templates/service.yaml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "mr-config-server.fullname" . }}
|
||||
annotations:
|
||||
service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
|
||||
service.beta.kubernetes.io/aws-load-balancer-type: "elb"
|
||||
labels:
|
||||
{{- include "mr-config-server.labels" . | nindent 4 }}
|
||||
spring-boot: "{{ .Values.labels.springboot }}"
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: {{ .Values.service.targetPort }}
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "mr-config-server.selectorLabels" . | nindent 4 }}
|
||||
Reference in New Issue
Block a user