From 1e0ad975c1d2ec004baca9792cae01cdb4ccd82b Mon Sep 17 00:00:00 2001 From: Andres De Castro Date: Fri, 28 Aug 2020 11:35:40 -0400 Subject: [PATCH 1/3] added argocd exmaples --- examples/cd/argocd/README.md | 9 +++++++ examples/cd/argocd/application.yaml | 25 +++++++++++++++++++ examples/cd/argocd/appproject.yaml | 22 ++++++++++++++++ .../kube-prometheus/argocd-basic.jsonnet | 13 ++++++++++ 4 files changed, 69 insertions(+) create mode 100644 examples/cd/argocd/README.md create mode 100644 examples/cd/argocd/application.yaml create mode 100644 examples/cd/argocd/appproject.yaml create mode 100644 examples/cd/argocd/kube-prometheus/argocd-basic.jsonnet diff --git a/examples/cd/argocd/README.md b/examples/cd/argocd/README.md new file mode 100644 index 00000000..00fed8bf --- /dev/null +++ b/examples/cd/argocd/README.md @@ -0,0 +1,9 @@ +## ArgoCD Example + +This is the simplest, working example of an argocd app, the JSON object built is now an array of objects as that is the prefered format for ArgoCD. + +Requirements: + +**ArgoCD 1.7+** + +Follow the vendor generation steps at the root of this repository and generate a `vendored` folder (referenced in `application.yaml`). diff --git a/examples/cd/argocd/application.yaml b/examples/cd/argocd/application.yaml new file mode 100644 index 00000000..feaf5cf4 --- /dev/null +++ b/examples/cd/argocd/application.yaml @@ -0,0 +1,25 @@ +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: monitoring + namespace: argocd + annotations: + recipients.argocd-notifications.argoproj.io: "slack:jenkins" +spec: + destination: + namespace: monitoring + server: https://kubernetes.default.svc + project: monitoring + source: + directory: + jsonnet: + libs: + - vendored + recurse: true + path: examples/cd/argocd/kube-prometheus + repoURL: git@github.com:prometheus-operator/kube-prometheus.git + targetRevision: HEAD + syncPolicy: + automated: {} +--- diff --git a/examples/cd/argocd/appproject.yaml b/examples/cd/argocd/appproject.yaml new file mode 100644 index 00000000..a571b782 --- /dev/null +++ b/examples/cd/argocd/appproject.yaml @@ -0,0 +1,22 @@ +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + annotations: + recipients.argocd-notifications.argoproj.io: slack:alerts + generation: 1 + name: monitoring + namespace: argocd +spec: + clusterResourceWhitelist: + - group: "*" + kind: "*" + description: "Monitoring Stack deployment" + destinations: + - namespace: kube-system + server: https://kubernetes.default.svc + - namespace: default + server: https://kubernetes.default.svc + - namespace: monitoring + server: https://kubernetes.default.svc + sourceRepos: + - git@github.com:prometheus-operator/kube-prometheus.git diff --git a/examples/cd/argocd/kube-prometheus/argocd-basic.jsonnet b/examples/cd/argocd/kube-prometheus/argocd-basic.jsonnet new file mode 100644 index 00000000..20c8caa3 --- /dev/null +++ b/examples/cd/argocd/kube-prometheus/argocd-basic.jsonnet @@ -0,0 +1,13 @@ +local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + + (import 'kube-prometheus/kube-prometheus-eks.libsonnet') + { + _config+:: { + namespace: 'monitoring', + }, +}; + +[kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus)] + +[kp.prometheusOperator[name] for name in std.objectFields(kp.prometheusOperator)] + +[kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter)] + +[kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics)] + +[kp.prometheus[name] for name in std.objectFields(kp.prometheus)] + +[kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter)] From d869da16fc3ea91e82399c9a5b0d8e7bcff78e2e Mon Sep 17 00:00:00 2001 From: Andres De Castro Date: Fri, 28 Aug 2020 11:39:27 -0400 Subject: [PATCH 2/3] added entry in README.md --- README.md | 4 ++++ examples/{cd => continuous-delivery}/argocd/README.md | 0 examples/{cd => continuous-delivery}/argocd/application.yaml | 4 ++-- examples/{cd => continuous-delivery}/argocd/appproject.yaml | 0 .../argocd/kube-prometheus/argocd-basic.jsonnet | 0 5 files changed, 6 insertions(+), 2 deletions(-) rename examples/{cd => continuous-delivery}/argocd/README.md (100%) rename examples/{cd => continuous-delivery}/argocd/application.yaml (85%) rename examples/{cd => continuous-delivery}/argocd/appproject.yaml (100%) rename examples/{cd => continuous-delivery}/argocd/kube-prometheus/argocd-basic.jsonnet (100%) diff --git a/README.md b/README.md index 82ccaf29..f91b748f 100644 --- a/README.md +++ b/README.md @@ -676,6 +676,10 @@ See [exposing Prometheus/Alertmanager/Grafana](docs/exposing-prometheus-alertman To use an easy to reproduce example, see [minikube.jsonnet](examples/minikube.jsonnet), which uses the minikube setup as demonstrated in [Prerequisites](#prerequisites). Because we would like easy access to our Prometheus, Alertmanager and Grafana UIs, `minikube.jsonnet` exposes the services as NodePort type services. +## Continuous Delivery + +Working examples of use with continuous delivery tools are found in examples/continuous-delivery. + ## Troubleshooting ### Error retrieving kubelet metrics diff --git a/examples/cd/argocd/README.md b/examples/continuous-delivery/argocd/README.md similarity index 100% rename from examples/cd/argocd/README.md rename to examples/continuous-delivery/argocd/README.md diff --git a/examples/cd/argocd/application.yaml b/examples/continuous-delivery/argocd/application.yaml similarity index 85% rename from examples/cd/argocd/application.yaml rename to examples/continuous-delivery/argocd/application.yaml index feaf5cf4..1bc1264e 100644 --- a/examples/cd/argocd/application.yaml +++ b/examples/continuous-delivery/argocd/application.yaml @@ -2,7 +2,7 @@ apiVersion: argoproj.io/v1alpha1 kind: Application metadata: - name: monitoring + name: kube-prometheus namespace: argocd annotations: recipients.argocd-notifications.argoproj.io: "slack:jenkins" @@ -17,7 +17,7 @@ spec: libs: - vendored recurse: true - path: examples/cd/argocd/kube-prometheus + path: examples/continuous-delivery/argocd/kube-prometheus repoURL: git@github.com:prometheus-operator/kube-prometheus.git targetRevision: HEAD syncPolicy: diff --git a/examples/cd/argocd/appproject.yaml b/examples/continuous-delivery/argocd/appproject.yaml similarity index 100% rename from examples/cd/argocd/appproject.yaml rename to examples/continuous-delivery/argocd/appproject.yaml diff --git a/examples/cd/argocd/kube-prometheus/argocd-basic.jsonnet b/examples/continuous-delivery/argocd/kube-prometheus/argocd-basic.jsonnet similarity index 100% rename from examples/cd/argocd/kube-prometheus/argocd-basic.jsonnet rename to examples/continuous-delivery/argocd/kube-prometheus/argocd-basic.jsonnet From 4cef8bb7d96a9d3b0076cfefa04cfacb3bb170e4 Mon Sep 17 00:00:00 2001 From: Andres De Castro Date: Fri, 4 Sep 2020 09:25:36 -0400 Subject: [PATCH 3/3] Update argocd-basic.jsonnet Removed EKS patch from example --- .../argocd/kube-prometheus/argocd-basic.jsonnet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/continuous-delivery/argocd/kube-prometheus/argocd-basic.jsonnet b/examples/continuous-delivery/argocd/kube-prometheus/argocd-basic.jsonnet index 20c8caa3..bcfaedf7 100644 --- a/examples/continuous-delivery/argocd/kube-prometheus/argocd-basic.jsonnet +++ b/examples/continuous-delivery/argocd/kube-prometheus/argocd-basic.jsonnet @@ -1,5 +1,5 @@ -local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + - (import 'kube-prometheus/kube-prometheus-eks.libsonnet') + { +local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + { + _config+:: { namespace: 'monitoring', },