From 45ddf6e35f28d32bbbc25853d9143b61507f0d61 Mon Sep 17 00:00:00 2001 From: Sayan Biswas Date: Wed, 12 Jul 2023 05:17:38 +0530 Subject: [PATCH] Fix tekton results structure Simplify tekton results folder structure and add service monitor config. --- .../tekton-results/kustomization.yaml | 2 +- developer/openshift/reset.sh | 2 +- .../pipeline-service/kustomization.yaml | 2 +- .../{base => }/api-db-config.yaml | 0 .../{base => }/api-migrator-config.yaml | 0 .../tekton-results/{base => }/api-route.yaml | 0 .../{base => }/api-s3-config.yaml | 0 .../{base => }/api-service-sync.yaml | 0 .../{base => }/api-service-tls.yaml | 0 .../tekton-results/{base => }/api-sync.yaml | 0 .../{base/env/config => config.env} | 0 .../{base => }/delete-postgres-configmap.yaml | 0 .../{base => }/delete-postgres-service.yaml | 0 .../delete-postgres-statefulset.yaml | 0 .../{base => }/kustomization.yaml | 3 +- .../tekton-results/{base => }/namespace.yaml | 0 .../tekton-results/service-monitor.yaml | 76 +++++++++++++++++++ .../{base => }/watcher-config.yaml | 0 .../{base => }/watcher-logging-rbac.yaml | 0 .../{base => }/watcher-logging.yaml | 0 .../{base => }/watcher-service-sync.yaml | 0 .../{base => }/watcher-sync.yaml | 0 22 files changed, 81 insertions(+), 4 deletions(-) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/api-db-config.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/api-migrator-config.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/api-route.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/api-s3-config.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/api-service-sync.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/api-service-tls.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/api-sync.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base/env/config => config.env} (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/delete-postgres-configmap.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/delete-postgres-service.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/delete-postgres-statefulset.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/kustomization.yaml (97%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/namespace.yaml (100%) create mode 100644 operator/gitops/argocd/pipeline-service/tekton-results/service-monitor.yaml rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/watcher-config.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/watcher-logging-rbac.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/watcher-logging.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/watcher-service-sync.yaml (100%) rename operator/gitops/argocd/pipeline-service/tekton-results/{base => }/watcher-sync.yaml (100%) diff --git a/developer/openshift/gitops/argocd/pipeline-service/tekton-results/kustomization.yaml b/developer/openshift/gitops/argocd/pipeline-service/tekton-results/kustomization.yaml index 944cc42c4..13b973dcb 100644 --- a/developer/openshift/gitops/argocd/pipeline-service/tekton-results/kustomization.yaml +++ b/developer/openshift/gitops/argocd/pipeline-service/tekton-results/kustomization.yaml @@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - ../../../../../../operator/gitops/argocd/pipeline-service/tekton-results/base + - ../../../../../../operator/gitops/argocd/pipeline-service/tekton-results patches: - path: minio-create-bucket.yaml diff --git a/developer/openshift/reset.sh b/developer/openshift/reset.sh index 9ce4622dd..fd891b1ef 100755 --- a/developer/openshift/reset.sh +++ b/developer/openshift/reset.sh @@ -245,7 +245,7 @@ uninstall_operators_and_controllers(){ fi printf "\n Uninstalling tekton-results:\n" - kubectl delete -k "$GITOPS_DIR/tekton-results/base" --ignore-not-found=true + kubectl delete -k "$GITOPS_DIR/tekton-results" --ignore-not-found=true tkn_results_ns=$(kubectl get ns | grep -ie "tekton-results" | cut -d " " -f 1) if [[ -n "$pac_ns" ]]; then kubectl delete ns "$tkn_results_ns" diff --git a/operator/gitops/argocd/pipeline-service/kustomization.yaml b/operator/gitops/argocd/pipeline-service/kustomization.yaml index a9e707c77..6ac382a8a 100644 --- a/operator/gitops/argocd/pipeline-service/kustomization.yaml +++ b/operator/gitops/argocd/pipeline-service/kustomization.yaml @@ -5,7 +5,7 @@ kind: Kustomization resources: - openshift-pipelines - tekton-chains - - tekton-results/base + - tekton-results - metrics-exporter # Skip applying the Tekton operands while the Tekton operator is being installed. diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/api-db-config.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/api-db-config.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/api-db-config.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/api-db-config.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/api-migrator-config.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/api-migrator-config.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/api-migrator-config.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/api-migrator-config.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/api-route.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/api-route.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/api-route.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/api-route.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/api-s3-config.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/api-s3-config.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/api-s3-config.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/api-s3-config.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/api-service-sync.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/api-service-sync.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/api-service-sync.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/api-service-sync.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/api-service-tls.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/api-service-tls.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/api-service-tls.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/api-service-tls.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/api-sync.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/api-sync.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/api-sync.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/api-sync.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/env/config b/operator/gitops/argocd/pipeline-service/tekton-results/config.env similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/env/config rename to operator/gitops/argocd/pipeline-service/tekton-results/config.env diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/delete-postgres-configmap.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/delete-postgres-configmap.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/delete-postgres-configmap.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/delete-postgres-configmap.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/delete-postgres-service.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/delete-postgres-service.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/delete-postgres-service.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/delete-postgres-service.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/delete-postgres-statefulset.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/delete-postgres-statefulset.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/delete-postgres-statefulset.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/delete-postgres-statefulset.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/kustomization.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/kustomization.yaml similarity index 97% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/kustomization.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/kustomization.yaml index e959941ae..1a90edffd 100644 --- a/operator/gitops/argocd/pipeline-service/tekton-results/base/kustomization.yaml +++ b/operator/gitops/argocd/pipeline-service/tekton-results/kustomization.yaml @@ -7,6 +7,7 @@ resources: - namespace.yaml - api-route.yaml - watcher-logging-rbac.yaml + - service-monitor.yaml images: - name: ko://github.com/tektoncd/results/cmd/api @@ -23,7 +24,7 @@ images: configMapGenerator: - behavior: replace files: - - env/config + - config.env name: api-config namespace: tekton-pipelines options: diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/namespace.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/namespace.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/namespace.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/namespace.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/service-monitor.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/service-monitor.yaml new file mode 100644 index 000000000..4668aa8bd --- /dev/null +++ b/operator/gitops/argocd/pipeline-service/tekton-results/service-monitor.yaml @@ -0,0 +1,76 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: metrics-reader + namespace: tekton-results +--- +apiVersion: v1 +kind: Secret +metadata: + name: metrics-reader + namespace: tekton-results + annotations: + kubernetes.io/service-account.name: metrics-reader +type: kubernetes.io/service-account-token +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: tekton-results-service-metrics-reader +rules: + - nonResourceURLs: + - /metrics + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: prometheus-tekton-results-service-metrics-reader +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: tekton-results-service-metrics-reader +subjects: + - kind: ServiceAccount + name: metrics-reader + namespace: tekton-results +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: tekton-results-api + namespace: tekton-results +spec: + endpoints: + - path: /metrics + port: prometheus + scheme: http + bearerTokenSecret: + name: "metrics-reader" + key: token + tlsConfig: + insecureSkipVerify: true + selector: + matchLabels: + app.kubernetes.io/name: tekton-results-api +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: tekton-results-watcher + namespace: tekton-results +spec: + endpoints: + - path: /metrics + port: metrics + scheme: http + bearerTokenSecret: + name: "metrics-reader" + key: token + tlsConfig: + insecureSkipVerify: true + selector: + matchLabels: + app.kubernetes.io/name: tekton-results-watcher diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/watcher-config.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/watcher-config.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/watcher-config.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/watcher-config.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/watcher-logging-rbac.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/watcher-logging-rbac.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/watcher-logging-rbac.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/watcher-logging-rbac.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/watcher-logging.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/watcher-logging.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/watcher-logging.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/watcher-logging.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/watcher-service-sync.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/watcher-service-sync.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/watcher-service-sync.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/watcher-service-sync.yaml diff --git a/operator/gitops/argocd/pipeline-service/tekton-results/base/watcher-sync.yaml b/operator/gitops/argocd/pipeline-service/tekton-results/watcher-sync.yaml similarity index 100% rename from operator/gitops/argocd/pipeline-service/tekton-results/base/watcher-sync.yaml rename to operator/gitops/argocd/pipeline-service/tekton-results/watcher-sync.yaml