helm config for deployment

This commit is contained in:
ivan_chuvakhin 2021-07-02 17:54:40 +03:00
parent cb54b4b85e
commit 845b84c404
5 changed files with 40 additions and 145 deletions

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
appVersion: 1.16.0

View file

@ -1,8 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: petclinic-configmap
name: {{ .Values.petclinic.configmap.name }}
data:
application.yml: |
{{ .Values.petclinic.configmap.application.properties.name }}: |
server:
port: 8081
port: {{ .Values.petclinic.server.port }}

View file

@ -1,61 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "spring-petclinic.fullname" . }}
labels:
{{- include "spring-petclinic.labels" . | nindent 4 }}
name: petclinic-deployment-{{ .Chart.AppVersion }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
replicas: 1
selector:
matchLabels:
{{- include "spring-petclinic.selectorLabels" . | nindent 6 }}
app: {{ .Values.petclinic.label }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "spring-petclinic.selectorLabels" . | nindent 8 }}
app: {{ .Values.petclinic.label }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "spring-petclinic.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
- name: petclinic
image: {{ .Values.petclinic.image }}
imagePullPolicy: Never
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
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 }}
- containerPort: {{ .Values.petclinic.server.port }}
name: "http"
volumeMounts:
- name: app-config
mountPath: /application.yml
subPath: {{ .Values.petclinic.configmap.application.properties.name }}
readOnly: true
volumes:
- name: app-config
configMap:
name: {{ .Values.petclinic.configmap.name }}

View file

@ -1,15 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "spring-petclinic.fullname" . }}
labels:
{{- include "spring-petclinic.labels" . | nindent 4 }}
name: petclinic-service
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "spring-petclinic.selectorLabels" . | nindent 4 }}
app: {{ .Values.petclinic.label }}
ports:
- name: http
protocol: TCP
port: {{ .Values.petclinic.server.port }}
targetPort: {{ .Values.petclinic.server.port }}
type: NodePort

View file

@ -1,82 +1,10 @@
# Default values for spring-petclinic.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: nginx
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 80
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}
petclinic:
server:
port: 8081
image: spring-petclinic
configmap:
name: petclinic-configmap
application:
properties:
name: application.yml
label: petclinic