update helm
continuous-integration/drone/push Build is passing Details

master
icechen 2022-01-04 18:33:58 +08:00
parent 3882283ccd
commit 04c3856d34
4 changed files with 56 additions and 458 deletions

View File

@ -21,135 +21,21 @@ steps:
dockerfile: ./{{ .Root }}/Dockerfile
- name: deploy
image: sinlead/drone-kubectl
image: bitsbeats/drone-helm3
settings:
kubernetes_server:
kube_api_server:
from_secret: kubernetes_server
kubernetes_cert:
from_secret: kubernetes_cert
kubernetes_token:
kube_token:
from_secret: kubernetes_token
commands:
- |-
echo ` + ApiProductionDeploy + ` | kubectl apply -f -
# - kubectl wait --for=condition=Ready --timeout=300s -f deploy/deployment.yaml
`
const ApiProductionDeploy = `kind: Deployment
apiVersion: apps/v1
metadata:
name: api-{{ .Name }}
namespace: {{ .NameSpace }}
labels:
app: api-{{ .Name }}
annotations:
kubesphere.io/alias-name: {{ .AliasName }}
kubesphere.io/creator: drone
spec:
replicas: 1
selector:
matchLabels:
app: api-{{ .Name }}
template:
metadata:
creationTimestamp: null
labels:
app: api-{{ .Name }}
spec:
volumes:
- name: host-time
hostPath:
path: /etc/localtime
type: ''
containers:
- image: 'reg.icechen.cn/{{ .NameSpace }}/api-{{ .Name }}:${DRONE_TAG}'
ports:
- containerPort: {{ .Port }}
protocol: TCP
envFrom:
- configMapRef:
name: service
env:
- name: endpoints
value: 'etcd:2379'
resources:
limits:
cpu: 200m
memory: 1000Mi
requests:
cpu: 50m
memory: 200Mi
volumeMounts:
- name: host-time
readOnly: true
mountPath: /etc/localtime
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
serviceAccountName: default
serviceAccount: default
securityContext: {}
imagePullSecrets:
- name: registry-secret
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
---
kind: Service
apiVersion: v1
metadata:
name: api-{{ .Name }}
namespace: {{ .NameSpace }}
labels:
app: api-{{ .Name }}
spec:
ports:
- name: http-api-{{ .Name }}
protocol: TCP
port: 80
targetPort: {{ .Port }}
selector:
app: api-{{ .Name }}
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
{{ if and .Host .Path }}
---
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: api-{{ .Name }}
namespace: {{ .NameSpace }}
annotations:
kubesphere.io/creator: drone
nginx.ingress.kubernetes.io/enable-cors: 'true'
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
rules:
- host: {{ .Host }}
http:
paths:
- path: {{ .Path }}
pathType: ImplementationSpecific
backend:
service:
name: api-{{ .Name }}
port:
number: 80
{{ end }}
kube_certificate:
from_secret: kubernetes_cert
chart: ./{{ .Root }}/deploy
release: api-{{ .Name }}
wait: true
values:
- nameSpace={{ .NameSpace }}
- aliasName={{ .AliasName }}
- image=reg.icechen.cn/{{ .NameSpace }}/api-{{ .Name }}
- imageTag=${DRONE_TAG}
- port={{ .Port }}
`

View File

@ -21,135 +21,21 @@ steps:
dockerfile: ./{{ .Root }}/Dockerfile
- name: deploy
image: sinlead/drone-kubectl
image: bitsbeats/drone-helm3
settings:
kubernetes_server:
kube_api_server:
from_secret: kubernetes_server_test
kubernetes_cert:
from_secret: kubernetes_cert_test
kubernetes_token:
kube_token:
from_secret: kubernetes_token_test
commands:
- |-
echo ` + ApiTestDeploy + ` | kubectl apply -f -
# - kubectl wait --for=condition=Ready --timeout=300s -f deploy/deployment.yaml
`
const ApiTestDeploy = `kind: Deployment
apiVersion: apps/v1
metadata:
name: api-{{ .Name }}-test
namespace: {{ .NameSpace }}
labels:
app: api-{{ .Name }}-test
annotations:
kubesphere.io/alias-name: {{ .AliasName }}
kubesphere.io/creator: drone
spec:
replicas: 1
selector:
matchLabels:
app: api-{{ .Name }}-test
template:
metadata:
creationTimestamp: null
labels:
app: api-{{ .Name }}-test
spec:
volumes:
- name: host-time
hostPath:
path: /etc/localtime
type: ''
containers:
- image: 'reg.icechen.cn/{{ .NameSpace }}/api-{{ .Name }}:${DRONE_COMMIT:0:8}'
ports:
- containerPort: {{ .Port }}
protocol: TCP
envFrom:
- configMapRef:
name: service
env:
- name: endpoints
value: 'etcd:2379'
resources:
limits:
cpu: 200m
memory: 1000Mi
requests:
cpu: 50m
memory: 200Mi
volumeMounts:
- name: host-time
readOnly: true
mountPath: /etc/localtime
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
serviceAccountName: default
serviceAccount: default
securityContext: {}
imagePullSecrets:
- name: registry-secret
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
---
kind: Service
apiVersion: v1
metadata:
name: api-{{ .Name }}-test
namespace: {{ .NameSpace }}
labels:
app: api-{{ .Name }}-test
spec:
ports:
- name: http-api-{{ .Name }}-test
protocol: TCP
port: 80
targetPort: {{ .Port }}
selector:
app: api-{{ .Name }}-test
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
{{ if and .Host .Path }}
---
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: api-{{ .Name }}-test
namespace: {{ .NameSpace }}
annotations:
kubesphere.io/creator: drone
nginx.ingress.kubernetes.io/enable-cors: 'true'
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
rules:
- host: t{{ .Host }}
http:
paths:
- path: {{ .Path }}
pathType: ImplementationSpecific
backend:
service:
name: api-{{ .Name }}-test
port:
number: 80
{{ end }}
kube_certificate:
from_secret: kubernetes_cert_test
chart: ./{{ .Root }}/deploy
release: api-{{ .Name }}
wait: true
values:
- nameSpace={{ .NameSpace }}
- aliasName={{ .AliasName }}
- image=reg.icechen.cn/{{ .NameSpace }}/api-{{ .Name }}
- imageTag=${DRONE_COMMIT:0:8}
- port={{ .Port }}
`

