-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathargo-workflow.yaml
122 lines (118 loc) · 4.23 KB
/
argo-workflow.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
apiVersion: argoproj.io/v1alpha1
kind: Workflow #new type of k8s spec
metadata:
generateName: argo-build-
spec:
entrypoint: argo-build
arguments:
parameters:
- name: block-name
value: dummy-block-name
- name: version
value: dummy-version
- name: dockerhub-password
value: password
- name: dockerhub-username
value: username
- name: image-tag
value: test4
volumeClaimTemplates: #define volume, same syntax as k8s Pod spec
- metadata:
name: workdir #name of volume claim
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
templates:
- name: argo-build
steps:
- - name: build
template: build
- - name: update-front-end
template: update-front-end
- name: build
inputs:
artifacts:
- name: argo-source
path: /app/src
git:
repo: https://github.com/SnehaMore20/front-end.git
revision: "argo-hack"
container:
image: docker:17.10
command: [sh, -c]
args: ["until docker ps; do sleep 3; done; cd /app/src/; GROUP='{{workflow.parameters.dockerhub-username}}' COMMIT='{{workflow.parameters.image-tag}}' ./scripts/build.sh; docker login -u='{{workflow.parameters.dockerhub-username}}' -p='{{workflow.parameters.dockerhub-password}}'; docker push '{{workflow.parameters.dockerhub-username}}'/argo-hack:'{{workflow.parameters.image-tag}}'"]
env:
- name: DOCKER_HOST #the docker daemon can be access on the standard port on localhost
value: 127.0.0.1
sidecars:
- name: dind
image: docker:17.10-dind #Docker already provides an image for running a Docker daemon
securityContext:
privileged: true #the Docker daemon can only run in a privileged container
# mirrorVolumeMounts will mount the same volumes specified in the main container
# to the sidecar (including artifacts), at the same mountPaths. This enables
# dind daemon to (partially) see the same filesystem as the main container in
# order to use features such as docker volume binding.
mirrorVolumeMounts: true
metadata:
labels:
block-name: "{{workflow.parameters.block-name}}"
version: "{{workflow.parameters.version}}"
- name: update-front-end
resource: #indicates that this is a resource template
action: apply #can be any kubectl action (e.g. create, delete, apply, patch)
manifest: | #put your kubernetes spec here
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: front-end
namespace: default
spec:
replicas: 1
template:
metadata:
labels:
name: front-end
spec:
containers:
- name: front-end
image: "{{workflow.parameters.dockerhub-username}}/argo-hack:{{workflow.parameters.image-tag}}"
resources:
limits:
cpu: 300m
memory: 1000Mi
requests:
cpu: 100m
memory: 300Mi
ports:
- containerPort: 8079
env:
- name: SESSION_REDIS
value: "true"
securityContext:
runAsNonRoot: true
runAsUser: 10001
capabilities:
drop:
- all
readOnlyRootFilesystem: true
livenessProbe:
httpGet:
path: /
port: 8079
initialDelaySeconds: 300
periodSeconds: 3
readinessProbe:
httpGet:
path: /
port: 8079
initialDelaySeconds: 30
periodSeconds: 3
nodeSelector:
beta.kubernetes.io/os: linux
metadata:
labels:
block-name: "{{workflow.parameters.block-name}}"
version: "{{workflow.parameters.version}}"