135 lines (109 loc) · 6.62 KB
/
argo-events-memcached-operator-test.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
123
124
125
126
127
128
129
130
131
132
133
134
135
on: workflow_dispatch
jobs:
test-operator-installation:
runs-on: ubuntu-latest
env:
EVENTS_NS: argo-events
BRANCH_NAME: ${GITHUB_REF##*/}
steps:
- name: Install k3s
uses: debianmaster/actions-k3s@master
id: k3s
with:
version: 'latest'
- name: Create namespaces
run: |
for ns in argo-events argo services
do
kubectl create ns ${ns}
done
- name: Install Argo Events cluster-wide (don't do this in production)
run: |
kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/install.yaml
sleep 10
kubectl wait -n ${EVENTS_NS} --for=condition=available --timeout=60s deployment/eventsource-controller
kubectl wait -n ${EVENTS_NS} --for=condition=available --timeout=60s deployment/sensor-controller
# Install with a validating admission controller
kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/install-validating-webhook.yaml
kubectl wait -n ${EVENTS_NS} --for=condition=available --timeout=60s deployment/events-webhook
- name: Install EventBus
run: |
kubectl apply -n ${EVENTS_NS} -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/eventbus/native.yaml
kubectl wait -n ${EVENTS_NS} --for=condition=available --timeout=60s deployment/eventbus-controller
- name: Install Argo Workflows cluster-wide
run: |
kubectl -n argo apply -k github.com/argoproj/argo-workflows/manifests/cluster-install?ref=master
# Use "pns" executor instead of Docker:
# See https://github.com/argoproj/argo-workflows/issues/826#issuecomment-872426083
kubectl patch -n argo configmap workflow-controller-configmap --patch '{"data":{"containerRuntimeExecutor":"pns"}}'
# Disable default login
kubectl patch -n argo deployment argo-server --patch='{"spec":{"template":{"spec":{"containers":[{"name":"argo-server","args":["server","--auth-mode=server"]}]}}}}'
sleep 10
kubectl wait -n argo --for=condition=available --timeout=240s deployment/argo-server
kubectl wait -n argo --for=condition=available --timeout=60s deployment/workflow-controller
- name: Install the Argo CLI
run: |
curl -sLO https://github.com/argoproj/argo-workflows/releases/download/v3.2.8/argo-linux-amd64.gz
gunzip argo-linux-amd64.gz
chmod +x argo-linux-amd64
mv argo-linux-amd64 argo
./argo version
- name: Install the Memcached custom resource definition
run: |
kubectl apply -f https://raw.githubusercontent.com/reinvantveer/reinvantveer.github.io/${GITHUB_REF##*/}/_includes/memcached/crd.yaml
- name: Install the rule-based access control (RBAC) config
run: |
kubectl apply -n ${EVENTS_NS} -f https://raw.githubusercontent.com/reinvantveer/reinvantveer.github.io/${GITHUB_REF##*/}/_includes/memcached/rbac.yaml
- name: Validate that the rules allow watching Memcached resources, create Deployments, Pods, Workflows
run: |
kubectl -n ${EVENTS_NS} auth can-i list memcached.cache.example.com/memcacheds --as=system:serviceaccount:${EVENTS_NS}:memcached-sa
kubectl -n ${EVENTS_NS} auth can-i create deployments --as=system:serviceaccount:${EVENTS_NS}:memcached-sa
kubectl -n ${EVENTS_NS} auth can-i create pods --as=system:serviceaccount:${EVENTS_NS}:memcached-sa
kubectl -n ${EVENTS_NS} auth can-i create workflow.argoproj.io/workflows --as=system:serviceaccount:${EVENTS_NS}:memcached-sa
- name: Install the EventSource in the events namespace
run: |
kubectl apply -n ${EVENTS_NS} -f https://raw.githubusercontent.com/reinvantveer/reinvantveer.github.io/${GITHUB_REF##*/}/_includes/memcached/event-source.yaml
- name: Validate availability of the event source
run: |
kubectl wait -n ${EVENTS_NS} --for=condition=Deployed --timeout=60s eventsource/memcached-source
kubectl wait -n ${EVENTS_NS} --for=condition=SourcesProvided --timeout=60s eventsource/memcached-source
- name: Install the Sensor in the events namespace
run: |
kubectl apply -n ${EVENTS_NS} -f https://raw.githubusercontent.com/reinvantveer/reinvantveer.github.io/${GITHUB_REF##*/}/_includes/memcached/sensor.yaml
- name: Validate availability of the Sensor
run: |
kubectl wait -n ${EVENTS_NS} --for=condition=Deployed --timeout=60s sensor/memcached-sensor
kubectl wait -n ${EVENTS_NS} --for=condition=DependenciesProvided --timeout=60s sensor/memcached-sensor
kubectl wait -n ${EVENTS_NS} --for=condition=TriggersProvided --timeout=60s sensor/memcached-sensor
sleep 10
- name: Install the operator implementation details in the ConfigMap
run: |
kubectl apply -n ${EVENTS_NS} -f https://raw.githubusercontent.com/reinvantveer/reinvantveer.github.io/${GITHUB_REF##*/}/_includes/memcached/configmap.yaml
- name: Install the workflow template
run: |
kubectl apply -n ${EVENTS_NS} -f https://raw.githubusercontent.com/reinvantveer/reinvantveer.github.io/${GITHUB_REF##*/}/_includes/memcached/workflow-template.yaml
- name: Deploy our Memcached resource
run: |
kubectl apply -n services -f https://raw.githubusercontent.com/reinvantveer/reinvantveer.github.io/${GITHUB_REF##*/}/_includes/memcached/memcached.yaml
sleep 10
- name: Log the sensor output
run: |
SENSOR_DEPLOYMENT=$(kubectl get -n ${EVENTS_NS} --no-headers deployment -o custom-columns=":metadata.name" | grep memcached-sensor-)
kubectl logs -n ${EVENTS_NS} deployment/${SENSOR_DEPLOYMENT}
sleep 5
- name: Validate that a Workflow was created
run: |
WORKFLOW=$(kubectl get -n ${EVENTS_NS} workflows --no-headers -o custom-columns=":metadata.name" | grep memcached-workflow-)
kubectl get -n ${EVENTS_NS} workflow/${WORKFLOW} -o yaml
./argo -n ${EVENTS_NS} watch @latest
while kubectl get -n ${EVENTS_NS} workflow/${WORKFLOW} | grep Running
do
kubectl get -n ${EVENTS_NS} workflow/${WORKFLOW}
sleep 10
done
# Log the workflow output
./argo -n ${EVENTS_NS} logs ${WORKFLOW}
- name: Validate that the deployment was created
run: |
kubectl get -A deployments
kubectl wait -n services --for=condition=available --timeout=60s deployment/memcached-deployment