View File

@ -21,108 +21,21 @@ steps:
dockerfile: ./{{ .Root }}/Dockerfile
- name: deploy
image: sinlead/drone-kubectl
image: bitsbeats/drone-helm3
settings:
kubernetes_server:
kube_api_server:
from_secret: kubernetes_server
kubernetes_cert:
from_secret: kubernetes_cert
kubernetes_token:
kube_token:
from_secret: kubernetes_token
commands:
- |-
echo ` + ServiceProductionDeploy + ` | kubectl apply -f -
# - kubectl wait --for=condition=Ready --timeout=300s -f deploy/deployment.yaml
`
const ServiceProductionDeploy = `kind: Deployment
apiVersion: apps/v1
metadata:
name: service-{{ .Name }}
namespace: {{ .NameSpace }}
labels:
app: service-{{ .Name }}
annotations:
kubesphere.io/alias-name: {{ .AliasName }}
kubesphere.io/creator: drone
spec:
replicas: 1
selector:
matchLabels:
app: service-{{ .Name }}
template:
metadata:
creationTimestamp: null
labels:
app: service-{{ .Name }}
spec:
volumes:
- name: host-time
hostPath:
path: /etc/localtime
type: ''
containers:
- image: 'reg.icechen.cn/{{ .NameSpace }}/service-{{ .Name }}:${DRONE_TAG}'
ports:
- containerPort: {{ .Port }}
protocol: TCP
envFrom:
- configMapRef:
name: service
env:
- name: endpoints
value: 'etcd:2379'
resources:
limits:
cpu: 200m
memory: 1000Mi
requests:
cpu: 50m
memory: 200Mi
volumeMounts:
- name: host-time
readOnly: true
mountPath: /etc/localtime
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
serviceAccountName: default
serviceAccount: default
securityContext: {}
imagePullSecrets:
- name: registry-secret
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
---
kind: Service
apiVersion: v1
metadata:
name: service-{{ .Name }}
namespace: {{ .NameSpace }}
labels:
app: service-{{ .Name }}
spec:
ports:
- name: http-service-{{ .Name }}
protocol: TCP
port: 80
targetPort: {{ .Port }}
selector:
app: service-{{ .Name }}
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
kube_certificate:
from_secret: kubernetes_cert
chart: ./{{ .Root }}/deploy
release: service-{{ .Name }}
wait: true
values:
- nameSpace={{ .NameSpace }}
- aliasName={{ .AliasName }}
- image=reg.icechen.cn/{{ .NameSpace }}/service-{{ .Name }}
- imageTag=${DRONE_TAG}
- port={{ .Port }}
`

View File

@ -21,108 +21,21 @@ steps:
dockerfile: ./{{ .Root }}/Dockerfile
- name: deploy
image: sinlead/drone-kubectl
image: bitsbeats/drone-helm3
settings:
kubernetes_server:
kube_api_server:
from_secret: kubernetes_server_test
kubernetes_cert:
from_secret: kubernetes_cert_test
kubernetes_token:
kube_token:
from_secret: kubernetes_token_test
commands:
- |-
echo ` + ServiceTestDeploy + ` | kubectl apply -f -
# - kubectl wait --for=condition=Ready --timeout=300s -f deploy/deployment.yaml
`
const ServiceTestDeploy = `kind: Deployment
apiVersion: apps/v1
metadata:
name: service-{{ .Name }}-test
namespace: {{ .NameSpace }}
labels:
app: service-{{ .Name }}-test
annotations:
kubesphere.io/alias-name: {{ .AliasName }}
kubesphere.io/creator: drone
spec:
replicas: 1
selector:
matchLabels:
app: service-{{ .Name }}-test
template:
metadata:
creationTimestamp: null
labels:
app: service-{{ .Name }}-test
spec:
volumes:
- name: host-time
hostPath:
path: /etc/localtime
type: ''
containers:
- image: 'reg.icechen.cn/{{ .NameSpace }}/service-{{ .Name }}:${DRONE_COMMIT:0:8}'
ports:
- containerPort: {{ .Port }}
protocol: TCP
envFrom:
- configMapRef:
name: service
env:
- name: endpoints
value: 'etcd:2379'
resources:
limits:
cpu: 200m
memory: 1000Mi
requests:
cpu: 50m
memory: 200Mi
volumeMounts:
- name: host-time
readOnly: true
mountPath: /etc/localtime
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
serviceAccountName: default
serviceAccount: default
securityContext: {}
imagePullSecrets:
- name: registry-secret
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
---
kind: Service
apiVersion: v1
metadata:
name: service-{{ .Name }}-test
namespace: {{ .NameSpace }}
labels:
app: service-{{ .Name }}-test
spec:
ports:
- name: http-service-{{ .Name }}-test
protocol: TCP
port: 80
targetPort: {{ .Port }}
selector:
app: service-{{ .Name }}-test
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
kube_certificate:
from_secret: kubernetes_cert_test
chart: ./{{ .Root }}/deploy
release: service-{{ .Name }}
wait: true
values:
- nameSpace={{ .NameSpace }}
- aliasName={{ .AliasName }}
- image=reg.icechen.cn/{{ .NameSpace }}/service-{{ .Name }}
- imageTag=${DRONE_COMMIT:0:8}
- port={{ .Port }}
`