Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement workflow templates and workflows for decapod v2 #25

Merged
merged 8 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions templates/argo-cd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM alpine:3.7
RUN apk update && apk add --no-cache curl bash

WORKDIR /workspace
RUN curl -sSL -o /workspace/argocd https://github.com/argoproj/argo-cd/releases/download/v2.0.1/argocd-linux-amd64
RUN chmod +x /workspace/argocd
62 changes: 62 additions & 0 deletions templates/argo-cd/createapp-wftpl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: create-application
spec:
arguments:
parameters:
- name: site_name
value: "hanu-deploy-apps"
- name: app_name
value: "lma"
templates:
- name: createApp
inputs:
parameters:
- name: path
- name: namespace
activeDeadlineSeconds: 900
container:
name: 'create'
image: docker.io/sktdev/argocd:latest
command:
- /bin/bash
- -c
- |
# log into Argo CD server
./argocd login $ARGO_SERVER --insecure --username $ARGO_USERNAME --password $ARGO_PASSWORD

# check if app already exists.
./argocd app get $PATH
if [[ $? -ne 0 ]]; then
# create new application if not exists.
./argocd app create $PATH --repo $REPO --path $SITE_NAME/$APP_NAME/$PATH --dest-namespace $NAMESPACE --dest-name $SITE_NAME --directory-recurse
fi

./argocd app sync $PATH --async
./argocd app wait $PATH --health
envFrom:
- secretRef:
name: "decapod-argocd-config"
env:
- name: PATH
value: "{{inputs.parameters.path}}"
- name: SITE_NAME
value: "{{workflow.parameters.site_name}}"
- name: APP_NAME
value: "{{workflow.parameters.app_name}}"
- name: NAMESPACE
value: "{{inputs.parameters.namespace}}"

- name: AppGroup
inputs:
parameters:
- name: list
steps:
- - name: "InstallAppGroup"
template: createApp
arguments:
parameters:
- {name: path, value: "{{item.path}}"}
- {name: namespace, value: "{{item.namespace}}"}
withParam: "{{inputs.parameters.list}}"
47 changes: 47 additions & 0 deletions templates/argo-cd/prepare-argocd-wftpl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: prepare-argocd
spec:
startpoint: configuration
arguments:
parameters:
- name: repository_url
value: "https://github.com/openinfradev/decapod-site-cd"
- name: argo_server
value: "192.168.97.192:30080"
- name: argo_username
value: "admin"
- name: argo_password
value: "password"
templates:
- name: configuration
activeDeadlineSeconds: 120
container:
name: 'config'
image: k8s.gcr.io/hyperkube:v1.18.8
command:
- /bin/bash
- -c
- |
kubectl get secret decapod-argocd-config -nargo

if [[ $? =~ 0 ]]; then
kubectl delete secret decapod-argocd-config -nargo
fi

kubectl create secret generic decapod-argocd-config -nargo \
--from-literal=ARGO_SERVER=$ARGO_SERVER \
--from-literal=ARGO_USERNAME=$ARGO_USERNAME \
--from-literal=ARGO_PASSWORD=$ARGO_PASSWORD \
--from-literal=REPO=$REPO

env:
- name: ARGO_SERVER
value: "{{workflow.parameters.argo_server}}"
- name: ARGO_USERNAME
value: "{{workflow.parameters.argo_username}}"
- name: ARGO_PASSWORD
value: "{{workflow.parameters.argo_password}}"
- name: REPO
value: "{{workflow.parameters.repository_url}}"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
104 changes: 104 additions & 0 deletions workflows/v2/lma-federation-wf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: lma-federation-
namespace: argo
spec:
entrypoint: deploy
arguments:
parameters:
- name: site_name
value: "hanu-deploy-apps"
- name: app_name
value: "lma"
templates:
- name: deploy
dag:
tasks:
- name: operator
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "prometheus-operator", "namespace": "lma" },
{ "path": "eck-operator", "namespace": "lma" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eck-operator 는 generated yaml 에서 설치될 namespace 를 elastic-system 으로 정의되어 있어 namespace 를 lma 에서 elastic-system 으로 바꿔야 합니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정하였습니다

{ "path": "fluentbit-operator", "namespace": "lma" }
]
dependencies: []
- name: logging
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "eck-resource", "namespace": "lma" },
{ "path": "fluentbit", "namespace": "lma" },
{ "path": "kubernetes-event-exporter", "namespace": "lma" }
]
dependencies: [operator]
- name: prepare-lma
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "thanos-config", "namespace": "lma" }
]
dependencies: [operator]

