Skip to content

Instantly share code, notes, and snippets.

@bells17
Created June 17, 2019 09:26
Show Gist options
  • Save bells17/4bb71580fa68db944afd9c77afaadb63 to your computer and use it in GitHub Desktop.
Save bells17/4bb71580fa68db944afd9c77afaadb63 to your computer and use it in GitHub Desktop.
argo-sample.txt
# install argo cli
$ brew install argoproj/tap/argo
# install argo workflows to kuberenets
$ kubectl create ns argo
$ kubectl apply -n argo -f https://raw.githubusercontent.com/argoproj/argo/v2.2.1/manifests/install.yaml
# hello world
$ argo submit --watch https://raw.githubusercontent.com/argoproj/argo/master/examples/hello-world.yaml
$ argo list
NAME STATUS AGE DURATION
hello-world-b4mzh Succeeded 2h 1m
$ argo get hello-world-b4mzh
Name: hello-world-b4mzh
Namespace: default
ServiceAccount: default
Status: Succeeded
Created: Tue May 07 14:28:37 +0900 (2 hours ago)
Started: Tue May 07 14:28:37 +0900 (2 hours ago)
Finished: Tue May 07 14:29:58 +0900 (2 hours ago)
Duration: 1 minute 21 seconds
STEP PODNAME DURATION MESSAGE
✔ hello-world-b4mzh hello-world-b4mzh 1m
$ argo logs hello-world-b4mzh
_____________
< hello world >
-------------
\
\
\
## .
## ## ## ==
## ## ## ## ===
/""""""""""""""""___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\______/
$ argo --help
argo is the command line interface to Argo
Usage:
argo [flags]
argo [command]
Available Commands:
completion output shell completion code for the specified shell (bash or zsh)
delete delete a workflow and its associated pods
get display details about a workflow
help Help about any command
lint validate a file or directory of workflow manifests
list list workflows
logs view logs of a workflow
resubmit resubmit a workflow
resume resume a workflow
retry retry a workflow
submit submit a workflow
suspend suspend a workflow
terminate terminate a workflow
version Print version information
wait waits for a workflow to complete
watch watch a workflow until it completes
# install argo events
$ kubectl create namespace argo-events
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/argo-events-sa.yaml
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/argo-events-cluster-roles.yaml
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/sensor-crd.yaml
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/gateway-crd.yaml
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/sensor-controller-configmap.yaml
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/$ sensor-controller-deployment.yaml
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/gateway-controller-configmap.yaml
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/gateway-controller-deployment.yaml
# ↓ webhook のサンプル動かなかった
# getting started argo events
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/event-sources/webhook.yaml
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/webhook.yaml
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/sensors/webhook.yaml
$ curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST http://10.96.129.134:30793/index
# calendar は動いた
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/event-sources/calendar.yaml
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/calendar.yaml
$ kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/sensors/calendar.yaml
kubectl get po -n argo-events
NAME READY STATUS RESTARTS AGE
calendar-gateway 2/2 Running 1 1m
calendar-sensor 1/1 Running 0 1m
calendar-workflow-6lrg2 0/2 Completed 0 17s
calendar-workflow-lql6h 0/2 Completed 0 36s
calendar-workflow-lxx4x 0/2 Completed 0 26s
calendar-workflow-vrcgm 0/2 Completed 0 7s
gateway-controller-864cc8cf5b-f4vpg 1/1 Running 0 20m
sensor-controller-7ddb5cf4d9-svdhx 1/1 Running 0 20m
webhook-gateway-http 2/2 Running 1 8m
webhook-sensor 1/1 Running 0 8m
⋊> ~/d/w/m/x/store-event on master ⨯ argo list 15:25:18
NAME STATUS AGE DURATION
coinflip-724q2 Succeeded 1d 37s
hello-world-rdbhg Succeeded 1d 6s
hello-world-b4mzh Succeeded 1d 1m
⋊> ~/d/w/m/x/store-event on master ⨯ argo list -n argo-events 15:25:26
NAME STATUS AGE DURATION
calendar-workflow-qfzj9 Running 2s 2s
calendar-workflow-wlgw6 Succeeded 11s 6s
calendar-workflow-vrcgm Succeeded 21s 6s
calendar-workflow-6lrg2 Succeeded 31s 7s
calendar-workflow-lxx4x Succeeded 40s 6s
calendar-workflow-lql6h Succeeded 50s 5s
⋊> ~/d/w/m/x/store-event on master ⨯ argo get calendar-workflow-lql6h 15:25:40
2019/05/08 15:25:41 workflows.argoproj.io "calendar-workflow-lql6h" not found
⋊> ~/d/w/m/x/store-event on master ⨯ argo get calendar-workflow-lql6h -n argo-events 15:25:41
Name: calendar-workflow-lql6h
Namespace: argo-events
ServiceAccount: default
Status: Succeeded
Created: Wed May 08 15:24:41 +0900 (1 minute ago)
Started: Wed May 08 15:24:41 +0900 (1 minute ago)
Finished: Wed May 08 15:24:46 +0900 (1 minute ago)
Duration: 5 seconds
Parameters:
message: {"eventTime":"2019-05-08T06:24:41.0005655Z","userPayload":""}
STEP PODNAME DURATION MESSAGE
✔ calendar-workflow-lql6h calendar-workflow-lql6h 5s
⋊> ~/d/w/m/x/store-event on master ⨯ argo logs calendar-workflow-lql6h -n argo-events 15:25:46
_________________________________________
/ {"eventTime":"2019-05-08T06:24:41.00056 \
\ 55Z","userPayload":""} /
-----------------------------------------
\
\
\
## .
## ## ## ==
## ## ## ## ===
/""""""""""""""""___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\______/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment