diff --git a/templates/argo-cd/Dockerfile b/templates/argo-cd/Dockerfile new file mode 100644 index 0000000..8c2907d --- /dev/null +++ b/templates/argo-cd/Dockerfile @@ -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 diff --git a/templates/argo-cd/createapp-wftpl.yaml b/templates/argo-cd/createapp-wftpl.yaml new file mode 100644 index 0000000..eeec21c --- /dev/null +++ b/templates/argo-cd/createapp-wftpl.yaml @@ -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}}" diff --git a/templates/argo-cd/prepare-argocd-wftpl.yaml b/templates/argo-cd/prepare-argocd-wftpl.yaml new file mode 100644 index 0000000..a1407eb --- /dev/null +++ b/templates/argo-cd/prepare-argocd-wftpl.yaml @@ -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}}" \ No newline at end of file diff --git a/workflows/lma-federation-wf.yaml b/workflows/v1/lma-federation-wf.yaml similarity index 100% rename from workflows/lma-federation-wf.yaml rename to workflows/v1/lma-federation-wf.yaml diff --git a/workflows/lma-wf.yaml b/workflows/v1/lma-wf.yaml similarity index 100% rename from workflows/lma-wf.yaml rename to workflows/v1/lma-wf.yaml diff --git a/workflows/openstack-components-wf.yaml b/workflows/v1/openstack-components-wf.yaml similarity index 100% rename from workflows/openstack-components-wf.yaml rename to workflows/v1/openstack-components-wf.yaml diff --git a/workflows/openstack-infra-wf.yaml b/workflows/v1/openstack-infra-wf.yaml similarity index 100% rename from workflows/openstack-infra-wf.yaml rename to workflows/v1/openstack-infra-wf.yaml diff --git a/workflows/service-mesh-wf.yaml b/workflows/v1/service-mesh-wf.yaml similarity index 100% rename from workflows/service-mesh-wf.yaml rename to workflows/v1/service-mesh-wf.yaml diff --git a/workflows/v2/lma-federation-wf.yaml b/workflows/v2/lma-federation-wf.yaml new file mode 100644 index 0000000..6e1de77 --- /dev/null +++ b/workflows/v2/lma-federation-wf.yaml @@ -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-reference" + - 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": "elastic-system" }, + { "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: AppGroup + arguments: + parameters: + - name: 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: AppGroup + arguments: + parameters: + - name: list + value: | + [ + { "path": "grafana", "namespace": "fed" } + ] + dependencies: [federation] diff --git a/workflows/v2/lma-wf.yaml b/workflows/v2/lma-wf.yaml new file mode 100644 index 0000000..554932e --- /dev/null +++ b/workflows/v2/lma-wf.yaml @@ -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-reference" + - 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": "elastic-system" }, + { "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] diff --git a/workflows/v2/openstack-components-wf.yaml b/workflows/v2/openstack-components-wf.yaml new file mode 100644 index 0000000..c41e929 --- /dev/null +++ b/workflows/v2/openstack-components-wf.yaml @@ -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-reference" + - 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] \ No newline at end of file diff --git a/workflows/v2/openstack-infra-wf.yaml b/workflows/v2/openstack-infra-wf.yaml new file mode 100644 index 0000000..06654bc --- /dev/null +++ b/workflows/v2/openstack-infra-wf.yaml @@ -0,0 +1,33 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Workflow +metadata: + generateName: openstack-infra- + namespace: argo +spec: + entrypoint: deploy + arguments: + parameters: + - name: site_name + value: "hanu-reference" + - name: app_name + value: "openstack" + templates: + - name: deploy + dag: + tasks: + - name: operator + templateRef: + name: create-application + template: AppGroup + arguments: + parameters: + - name: list + value: | + [ + { "path": "ceph-provisioners", "namespace": "openstack" }, + { "path": "ingress", "namespace": "openstack" }, + { "path": "memcached", "namespace": "openstack" }, + { "path": "rabbitmq", "namespace": "openstack" }, + { "path": "mariadb", "namespace": "openstack" } + ] + dependencies: [] \ No newline at end of file diff --git a/workflows/v2/service-mesh-wf.yaml b/workflows/v2/service-mesh-wf.yaml new file mode 100644 index 0000000..2e4e82d --- /dev/null +++ b/workflows/v2/service-mesh-wf.yaml @@ -0,0 +1,44 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Workflow +metadata: + generateName: service-mesh- + namespace: argo +spec: + entrypoint: deploy + arguments: + parameters: + - name: site_name + value: "hanu-reference" + - name: app_name + value: "service-mesh" + templates: + - name: deploy + dag: + tasks: + - name: operator + templateRef: + name: create-application + template: AppGroup + arguments: + parameters: + - name: list + value: | + [ + { "path": "istio-operator", "namespace": "istio-system" }, + { "path": "jaeger-operator", "namespace": "lma" } + ] + dependencies: [] + - name: resource + templateRef: + name: create-application + template: AppGroup + arguments: + parameters: + - name: list + value: | + [ + { "path": "kiali-operator", "namespace": "istio-system" }, + { "path": "service-mesh-controlplane", "namespace": "istio-system" }, + { "path": "service-mesh-gateway", "namespace": "istio-system" } + ] + dependencies: [operator]