command
This commit is contained in:
45
utils/assets/templates/oc-shared/deployment.yaml
Normal file
45
utils/assets/templates/oc-shared/deployment.yaml
Normal file
@@ -0,0 +1,45 @@
|
||||
{{- if .Values.ocShared.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: oc-shared
|
||||
name: {{ .Release.Name }}-oc-shared
|
||||
spec:
|
||||
replicas: {{ .Values.ocShared.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: oc-shared
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: oc-shared
|
||||
spec:
|
||||
{{- if or (eq .Values.env "prod") (eq .Values.env "staging") }}
|
||||
imagePullSecrets:
|
||||
- name: regcred
|
||||
{{- end }}
|
||||
containers:
|
||||
- image: "{{ .Values.ocShared.image }}"
|
||||
name: oc-shared
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: opencloud-config
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /oc/version
|
||||
port: 8080
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 30
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
resources:
|
||||
limits:
|
||||
cpu: "{{ .Values.ocShared.resources.limits.cpu }}"
|
||||
memory: "{{ .Values.ocShared.resources.limits.memory }}"
|
||||
requests:
|
||||
cpu: "{{ .Values.ocShared.resources.requests.cpu }}"
|
||||
memory: "{{ .Values.ocShared.resources.requests.memory }}"
|
||||
{{- end }}
|
||||
32
utils/assets/templates/oc-shared/ingress.yaml
Normal file
32
utils/assets/templates/oc-shared/ingress.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
{{- if index .Values.ocShared.enabled }}
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
name: oc-shared-ingress
|
||||
spec:
|
||||
entryPoints:
|
||||
- web
|
||||
routes:
|
||||
- kind: Rule
|
||||
match: Host(`{{ .Values.host }}`) && PathPrefix(`/shared`)
|
||||
priority: 10
|
||||
services:
|
||||
- kind: Service
|
||||
name: oc-shared-svc
|
||||
port: 8080
|
||||
middlewares:
|
||||
- name: strip-shared-prefix
|
||||
{{- if index .Values.ocAuth.enableTraefikProxyIntegration }}
|
||||
- name: forward-auth
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: strip-shared-prefix
|
||||
spec:
|
||||
replacePathRegex:
|
||||
regex: ^/shared(.*)
|
||||
replacement: /oc$1
|
||||
{{- end }}
|
||||
40
utils/assets/templates/oc-shared/service.yaml
Normal file
40
utils/assets/templates/oc-shared/service.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
{{- if index .Values.ocShared.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: oc-shared-svc
|
||||
labels:
|
||||
app: oc-shared-svc
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 8080
|
||||
protocol: TCP
|
||||
targetPort: 8080
|
||||
selector:
|
||||
app: oc-shared
|
||||
type: ClusterIP
|
||||
{{- end }}
|
||||
|
||||
{{- if and .Values.ocShared.enabled .Values.ocShared.hpa.enabled }}
|
||||
---
|
||||
# Horizontal Pod Autoscaler
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-oc-shared
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ .Release.Name }}-oc-shared
|
||||
minReplicas: {{ .Values.ocShared.hpa.minReplicas }}
|
||||
maxReplicas: {{ .Values.ocShared.hpa.maxReplicas }}
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.ocShared.hpa.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user