feat(deployment): parameterize deployment configuration for multiple services
This commit is contained in:
		
							parent
							
								
									4a97ec8d1c
								
							
						
					
					
						commit
						fcee7c3cf0
					
				@ -1,22 +1,23 @@
 | 
				
			|||||||
 | 
					{{- range $index, $deployment := .Values.deployments }}
 | 
				
			||||||
apiVersion: apps/v1
 | 
					apiVersion: apps/v1
 | 
				
			||||||
kind: Deployment
 | 
					kind: Deployment
 | 
				
			||||||
metadata:
 | 
					metadata:
 | 
				
			||||||
  name: auth
 | 
					  name: {{ $deployment.name }}
 | 
				
			||||||
  labels:
 | 
					  labels:
 | 
				
			||||||
    app: auth
 | 
					    app: {{ $deployment.name }}
 | 
				
			||||||
spec:
 | 
					spec:
 | 
				
			||||||
  replicas: 1
 | 
					  replicas: {{ $deployment.replicas }}
 | 
				
			||||||
  selector:
 | 
					  selector:
 | 
				
			||||||
    matchLabels:
 | 
					    matchLabels:
 | 
				
			||||||
      app: auth
 | 
					      app: {{ $deployment.name }}
 | 
				
			||||||
  template:
 | 
					  template:
 | 
				
			||||||
    metadata:
 | 
					    metadata:
 | 
				
			||||||
      labels:
 | 
					      labels:
 | 
				
			||||||
        app: auth
 | 
					        app: {{ $deployment.name }}
 | 
				
			||||||
    spec:
 | 
					    spec:
 | 
				
			||||||
      containers:
 | 
					      containers:
 | 
				
			||||||
        - image: {{ .Values.registry }}/suyiiyii/hertz101-auth:{{ .Values.tag }}
 | 
					        - image: {{ $.Values.registry }}/suyiiyii/hertz101-{{ $deployment.name }}:{{ $.Values.tag }}
 | 
				
			||||||
          name: badger
 | 
					          name: {{ $deployment.name }}
 | 
				
			||||||
          resources:
 | 
					          resources:
 | 
				
			||||||
            limits:
 | 
					            limits:
 | 
				
			||||||
              memory: "512Mi"
 | 
					              memory: "512Mi"
 | 
				
			||||||
@ -25,3 +26,4 @@ spec:
 | 
				
			|||||||
              memory: "64Mi"
 | 
					              memory: "64Mi"
 | 
				
			||||||
              cpu: "200m"
 | 
					              cpu: "200m"
 | 
				
			||||||
      restartPolicy: Always
 | 
					      restartPolicy: Always
 | 
				
			||||||
 | 
					{{- end }}
 | 
				
			||||||
							
								
								
									
										15
									
								
								values.yaml
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								values.yaml
									
									
									
									
									
								
							@ -1,10 +1,11 @@
 | 
				
			|||||||
# Default values for hertz101.
 | 
					 | 
				
			||||||
# This is a YAML-formatted file.
 | 
					 | 
				
			||||||
# Declare variables to be passed into your templates.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
 | 
					 | 
				
			||||||
replicaCount: 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
 | 
					 | 
				
			||||||
registry: ghcr.io
 | 
					registry: ghcr.io
 | 
				
			||||||
tag: main
 | 
					tag: main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					deployments:
 | 
				
			||||||
 | 
					  - name: user
 | 
				
			||||||
 | 
					    replicas: 1
 | 
				
			||||||
 | 
					  - name: auth
 | 
				
			||||||
 | 
					    replicas: 2
 | 
				
			||||||
 | 
					  - name: facade
 | 
				
			||||||
 | 
					    replicas: 3
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user