- name: prometheus
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "prometheus", "namespace": "lma" },
{ "path": "kube-state-metrics", "namespace": "lma" },
{ "path": "prometheus-process-exporter", "namespace": "lma" },
{ "path": "prometheus-pushgateway", "namespace": "lma" },
{ "path": "prometheus-node-exporter", "namespace": "lma" },
{ "path": "prometheus-adapter", "namespace": "lma" },
{ "path": "addons", "namespace": "lma" }
]
dependencies: [prepare-lma]

- name: federation
templateRef:
name: create-application
template: ChartGroup
arguments:
parameters:
- name: chart_list
value: |
[
{ "path": "prometheus-fed-master", "namespace": "fed" },
{ "path": "fed-addons", "namespace": "fed" },
{ "path": "thanos", "namespace": "fed" }
]
dependencies: [prometheus,logging]

- name: grafana
templateRef:
name: create-application
template: ChartGroup
arguments:
parameters:
- name: chart_list
value: |
[
{ "path": "grafana", "namespace": "fed" }
]
dependencies: [federation]
76 changes: 76 additions & 0 deletions workflows/v2/lma-wf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: lma-
namespace: argo
spec:
entrypoint: deploy
arguments:
parameters:
- name: site_name
value: "hanu-deploy-apps"
- name: app_name
value: "lma"
templates:
- name: deploy
dag:
tasks:
- name: operator
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "prometheus-operator", "namespace": "lma" },
{ "path": "eck-operator", "namespace": "lma" },
{ "path": "fluentbit-operator", "namespace": "lma" }
]
dependencies: []
- name: logging
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "eck-resource", "namespace": "lma" },
{ "path": "fluentbit", "namespace": "lma" },
{ "path": "kubernetes-event-exporter", "namespace": "lma" }
]
dependencies: [operator]
- name: prepare-lma
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "thanos-config", "namespace": "lma" }
]
dependencies: [operator]

- name: prometheus
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "prometheus", "namespace": "lma" },
{ "path": "kube-state-metrics", "namespace": "lma" },
{ "path": "prometheus-process-exporter", "namespace": "lma" },
{ "path": "prometheus-pushgateway", "namespace": "lma" },
{ "path": "prometheus-node-exporter", "namespace": "lma" },
{ "path": "prometheus-adapter", "namespace": "lma" },
{ "path": "addons", "namespace": "lma" }
]
dependencies: [prepare-lma]
71 changes: 71 additions & 0 deletions workflows/v2/openstack-components-wf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: openstack-components-
namespace: argo
spec:
entrypoint: deploy
arguments:
parameters:
- name: site_name
value: "hanu-deploy-apps"
- name: app_name
value: "openstack"
templates:
- name: deploy
dag:
tasks:
- name: base
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "keystone", "namespace": "openstack" },
{ "path": "glance", "namespace": "openstack" },
{ "path": "cinder", "namespace": "openstack" }
]
dependencies: []
- name: compute-kit
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "libvirt", "namespace": "openstack" },
{ "path": "nova", "namespace": "openstack" },
{ "path": "neutron", "namespace": "openstack" }
]
dependencies: [base]
- name: addon
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "horizon", "namespace": "openstack" },
{ "path": "heat", "namespace": "openstack" },
{ "path": "prometheus-openstack-exporter", "namespace": "openstack" }
]
dependencies: [base,compute-kit]
- name: sona
templateRef:
name: create-application
template: AppGroup
arguments:
parameters:
- name: list
value: |
[
{ "path": "horizon", "namespace": "openstack" },
]
dependencies: [addon]