99 lines
2.5 KiB
Go
Executable File
99 lines
2.5 KiB
Go
Executable File
package d_app
|
|
|
|
const CmiiFrontendDeploymentTemplate = `
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ .AppName }}
|
|
namespace: {{ .Namespace }}
|
|
labels:
|
|
cmii.type: frontend
|
|
cmii.app: {{ .AppName }}
|
|
octopus.control: frontend-app-wdd
|
|
app.kubernetes.io/app-version: {{ .TagVersion }}
|
|
spec:
|
|
replicas: {{ .Replicas }}
|
|
strategy:
|
|
rollingUpdate:
|
|
maxUnavailable: 1
|
|
selector:
|
|
matchLabels:
|
|
cmii.type: frontend
|
|
cmii.app: {{ .AppName }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
cmii.type: frontend
|
|
cmii.app: {{ .AppName }}
|
|
spec:
|
|
imagePullSecrets:
|
|
- name: harborsecret
|
|
containers:
|
|
- name: {{ .AppName }}
|
|
{{- if .HarborPort }}
|
|
image: {{ .HarborIPOrCustomImagePrefix }}:{{ .HarborPort }}/cmii/{{ .AppName }}:{{ .ImageTag }}
|
|
{{- else }}
|
|
image: {{ .HarborIPOrCustomImagePrefix }}{{ .AppName }}:{{ .ImageTag }}
|
|
{{- end }}
|
|
imagePullPolicy: Always
|
|
env:
|
|
- name: K8S_NAMESPACE
|
|
value: {{ .Namespace }}
|
|
- name: APPLICATION_NAME
|
|
value: {{ .AppName }}
|
|
ports:
|
|
- name: platform-9528
|
|
containerPort: 9528
|
|
protocol: TCP
|
|
resources:
|
|
limits:
|
|
cpu: "1"
|
|
memory: 1Gi
|
|
requests:
|
|
cpu: 500m
|
|
memory: 500Mi
|
|
volumeMounts:
|
|
- name: nginx-conf
|
|
mountPath: /usr/local/nginx/conf/nginx.conf
|
|
subPath: nginx.conf
|
|
- name: tenant-prefix
|
|
subPath: ingress-config.js
|
|
mountPath: /home/cmii-platform/dist/ingress-config.js
|
|
volumes:
|
|
- name: nginx-conf
|
|
configMap:
|
|
name: nginx-cm
|
|
items:
|
|
- key: nginx.conf
|
|
path: nginx.conf
|
|
- name: tenant-prefix
|
|
configMap:
|
|
name: tenant-prefix-{{ .ShortName }}
|
|
items:
|
|
- key: ingress-config.js
|
|
path: ingress-config.js
|
|
`
|
|
|
|
const CmiiFrontendServiceTemplate = `
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ .AppName }}
|
|
namespace: {{ .Namespace }}
|
|
labels:
|
|
cmii.type: frontend
|
|
cmii.app: {{ .AppName }}
|
|
octopus.control: frontend-app-wdd
|
|
app.kubernetes.io/version: {{ .TagVersion }}
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
cmii.type: frontend
|
|
cmii.app: {{ .AppName }}
|
|
ports:
|
|
- name: web-svc-port
|
|
port: 9528
|
|
protocol: TCP
|
|
targetPort: 9528
|
|
`
|