diff --git a/test/testdata/generate.sh b/test/testdata/generate.sh index 5f7424a89b..11dce087c1 100755 --- a/test/testdata/generate.sh +++ b/test/testdata/generate.sh @@ -113,7 +113,7 @@ function scaffold_test_project { $kb create api --group example.com --version v1alpha1 --kind Busybox --image=busybox:1.28 --plugins="deploy-image/v1-alpha" --make=false header_text 'Creating Memcached webhook ...' $kb create webhook --group example.com --version v1alpha1 --kind Memcached --programmatic-validation - elif [[ $project =~ "with-metrics" ]]; then + elif [[ $project =~ "with-grafana" ]]; then header_text 'Editing project with Grafana plugin ...' $kb edit --plugins=grafana.kubebuilder.io/v1-alpha fi @@ -132,16 +132,15 @@ scaffold_test_project project-v2 --project-version=2 # [Currently, default CLI plugin] - Project version 3 (default) uses plugin go/v3 (default). scaffold_test_project project-v3 scaffold_test_project project-v3-multigroup -scaffold_test_project project-v3-declarative-v1 --plugins="go/v3,declarative,grafana/v1-alpha" +scaffold_test_project project-v3-declarative-v1 --plugins="go/v3,declarative" scaffold_test_project project-v3-config --component-config scaffold_test_project project-v3-with-deploy-image -scaffold_test_project project-v3-with-metrics +scaffold_test_project project-v3-with-grafana # [Next version, alpha] Project version v4-alpha scaffold_test_project project-v4 --plugins="go/v4-alpha" scaffold_test_project project-v4-multigroup --plugins="go/v4-alpha" -scaffold_test_project project-v4-declarative-v1 --plugins="go/v4-alpha,declarative,grafana/v1-alpha" +scaffold_test_project project-v4-declarative-v1 --plugins="go/v4-alpha,declarative" scaffold_test_project project-v4-config --component-config --plugins="go/v4-alpha" scaffold_test_project project-v4-with-deploy-image --plugins="go/v4-alpha" -scaffold_test_project project-v4-with-metrics - +scaffold_test_project project-v4-with-grafana diff --git a/test/testdata/test.sh b/test/testdata/test.sh index 690353face..31e733dec8 100755 --- a/test/testdata/test.sh +++ b/test/testdata/test.sh @@ -36,7 +36,7 @@ test_project project-v3-multigroup test_project project-v3-declarative-v1 test_project project-v3-config test_project project-v3-with-deploy-image -test_project project-v3-with-metrics +test_project project-v3-with-grafana # Project version v4-alpha test_project project-v4 @@ -44,4 +44,4 @@ test_project project-v4-multigroup test_project project-v4-declarative-v1 test_project project-v4-config test_project project-v4-with-deploy-image -test_project project-v4-with-metrics +test_project project-v4-with-grafana diff --git a/testdata/project-v3-declarative-v1/PROJECT b/testdata/project-v3-declarative-v1/PROJECT index 27ea9d4afa..858f9f647d 100644 --- a/testdata/project-v3-declarative-v1/PROJECT +++ b/testdata/project-v3-declarative-v1/PROJECT @@ -2,7 +2,6 @@ domain: testproject.org layout: - go.kubebuilder.io/v3 - declarative.go.kubebuilder.io/v1 -- grafana.kubebuilder.io/v1-alpha plugins: declarative.go.kubebuilder.io/v1: resources: @@ -18,7 +17,6 @@ plugins: group: crew kind: Admiral version: v1 - grafana.kubebuilder.io/v1-alpha: {} projectName: project-v3-declarative-v1 repo: sigs.k8s.io/kubebuilder/testdata/project-v3-declarative-v1 resources: diff --git a/testdata/project-v3-with-metrics/.dockerignore b/testdata/project-v3-with-grafana/.dockerignore similarity index 100% rename from testdata/project-v3-with-metrics/.dockerignore rename to testdata/project-v3-with-grafana/.dockerignore diff --git a/testdata/project-v3-with-metrics/.gitignore b/testdata/project-v3-with-grafana/.gitignore similarity index 100% rename from testdata/project-v3-with-metrics/.gitignore rename to testdata/project-v3-with-grafana/.gitignore diff --git a/testdata/project-v3-with-metrics/Dockerfile b/testdata/project-v3-with-grafana/Dockerfile similarity index 100% rename from testdata/project-v3-with-metrics/Dockerfile rename to testdata/project-v3-with-grafana/Dockerfile diff --git a/testdata/project-v3-with-metrics/Makefile b/testdata/project-v3-with-grafana/Makefile similarity index 100% rename from testdata/project-v3-with-metrics/Makefile rename to testdata/project-v3-with-grafana/Makefile diff --git a/testdata/project-v3-with-metrics/PROJECT b/testdata/project-v3-with-grafana/PROJECT similarity index 53% rename from testdata/project-v3-with-metrics/PROJECT rename to testdata/project-v3-with-grafana/PROJECT index 91653f71c6..329ffeaa52 100644 --- a/testdata/project-v3-with-metrics/PROJECT +++ b/testdata/project-v3-with-grafana/PROJECT @@ -3,6 +3,6 @@ layout: - go.kubebuilder.io/v3 plugins: grafana.kubebuilder.io/v1-alpha: {} -projectName: project-v3-with-metrics -repo: sigs.k8s.io/kubebuilder/testdata/project-v3-with-metrics +projectName: project-v3-with-grafana +repo: sigs.k8s.io/kubebuilder/testdata/project-v3-with-grafana version: "3" diff --git a/testdata/project-v3-with-metrics/README.md b/testdata/project-v3-with-grafana/README.md similarity index 96% rename from testdata/project-v3-with-metrics/README.md rename to testdata/project-v3-with-grafana/README.md index 54d21100de..dcf5a0eb7e 100644 --- a/testdata/project-v3-with-metrics/README.md +++ b/testdata/project-v3-with-grafana/README.md @@ -1,4 +1,4 @@ -# project-v3-with-metrics +# project-v3-with-grafana // TODO(user): Add simple overview of use/purpose ## Description @@ -18,13 +18,13 @@ kubectl apply -f config/samples/ 2. Build and push your image to the location specified by `IMG`: ```sh -make docker-build docker-push IMG=/project-v3-with-metrics:tag +make docker-build docker-push IMG=/project-v3-with-grafana:tag ``` 3. Deploy the controller to the cluster with the image specified by `IMG`: ```sh -make deploy IMG=/project-v3-with-metrics:tag +make deploy IMG=/project-v3-with-grafana:tag ``` ### Uninstall CRDs diff --git a/testdata/project-v3-with-metrics/config/default/kustomization.yaml b/testdata/project-v3-with-grafana/config/default/kustomization.yaml similarity index 96% rename from testdata/project-v3-with-metrics/config/default/kustomization.yaml rename to testdata/project-v3-with-grafana/config/default/kustomization.yaml index 2bc32a3d51..b6e6fb4530 100644 --- a/testdata/project-v3-with-metrics/config/default/kustomization.yaml +++ b/testdata/project-v3-with-grafana/config/default/kustomization.yaml @@ -1,12 +1,12 @@ # Adds namespace to all resources. -namespace: project-v3-with-metrics-system +namespace: project-v3-with-grafana-system # Value of this field is prepended to the # names of all resources, e.g. a deployment named # "wordpress" becomes "alices-wordpress". # Note that it should also match with the prefix (text before '-') of the namespace # field above. -namePrefix: project-v3-with-metrics- +namePrefix: project-v3-with-grafana- # Labels to add to all resources and selectors. #commonLabels: diff --git a/testdata/project-v3-with-metrics/config/default/manager_auth_proxy_patch.yaml b/testdata/project-v3-with-grafana/config/default/manager_auth_proxy_patch.yaml similarity index 100% rename from testdata/project-v3-with-metrics/config/default/manager_auth_proxy_patch.yaml rename to testdata/project-v3-with-grafana/config/default/manager_auth_proxy_patch.yaml diff --git a/testdata/project-v3-with-metrics/config/default/manager_config_patch.yaml b/testdata/project-v3-with-grafana/config/default/manager_config_patch.yaml similarity index 100% rename from testdata/project-v3-with-metrics/config/default/manager_config_patch.yaml rename to testdata/project-v3-with-grafana/config/default/manager_config_patch.yaml diff --git a/testdata/project-v3-with-metrics/config/manager/kustomization.yaml b/testdata/project-v3-with-grafana/config/manager/kustomization.yaml similarity index 100% rename from testdata/project-v3-with-metrics/config/manager/kustomization.yaml rename to testdata/project-v3-with-grafana/config/manager/kustomization.yaml diff --git a/testdata/project-v4-with-metrics/config/manager/manager.yaml b/testdata/project-v3-with-grafana/config/manager/manager.yaml similarity index 93% rename from testdata/project-v4-with-metrics/config/manager/manager.yaml rename to testdata/project-v3-with-grafana/config/manager/manager.yaml index ded5560630..33e137a455 100644 --- a/testdata/project-v4-with-metrics/config/manager/manager.yaml +++ b/testdata/project-v3-with-grafana/config/manager/manager.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.io/name: namespace app.kubernetes.io/instance: system app.kubernetes.io/component: manager - app.kubernetes.io/created-by: project-v4-with-metrics - app.kubernetes.io/part-of: project-v4-with-metrics + app.kubernetes.io/created-by: project-v3-with-grafana + app.kubernetes.io/part-of: project-v3-with-grafana app.kubernetes.io/managed-by: kustomize name: system --- @@ -21,8 +21,8 @@ metadata: app.kubernetes.io/name: deployment app.kubernetes.io/instance: controller-manager app.kubernetes.io/component: manager - app.kubernetes.io/created-by: project-v4-with-metrics - app.kubernetes.io/part-of: project-v4-with-metrics + app.kubernetes.io/created-by: project-v3-with-grafana + app.kubernetes.io/part-of: project-v3-with-grafana app.kubernetes.io/managed-by: kustomize spec: selector: diff --git a/testdata/project-v3-with-metrics/config/prometheus/kustomization.yaml b/testdata/project-v3-with-grafana/config/prometheus/kustomization.yaml similarity index 100% rename from testdata/project-v3-with-metrics/config/prometheus/kustomization.yaml rename to testdata/project-v3-with-grafana/config/prometheus/kustomization.yaml diff --git a/testdata/project-v3-with-metrics/config/prometheus/monitor.yaml b/testdata/project-v3-with-grafana/config/prometheus/monitor.yaml similarity index 85% rename from testdata/project-v3-with-metrics/config/prometheus/monitor.yaml rename to testdata/project-v3-with-grafana/config/prometheus/monitor.yaml index f0e477c2b6..3c5027fc3b 100644 --- a/testdata/project-v3-with-metrics/config/prometheus/monitor.yaml +++ b/testdata/project-v3-with-grafana/config/prometheus/monitor.yaml @@ -8,8 +8,8 @@ metadata: app.kubernetes.io/name: servicemonitor app.kubernetes.io/instance: controller-manager-metrics-monitor app.kubernetes.io/component: metrics - app.kubernetes.io/created-by: project-v3-with-metrics - app.kubernetes.io/part-of: project-v3-with-metrics + app.kubernetes.io/created-by: project-v3-with-grafana + app.kubernetes.io/part-of: project-v3-with-grafana app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-monitor namespace: system diff --git a/testdata/project-v4-with-metrics/config/rbac/auth_proxy_client_clusterrole.yaml b/testdata/project-v3-with-grafana/config/rbac/auth_proxy_client_clusterrole.yaml similarity index 75% rename from testdata/project-v4-with-metrics/config/rbac/auth_proxy_client_clusterrole.yaml rename to testdata/project-v3-with-grafana/config/rbac/auth_proxy_client_clusterrole.yaml index a1e848419b..1b5672c36c 100644 --- a/testdata/project-v4-with-metrics/config/rbac/auth_proxy_client_clusterrole.yaml +++ b/testdata/project-v3-with-grafana/config/rbac/auth_proxy_client_clusterrole.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrole app.kubernetes.io/instance: metrics-reader app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project-v4-with-metrics - app.kubernetes.io/part-of: project-v4-with-metrics + app.kubernetes.io/created-by: project-v3-with-grafana + app.kubernetes.io/part-of: project-v3-with-grafana app.kubernetes.io/managed-by: kustomize name: metrics-reader rules: diff --git a/testdata/project-v3-with-metrics/config/rbac/auth_proxy_role.yaml b/testdata/project-v3-with-grafana/config/rbac/auth_proxy_role.yaml similarity index 80% rename from testdata/project-v3-with-metrics/config/rbac/auth_proxy_role.yaml rename to testdata/project-v3-with-grafana/config/rbac/auth_proxy_role.yaml index 7d4f6f2b21..8402d6e1bc 100644 --- a/testdata/project-v3-with-metrics/config/rbac/auth_proxy_role.yaml +++ b/testdata/project-v3-with-grafana/config/rbac/auth_proxy_role.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrole app.kubernetes.io/instance: proxy-role app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project-v3-with-metrics - app.kubernetes.io/part-of: project-v3-with-metrics + app.kubernetes.io/created-by: project-v3-with-grafana + app.kubernetes.io/part-of: project-v3-with-grafana app.kubernetes.io/managed-by: kustomize name: proxy-role rules: diff --git a/testdata/project-v4-with-metrics/config/rbac/auth_proxy_role_binding.yaml b/testdata/project-v3-with-grafana/config/rbac/auth_proxy_role_binding.yaml similarity index 80% rename from testdata/project-v4-with-metrics/config/rbac/auth_proxy_role_binding.yaml rename to testdata/project-v3-with-grafana/config/rbac/auth_proxy_role_binding.yaml index 713d2fd378..cfa5856e8d 100644 --- a/testdata/project-v4-with-metrics/config/rbac/auth_proxy_role_binding.yaml +++ b/testdata/project-v3-with-grafana/config/rbac/auth_proxy_role_binding.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrolebinding app.kubernetes.io/instance: proxy-rolebinding app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project-v4-with-metrics - app.kubernetes.io/part-of: project-v4-with-metrics + app.kubernetes.io/created-by: project-v3-with-grafana + app.kubernetes.io/part-of: project-v3-with-grafana app.kubernetes.io/managed-by: kustomize name: proxy-rolebinding roleRef: diff --git a/testdata/project-v3-with-metrics/config/rbac/auth_proxy_service.yaml b/testdata/project-v3-with-grafana/config/rbac/auth_proxy_service.yaml similarity index 81% rename from testdata/project-v3-with-metrics/config/rbac/auth_proxy_service.yaml rename to testdata/project-v3-with-grafana/config/rbac/auth_proxy_service.yaml index b34bbb2e62..f300c8e493 100644 --- a/testdata/project-v3-with-metrics/config/rbac/auth_proxy_service.yaml +++ b/testdata/project-v3-with-grafana/config/rbac/auth_proxy_service.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.io/name: service app.kubernetes.io/instance: controller-manager-metrics-service app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project-v3-with-metrics - app.kubernetes.io/part-of: project-v3-with-metrics + app.kubernetes.io/created-by: project-v3-with-grafana + app.kubernetes.io/part-of: project-v3-with-grafana app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-service namespace: system diff --git a/testdata/project-v3-with-metrics/config/rbac/kustomization.yaml b/testdata/project-v3-with-grafana/config/rbac/kustomization.yaml similarity index 100% rename from testdata/project-v3-with-metrics/config/rbac/kustomization.yaml rename to testdata/project-v3-with-grafana/config/rbac/kustomization.yaml diff --git a/testdata/project-v3-with-metrics/config/rbac/leader_election_role.yaml b/testdata/project-v3-with-grafana/config/rbac/leader_election_role.yaml similarity index 85% rename from testdata/project-v3-with-metrics/config/rbac/leader_election_role.yaml rename to testdata/project-v3-with-grafana/config/rbac/leader_election_role.yaml index 29fdea97c5..86a522cc2c 100644 --- a/testdata/project-v3-with-metrics/config/rbac/leader_election_role.yaml +++ b/testdata/project-v3-with-grafana/config/rbac/leader_election_role.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.io/name: role app.kubernetes.io/instance: leader-election-role app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project-v3-with-metrics - app.kubernetes.io/part-of: project-v3-with-metrics + app.kubernetes.io/created-by: project-v3-with-grafana + app.kubernetes.io/part-of: project-v3-with-grafana app.kubernetes.io/managed-by: kustomize name: leader-election-role rules: diff --git a/testdata/project-v4-with-metrics/config/rbac/leader_election_role_binding.yaml b/testdata/project-v3-with-grafana/config/rbac/leader_election_role_binding.yaml similarity index 80% rename from testdata/project-v4-with-metrics/config/rbac/leader_election_role_binding.yaml rename to testdata/project-v3-with-grafana/config/rbac/leader_election_role_binding.yaml index a93e505947..13e5132ebc 100644 --- a/testdata/project-v4-with-metrics/config/rbac/leader_election_role_binding.yaml +++ b/testdata/project-v3-with-grafana/config/rbac/leader_election_role_binding.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: rolebinding app.kubernetes.io/instance: leader-election-rolebinding app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project-v4-with-metrics - app.kubernetes.io/part-of: project-v4-with-metrics + app.kubernetes.io/created-by: project-v3-with-grafana + app.kubernetes.io/part-of: project-v3-with-grafana app.kubernetes.io/managed-by: kustomize name: leader-election-rolebinding roleRef: diff --git a/testdata/project-v3-with-metrics/config/rbac/role_binding.yaml b/testdata/project-v3-with-grafana/config/rbac/role_binding.yaml similarity index 80% rename from testdata/project-v3-with-metrics/config/rbac/role_binding.yaml rename to testdata/project-v3-with-grafana/config/rbac/role_binding.yaml index b31cc6ce4f..663f164589 100644 --- a/testdata/project-v3-with-metrics/config/rbac/role_binding.yaml +++ b/testdata/project-v3-with-grafana/config/rbac/role_binding.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrolebinding app.kubernetes.io/instance: manager-rolebinding app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project-v3-with-metrics - app.kubernetes.io/part-of: project-v3-with-metrics + app.kubernetes.io/created-by: project-v3-with-grafana + app.kubernetes.io/part-of: project-v3-with-grafana app.kubernetes.io/managed-by: kustomize name: manager-rolebinding roleRef: diff --git a/testdata/project-v4-with-metrics/config/rbac/service_account.yaml b/testdata/project-v3-with-grafana/config/rbac/service_account.yaml similarity index 71% rename from testdata/project-v4-with-metrics/config/rbac/service_account.yaml rename to testdata/project-v3-with-grafana/config/rbac/service_account.yaml index 4f1fd6de73..69cf1072cb 100644 --- a/testdata/project-v4-with-metrics/config/rbac/service_account.yaml +++ b/testdata/project-v3-with-grafana/config/rbac/service_account.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: serviceaccount app.kubernetes.io/instance: controller-manager app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project-v4-with-metrics - app.kubernetes.io/part-of: project-v4-with-metrics + app.kubernetes.io/created-by: project-v3-with-grafana + app.kubernetes.io/part-of: project-v3-with-grafana app.kubernetes.io/managed-by: kustomize name: controller-manager namespace: system diff --git a/testdata/project-v3-with-metrics/go.mod b/testdata/project-v3-with-grafana/go.mod similarity index 98% rename from testdata/project-v3-with-metrics/go.mod rename to testdata/project-v3-with-grafana/go.mod index 3495fdc3c2..a5dbf78fb2 100644 --- a/testdata/project-v3-with-metrics/go.mod +++ b/testdata/project-v3-with-grafana/go.mod @@ -1,4 +1,4 @@ -module sigs.k8s.io/kubebuilder/testdata/project-v3-with-metrics +module sigs.k8s.io/kubebuilder/testdata/project-v3-with-grafana go 1.19 diff --git a/testdata/project-v3-declarative-v1/grafana/controller-resources-metrics.json b/testdata/project-v3-with-grafana/grafana/controller-resources-metrics.json similarity index 100% rename from testdata/project-v3-declarative-v1/grafana/controller-resources-metrics.json rename to testdata/project-v3-with-grafana/grafana/controller-resources-metrics.json diff --git a/testdata/project-v3-declarative-v1/grafana/controller-runtime-metrics.json b/testdata/project-v3-with-grafana/grafana/controller-runtime-metrics.json similarity index 100% rename from testdata/project-v3-declarative-v1/grafana/controller-runtime-metrics.json rename to testdata/project-v3-with-grafana/grafana/controller-runtime-metrics.json diff --git a/testdata/project-v3-declarative-v1/grafana/custom-metrics/config.yaml b/testdata/project-v3-with-grafana/grafana/custom-metrics/config.yaml similarity index 100% rename from testdata/project-v3-declarative-v1/grafana/custom-metrics/config.yaml rename to testdata/project-v3-with-grafana/grafana/custom-metrics/config.yaml diff --git a/testdata/project-v3-with-metrics/hack/boilerplate.go.txt b/testdata/project-v3-with-grafana/hack/boilerplate.go.txt similarity index 100% rename from testdata/project-v3-with-metrics/hack/boilerplate.go.txt rename to testdata/project-v3-with-grafana/hack/boilerplate.go.txt diff --git a/testdata/project-v4-with-metrics/main.go b/testdata/project-v3-with-grafana/main.go similarity index 98% rename from testdata/project-v4-with-metrics/main.go rename to testdata/project-v3-with-grafana/main.go index a60d58e8ea..e33a632ca1 100644 --- a/testdata/project-v4-with-metrics/main.go +++ b/testdata/project-v3-with-grafana/main.go @@ -67,7 +67,7 @@ func main() { Port: 9443, HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, - LeaderElectionID: "d2513bbd.testproject.org", + LeaderElectionID: "502fdbd3.testproject.org", // LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily // when the Manager ends. This requires the binary to immediately end when the // Manager is stopped, otherwise, this setting is unsafe. Setting this significantly diff --git a/testdata/project-v4-declarative-v1/PROJECT b/testdata/project-v4-declarative-v1/PROJECT index ec259f2922..3acf97bc34 100644 --- a/testdata/project-v4-declarative-v1/PROJECT +++ b/testdata/project-v4-declarative-v1/PROJECT @@ -2,7 +2,6 @@ domain: testproject.org layout: - go.kubebuilder.io/v4-alpha - declarative.go.kubebuilder.io/v1 -- grafana.kubebuilder.io/v1-alpha plugins: declarative.go.kubebuilder.io/v1: resources: @@ -18,7 +17,6 @@ plugins: group: crew kind: Admiral version: v1 - grafana.kubebuilder.io/v1-alpha: {} projectName: project-v4-declarative-v1 repo: sigs.k8s.io/kubebuilder/testdata/project-v4-declarative-v1 resources: diff --git a/testdata/project-v4-declarative-v1/grafana/controller-resources-metrics.json b/testdata/project-v4-declarative-v1/grafana/controller-resources-metrics.json deleted file mode 100644 index 629e0d3c9b..0000000000 --- a/testdata/project-v4-declarative-v1/grafana/controller-resources-metrics.json +++ /dev/null @@ -1,306 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__requires": [ - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - } - ], - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "target": { - "limit": 100, - "matchAny": false, - "tags": [], - "type": "dashboard" - }, - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "links": [], - "liveNow": false, - "panels": [ - { - "datasource": "${DS_PROMETHEUS}", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percent" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 0 - }, - "id": 2, - "interval": "1m", - "links": [], - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "8.4.3", - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "rate(process_cpu_seconds_total{job=\"$job\", namespace=\"$namespace\", pod=\"$pod\"}[5m]) * 100", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "Pod: {{pod}} | Container: {{container}}", - "refId": "A", - "step": 10 - } - ], - "title": "Controller CPU Usage", - "type": "timeseries" - }, - { - "datasource": "${DS_PROMETHEUS}", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "bytes" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 0 - }, - "id": 4, - "interval": "1m", - "links": [], - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "8.4.3", - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "process_resident_memory_bytes{job=\"$job\", namespace=\"$namespace\", pod=\"$pod\"}", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "Pod: {{pod}} | Container: {{container}}", - "refId": "A", - "step": 10 - } - ], - "title": "Controller Memory Usage", - "type": "timeseries" - } - ], - "refresh": "", - "style": "dark", - "tags": [], - "templating": { - "list": [ - { - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\"}, job)", - "hide": 0, - "includeAll": false, - "multi": false, - "name": "job", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\"}, job)", - "refId": "StandardVariableQuery" - }, - "refresh": 2, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "current": { - "selected": false, - "text": "observability", - "value": "observability" - }, - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total, namespace)", - "hide": 0, - "includeAll": false, - "multi": false, - "name": "namespace", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total, namespace)", - "refId": "StandardVariableQuery" - }, - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "current": { - "selected": false, - "text": "All", - "value": "$__all" - }, - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\", job=~\"$job\"}, pod)", - "hide": 2, - "includeAll": true, - "label": "pod", - "multi": true, - "name": "pod", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\", job=~\"$job\"}, pod)", - "refId": "StandardVariableQuery" - }, - "refresh": 2, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - } - ] - }, - "time": { - "from": "now-15m", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "Controller-Resources-Metrics", - "weekStart": "" -} diff --git a/testdata/project-v4-declarative-v1/grafana/controller-runtime-metrics.json b/testdata/project-v4-declarative-v1/grafana/controller-runtime-metrics.json deleted file mode 100644 index 70023a42d8..0000000000 --- a/testdata/project-v4-declarative-v1/grafana/controller-runtime-metrics.json +++ /dev/null @@ -1,710 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__requires": [ - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - } - ], - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "datasource", - "uid": "grafana" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "target": { - "limit": 100, - "matchAny": false, - "tags": [], - "type": "dashboard" - }, - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "links": [], - "liveNow": false, - "panels": [ - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 9, - "panels": [], - "title": "Reconciliation Metrics", - "type": "row" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "Total number of reconciliations per controller", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "cpm" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 0, - "y": 1 - }, - "id": 7, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "editorMode": "code", - "exemplar": true, - "expr": "sum(rate(controller_runtime_reconcile_total{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, pod)", - "interval": "", - "legendFormat": "{{instance}} {{pod}}", - "range": true, - "refId": "A" - } - ], - "title": "Total Reconciliation Count Per Controller", - "type": "timeseries" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "Total number of reconciliation errors per controller", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "cpm" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 12, - "y": 1 - }, - "id": 6, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "editorMode": "code", - "exemplar": true, - "expr": "sum(rate(controller_runtime_reconcile_errors_total{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, pod)", - "interval": "", - "legendFormat": "{{instance}} {{pod}}", - "range": true, - "refId": "A" - } - ], - "title": "Reconciliation Error Count Per Controller", - "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 8 - }, - "id": 11, - "panels": [], - "title": "Work Queue Metrics", - "type": "row" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "How long in seconds an item stays in workqueue before being requested", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 0, - "y": 9 - }, - "id": 13, - "options": { - "legend": { - "calcs": [ - "max", - "mean" - ], - "displayMode": "list", - "placement": "right" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.50, sum(rate(workqueue_queue_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "interval": "", - "legendFormat": "P50 {{name}} {{instance}} ", - "refId": "A" - }, - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.90, sum(rate(workqueue_queue_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "hide": false, - "interval": "", - "legendFormat": "P90 {{name}} {{instance}} ", - "refId": "B" - }, - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.99, sum(rate(workqueue_queue_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "hide": false, - "interval": "", - "legendFormat": "P99 {{name}} {{instance}} ", - "refId": "C" - } - ], - "title": "Seconds For Items Stay In Queue (before being requested) (P50, P90, P99)", - "type": "timeseries" - }, - { - "datasource": "${DS_PROMETHEUS}", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 12, - "y": 9 - }, - "id": 15, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "8.4.3", - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "sum(rate(workqueue_adds_total{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name)", - "interval": "", - "legendFormat": "{{name}} {{instance}}", - "refId": "A" - } - ], - "title": "Work Queue Add Rate", - "type": "timeseries" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "How long in seconds processing an item from workqueue takes.", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 0, - "y": 16 - }, - "id": 19, - "options": { - "legend": { - "calcs": [ - "max", - "mean" - ], - "displayMode": "table", - "placement": "right" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.50, sum(rate(workqueue_work_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "interval": "", - "legendFormat": "P50 {{name}} {{instance}} ", - "refId": "A" - }, - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.90, sum(rate(workqueue_work_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "hide": false, - "interval": "", - "legendFormat": "P90 {{name}} {{instance}} ", - "refId": "B" - }, - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.99, sum(rate(workqueue_work_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "hide": false, - "interval": "", - "legendFormat": "P99 {{name}} {{instance}} ", - "refId": "C" - } - ], - "title": "Seconds Processing Items From WorkQueue (P50, P90, P99)", - "type": "timeseries" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "Total number of retries handled by workqueue", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 12, - "y": 16 - }, - "id": 17, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "sum(rate(workqueue_retries_total{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name)", - "interval": "", - "legendFormat": "{{name}} {{instance}} ", - "refId": "A" - } - ], - "title": "Work Queue Retries Rate", - "type": "timeseries" - } - ], - "refresh": "", - "style": "dark", - "tags": [], - "templating": { - "list": [ - { - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\"}, job)", - "hide": 0, - "includeAll": false, - "multi": false, - "name": "job", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\"}, job)", - "refId": "StandardVariableQuery" - }, - "refresh": 2, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total, namespace)", - "hide": 0, - "includeAll": false, - "multi": false, - "name": "namespace", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total, namespace)", - "refId": "StandardVariableQuery" - }, - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "current": { - "selected": true, - "text": [ - "All" - ], - "value": [ - "$__all" - ] - }, - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\", job=~\"$job\"}, pod)", - "hide": 2, - "includeAll": true, - "label": "pod", - "multi": true, - "name": "pod", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\", job=~\"$job\"}, pod)", - "refId": "StandardVariableQuery" - }, - "refresh": 2, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - } - ] - }, - "time": { - "from": "now-15m", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "Controller-Runtime-Metrics", - "weekStart": "" -} diff --git a/testdata/project-v4-declarative-v1/grafana/custom-metrics/config.yaml b/testdata/project-v4-declarative-v1/grafana/custom-metrics/config.yaml deleted file mode 100644 index 3ee1bebdf2..0000000000 --- a/testdata/project-v4-declarative-v1/grafana/custom-metrics/config.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -customMetrics: -# - metric: # Raw custom metric (required) -# type: # Metric type: counter/gauge/histogram (required) -# expr: # Prom_ql for the metric (optional) -# unit: # Unit of measurement, examples: s,none,bytes,percent,etc. (optional) -# -# -# Example: -# --- -# customMetrics: -# - metric: foo_bar -# unit: none -# type: histogram -# expr: histogram_quantile(0.90, sum by(instance, le) (rate(foo_bar{job=\"$job\", namespace=\"$namespace\"}[5m]))) diff --git a/testdata/project-v4-with-metrics/.dockerignore b/testdata/project-v4-with-grafana/.dockerignore similarity index 100% rename from testdata/project-v4-with-metrics/.dockerignore rename to testdata/project-v4-with-grafana/.dockerignore diff --git a/testdata/project-v4-with-metrics/.gitignore b/testdata/project-v4-with-grafana/.gitignore similarity index 100% rename from testdata/project-v4-with-metrics/.gitignore rename to testdata/project-v4-with-grafana/.gitignore diff --git a/testdata/project-v4-with-metrics/Dockerfile b/testdata/project-v4-with-grafana/Dockerfile similarity index 100% rename from testdata/project-v4-with-metrics/Dockerfile rename to testdata/project-v4-with-grafana/Dockerfile diff --git a/testdata/project-v4-with-metrics/Makefile b/testdata/project-v4-with-grafana/Makefile similarity index 100% rename from testdata/project-v4-with-metrics/Makefile rename to testdata/project-v4-with-grafana/Makefile diff --git a/testdata/project-v4-with-metrics/PROJECT b/testdata/project-v4-with-grafana/PROJECT similarity index 53% rename from testdata/project-v4-with-metrics/PROJECT rename to testdata/project-v4-with-grafana/PROJECT index 7329bb6146..07d11fc346 100644 --- a/testdata/project-v4-with-metrics/PROJECT +++ b/testdata/project-v4-with-grafana/PROJECT @@ -3,6 +3,6 @@ layout: - go.kubebuilder.io/v3 plugins: grafana.kubebuilder.io/v1-alpha: {} -projectName: project-v4-with-metrics -repo: sigs.k8s.io/kubebuilder/testdata/project-v4-with-metrics +projectName: project-v4-with-grafana +repo: sigs.k8s.io/kubebuilder/testdata/project-v4-with-grafana version: "3" diff --git a/testdata/project-v4-with-metrics/README.md b/testdata/project-v4-with-grafana/README.md similarity index 96% rename from testdata/project-v4-with-metrics/README.md rename to testdata/project-v4-with-grafana/README.md index 82fa7788b1..574b26e0c7 100644 --- a/testdata/project-v4-with-metrics/README.md +++ b/testdata/project-v4-with-grafana/README.md @@ -1,4 +1,4 @@ -# project-v4-with-metrics +# project-v4-with-grafana // TODO(user): Add simple overview of use/purpose ## Description @@ -18,13 +18,13 @@ kubectl apply -f config/samples/ 2. Build and push your image to the location specified by `IMG`: ```sh -make docker-build docker-push IMG=/project-v4-with-metrics:tag +make docker-build docker-push IMG=/project-v4-with-grafana:tag ``` 3. Deploy the controller to the cluster with the image specified by `IMG`: ```sh -make deploy IMG=/project-v4-with-metrics:tag +make deploy IMG=/project-v4-with-grafana:tag ``` ### Uninstall CRDs diff --git a/testdata/project-v4-with-metrics/config/default/kustomization.yaml b/testdata/project-v4-with-grafana/config/default/kustomization.yaml similarity index 96% rename from testdata/project-v4-with-metrics/config/default/kustomization.yaml rename to testdata/project-v4-with-grafana/config/default/kustomization.yaml index 477cc28c83..ca19fadabb 100644 --- a/testdata/project-v4-with-metrics/config/default/kustomization.yaml +++ b/testdata/project-v4-with-grafana/config/default/kustomization.yaml @@ -1,12 +1,12 @@ # Adds namespace to all resources. -namespace: project-v4-with-metrics-system +namespace: project-v4-with-grafana-system # Value of this field is prepended to the # names of all resources, e.g. a deployment named # "wordpress" becomes "alices-wordpress". # Note that it should also match with the prefix (text before '-') of the namespace # field above. -namePrefix: project-v4-with-metrics- +namePrefix: project-v4-with-grafana- # Labels to add to all resources and selectors. #commonLabels: diff --git a/testdata/project-v4-with-metrics/config/default/manager_auth_proxy_patch.yaml b/testdata/project-v4-with-grafana/config/default/manager_auth_proxy_patch.yaml similarity index 100% rename from testdata/project-v4-with-metrics/config/default/manager_auth_proxy_patch.yaml rename to testdata/project-v4-with-grafana/config/default/manager_auth_proxy_patch.yaml diff --git a/testdata/project-v4-with-metrics/config/default/manager_config_patch.yaml b/testdata/project-v4-with-grafana/config/default/manager_config_patch.yaml similarity index 100% rename from testdata/project-v4-with-metrics/config/default/manager_config_patch.yaml rename to testdata/project-v4-with-grafana/config/default/manager_config_patch.yaml diff --git a/testdata/project-v4-with-metrics/config/manager/kustomization.yaml b/testdata/project-v4-with-grafana/config/manager/kustomization.yaml similarity index 100% rename from testdata/project-v4-with-metrics/config/manager/kustomization.yaml rename to testdata/project-v4-with-grafana/config/manager/kustomization.yaml diff --git a/testdata/project-v3-with-metrics/config/manager/manager.yaml b/testdata/project-v4-with-grafana/config/manager/manager.yaml similarity index 93% rename from testdata/project-v3-with-metrics/config/manager/manager.yaml rename to testdata/project-v4-with-grafana/config/manager/manager.yaml index e717685182..220b518a74 100644 --- a/testdata/project-v3-with-metrics/config/manager/manager.yaml +++ b/testdata/project-v4-with-grafana/config/manager/manager.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.io/name: namespace app.kubernetes.io/instance: system app.kubernetes.io/component: manager - app.kubernetes.io/created-by: project-v3-with-metrics - app.kubernetes.io/part-of: project-v3-with-metrics + app.kubernetes.io/created-by: project-v4-with-grafana + app.kubernetes.io/part-of: project-v4-with-grafana app.kubernetes.io/managed-by: kustomize name: system --- @@ -21,8 +21,8 @@ metadata: app.kubernetes.io/name: deployment app.kubernetes.io/instance: controller-manager app.kubernetes.io/component: manager - app.kubernetes.io/created-by: project-v3-with-metrics - app.kubernetes.io/part-of: project-v3-with-metrics + app.kubernetes.io/created-by: project-v4-with-grafana + app.kubernetes.io/part-of: project-v4-with-grafana app.kubernetes.io/managed-by: kustomize spec: selector: diff --git a/testdata/project-v4-with-metrics/config/prometheus/kustomization.yaml b/testdata/project-v4-with-grafana/config/prometheus/kustomization.yaml similarity index 100% rename from testdata/project-v4-with-metrics/config/prometheus/kustomization.yaml rename to testdata/project-v4-with-grafana/config/prometheus/kustomization.yaml diff --git a/testdata/project-v4-with-metrics/config/prometheus/monitor.yaml b/testdata/project-v4-with-grafana/config/prometheus/monitor.yaml similarity index 85% rename from testdata/project-v4-with-metrics/config/prometheus/monitor.yaml rename to testdata/project-v4-with-grafana/config/prometheus/monitor.yaml index 51dbbb13aa..d71b79c554 100644 --- a/testdata/project-v4-with-metrics/config/prometheus/monitor.yaml +++ b/testdata/project-v4-with-grafana/config/prometheus/monitor.yaml @@ -8,8 +8,8 @@ metadata: app.kubernetes.io/name: servicemonitor app.kubernetes.io/instance: controller-manager-metrics-monitor app.kubernetes.io/component: metrics - app.kubernetes.io/created-by: project-v4-with-metrics - app.kubernetes.io/part-of: project-v4-with-metrics + app.kubernetes.io/created-by: project-v4-with-grafana + app.kubernetes.io/part-of: project-v4-with-grafana app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-monitor namespace: system diff --git a/testdata/project-v3-with-metrics/config/rbac/auth_proxy_client_clusterrole.yaml b/testdata/project-v4-with-grafana/config/rbac/auth_proxy_client_clusterrole.yaml similarity index 75% rename from testdata/project-v3-with-metrics/config/rbac/auth_proxy_client_clusterrole.yaml rename to testdata/project-v4-with-grafana/config/rbac/auth_proxy_client_clusterrole.yaml index 214a81354e..1a34944880 100644 --- a/testdata/project-v3-with-metrics/config/rbac/auth_proxy_client_clusterrole.yaml +++ b/testdata/project-v4-with-grafana/config/rbac/auth_proxy_client_clusterrole.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrole app.kubernetes.io/instance: metrics-reader app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project-v3-with-metrics - app.kubernetes.io/part-of: project-v3-with-metrics + app.kubernetes.io/created-by: project-v4-with-grafana + app.kubernetes.io/part-of: project-v4-with-grafana app.kubernetes.io/managed-by: kustomize name: metrics-reader rules: diff --git a/testdata/project-v4-with-metrics/config/rbac/auth_proxy_role.yaml b/testdata/project-v4-with-grafana/config/rbac/auth_proxy_role.yaml similarity index 80% rename from testdata/project-v4-with-metrics/config/rbac/auth_proxy_role.yaml rename to testdata/project-v4-with-grafana/config/rbac/auth_proxy_role.yaml index 706129aea1..78751f31b4 100644 --- a/testdata/project-v4-with-metrics/config/rbac/auth_proxy_role.yaml +++ b/testdata/project-v4-with-grafana/config/rbac/auth_proxy_role.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrole app.kubernetes.io/instance: proxy-role app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project-v4-with-metrics - app.kubernetes.io/part-of: project-v4-with-metrics + app.kubernetes.io/created-by: project-v4-with-grafana + app.kubernetes.io/part-of: project-v4-with-grafana app.kubernetes.io/managed-by: kustomize name: proxy-role rules: diff --git a/testdata/project-v3-with-metrics/config/rbac/auth_proxy_role_binding.yaml b/testdata/project-v4-with-grafana/config/rbac/auth_proxy_role_binding.yaml similarity index 80% rename from testdata/project-v3-with-metrics/config/rbac/auth_proxy_role_binding.yaml rename to testdata/project-v4-with-grafana/config/rbac/auth_proxy_role_binding.yaml index 1bbfbf30eb..65e551ad03 100644 --- a/testdata/project-v3-with-metrics/config/rbac/auth_proxy_role_binding.yaml +++ b/testdata/project-v4-with-grafana/config/rbac/auth_proxy_role_binding.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrolebinding app.kubernetes.io/instance: proxy-rolebinding app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project-v3-with-metrics - app.kubernetes.io/part-of: project-v3-with-metrics + app.kubernetes.io/created-by: project-v4-with-grafana + app.kubernetes.io/part-of: project-v4-with-grafana app.kubernetes.io/managed-by: kustomize name: proxy-rolebinding roleRef: diff --git a/testdata/project-v4-with-metrics/config/rbac/auth_proxy_service.yaml b/testdata/project-v4-with-grafana/config/rbac/auth_proxy_service.yaml similarity index 81% rename from testdata/project-v4-with-metrics/config/rbac/auth_proxy_service.yaml rename to testdata/project-v4-with-grafana/config/rbac/auth_proxy_service.yaml index 9592531f6b..55993935fa 100644 --- a/testdata/project-v4-with-metrics/config/rbac/auth_proxy_service.yaml +++ b/testdata/project-v4-with-grafana/config/rbac/auth_proxy_service.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.io/name: service app.kubernetes.io/instance: controller-manager-metrics-service app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project-v4-with-metrics - app.kubernetes.io/part-of: project-v4-with-metrics + app.kubernetes.io/created-by: project-v4-with-grafana + app.kubernetes.io/part-of: project-v4-with-grafana app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-service namespace: system diff --git a/testdata/project-v4-with-metrics/config/rbac/kustomization.yaml b/testdata/project-v4-with-grafana/config/rbac/kustomization.yaml similarity index 100% rename from testdata/project-v4-with-metrics/config/rbac/kustomization.yaml rename to testdata/project-v4-with-grafana/config/rbac/kustomization.yaml diff --git a/testdata/project-v4-with-metrics/config/rbac/leader_election_role.yaml b/testdata/project-v4-with-grafana/config/rbac/leader_election_role.yaml similarity index 85% rename from testdata/project-v4-with-metrics/config/rbac/leader_election_role.yaml rename to testdata/project-v4-with-grafana/config/rbac/leader_election_role.yaml index 0fbf3aefa4..90dec8af28 100644 --- a/testdata/project-v4-with-metrics/config/rbac/leader_election_role.yaml +++ b/testdata/project-v4-with-grafana/config/rbac/leader_election_role.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.io/name: role app.kubernetes.io/instance: leader-election-role app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project-v4-with-metrics - app.kubernetes.io/part-of: project-v4-with-metrics + app.kubernetes.io/created-by: project-v4-with-grafana + app.kubernetes.io/part-of: project-v4-with-grafana app.kubernetes.io/managed-by: kustomize name: leader-election-role rules: diff --git a/testdata/project-v3-with-metrics/config/rbac/leader_election_role_binding.yaml b/testdata/project-v4-with-grafana/config/rbac/leader_election_role_binding.yaml similarity index 80% rename from testdata/project-v3-with-metrics/config/rbac/leader_election_role_binding.yaml rename to testdata/project-v4-with-grafana/config/rbac/leader_election_role_binding.yaml index cb0cd7da0c..d07e4f7a40 100644 --- a/testdata/project-v3-with-metrics/config/rbac/leader_election_role_binding.yaml +++ b/testdata/project-v4-with-grafana/config/rbac/leader_election_role_binding.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: rolebinding app.kubernetes.io/instance: leader-election-rolebinding app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project-v3-with-metrics - app.kubernetes.io/part-of: project-v3-with-metrics + app.kubernetes.io/created-by: project-v4-with-grafana + app.kubernetes.io/part-of: project-v4-with-grafana app.kubernetes.io/managed-by: kustomize name: leader-election-rolebinding roleRef: diff --git a/testdata/project-v4-with-metrics/config/rbac/role_binding.yaml b/testdata/project-v4-with-grafana/config/rbac/role_binding.yaml similarity index 80% rename from testdata/project-v4-with-metrics/config/rbac/role_binding.yaml rename to testdata/project-v4-with-grafana/config/rbac/role_binding.yaml index b3ccc1b6c2..45f4d19a37 100644 --- a/testdata/project-v4-with-metrics/config/rbac/role_binding.yaml +++ b/testdata/project-v4-with-grafana/config/rbac/role_binding.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrolebinding app.kubernetes.io/instance: manager-rolebinding app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project-v4-with-metrics - app.kubernetes.io/part-of: project-v4-with-metrics + app.kubernetes.io/created-by: project-v4-with-grafana + app.kubernetes.io/part-of: project-v4-with-grafana app.kubernetes.io/managed-by: kustomize name: manager-rolebinding roleRef: diff --git a/testdata/project-v3-with-metrics/config/rbac/service_account.yaml b/testdata/project-v4-with-grafana/config/rbac/service_account.yaml similarity index 71% rename from testdata/project-v3-with-metrics/config/rbac/service_account.yaml rename to testdata/project-v4-with-grafana/config/rbac/service_account.yaml index f30bb8915f..1fb853ae68 100644 --- a/testdata/project-v3-with-metrics/config/rbac/service_account.yaml +++ b/testdata/project-v4-with-grafana/config/rbac/service_account.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: serviceaccount app.kubernetes.io/instance: controller-manager app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project-v3-with-metrics - app.kubernetes.io/part-of: project-v3-with-metrics + app.kubernetes.io/created-by: project-v4-with-grafana + app.kubernetes.io/part-of: project-v4-with-grafana app.kubernetes.io/managed-by: kustomize name: controller-manager namespace: system diff --git a/testdata/project-v4-with-metrics/go.mod b/testdata/project-v4-with-grafana/go.mod similarity index 98% rename from testdata/project-v4-with-metrics/go.mod rename to testdata/project-v4-with-grafana/go.mod index ff0828aa48..35fc7a0db4 100644 --- a/testdata/project-v4-with-metrics/go.mod +++ b/testdata/project-v4-with-grafana/go.mod @@ -1,4 +1,4 @@ -module sigs.k8s.io/kubebuilder/testdata/project-v4-with-metrics +module sigs.k8s.io/kubebuilder/testdata/project-v4-with-grafana go 1.19 diff --git a/testdata/project-v3-with-metrics/grafana/controller-resources-metrics.json b/testdata/project-v4-with-grafana/grafana/controller-resources-metrics.json similarity index 100% rename from testdata/project-v3-with-metrics/grafana/controller-resources-metrics.json rename to testdata/project-v4-with-grafana/grafana/controller-resources-metrics.json diff --git a/testdata/project-v3-with-metrics/grafana/controller-runtime-metrics.json b/testdata/project-v4-with-grafana/grafana/controller-runtime-metrics.json similarity index 100% rename from testdata/project-v3-with-metrics/grafana/controller-runtime-metrics.json rename to testdata/project-v4-with-grafana/grafana/controller-runtime-metrics.json diff --git a/testdata/project-v3-with-metrics/grafana/custom-metrics/config.yaml b/testdata/project-v4-with-grafana/grafana/custom-metrics/config.yaml similarity index 100% rename from testdata/project-v3-with-metrics/grafana/custom-metrics/config.yaml rename to testdata/project-v4-with-grafana/grafana/custom-metrics/config.yaml diff --git a/testdata/project-v4-with-metrics/hack/boilerplate.go.txt b/testdata/project-v4-with-grafana/hack/boilerplate.go.txt similarity index 100% rename from testdata/project-v4-with-metrics/hack/boilerplate.go.txt rename to testdata/project-v4-with-grafana/hack/boilerplate.go.txt diff --git a/testdata/project-v3-with-metrics/main.go b/testdata/project-v4-with-grafana/main.go similarity index 98% rename from testdata/project-v3-with-metrics/main.go rename to testdata/project-v4-with-grafana/main.go index 73d8e18d15..6be3ac2a69 100644 --- a/testdata/project-v3-with-metrics/main.go +++ b/testdata/project-v4-with-grafana/main.go @@ -67,7 +67,7 @@ func main() { Port: 9443, HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, - LeaderElectionID: "d9e631ee.testproject.org", + LeaderElectionID: "bc2db930.testproject.org", // LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily // when the Manager ends. This requires the binary to immediately end when the // Manager is stopped, otherwise, this setting is unsafe. Setting this significantly diff --git a/testdata/project-v4-with-metrics/grafana/controller-resources-metrics.json b/testdata/project-v4-with-metrics/grafana/controller-resources-metrics.json deleted file mode 100644 index 629e0d3c9b..0000000000 --- a/testdata/project-v4-with-metrics/grafana/controller-resources-metrics.json +++ /dev/null @@ -1,306 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__requires": [ - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - } - ], - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "target": { - "limit": 100, - "matchAny": false, - "tags": [], - "type": "dashboard" - }, - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "links": [], - "liveNow": false, - "panels": [ - { - "datasource": "${DS_PROMETHEUS}", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percent" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 0 - }, - "id": 2, - "interval": "1m", - "links": [], - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "8.4.3", - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "rate(process_cpu_seconds_total{job=\"$job\", namespace=\"$namespace\", pod=\"$pod\"}[5m]) * 100", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "Pod: {{pod}} | Container: {{container}}", - "refId": "A", - "step": 10 - } - ], - "title": "Controller CPU Usage", - "type": "timeseries" - }, - { - "datasource": "${DS_PROMETHEUS}", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "bytes" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 0 - }, - "id": 4, - "interval": "1m", - "links": [], - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "8.4.3", - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "process_resident_memory_bytes{job=\"$job\", namespace=\"$namespace\", pod=\"$pod\"}", - "format": "time_series", - "interval": "", - "intervalFactor": 2, - "legendFormat": "Pod: {{pod}} | Container: {{container}}", - "refId": "A", - "step": 10 - } - ], - "title": "Controller Memory Usage", - "type": "timeseries" - } - ], - "refresh": "", - "style": "dark", - "tags": [], - "templating": { - "list": [ - { - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\"}, job)", - "hide": 0, - "includeAll": false, - "multi": false, - "name": "job", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\"}, job)", - "refId": "StandardVariableQuery" - }, - "refresh": 2, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "current": { - "selected": false, - "text": "observability", - "value": "observability" - }, - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total, namespace)", - "hide": 0, - "includeAll": false, - "multi": false, - "name": "namespace", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total, namespace)", - "refId": "StandardVariableQuery" - }, - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "current": { - "selected": false, - "text": "All", - "value": "$__all" - }, - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\", job=~\"$job\"}, pod)", - "hide": 2, - "includeAll": true, - "label": "pod", - "multi": true, - "name": "pod", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\", job=~\"$job\"}, pod)", - "refId": "StandardVariableQuery" - }, - "refresh": 2, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - } - ] - }, - "time": { - "from": "now-15m", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "Controller-Resources-Metrics", - "weekStart": "" -} diff --git a/testdata/project-v4-with-metrics/grafana/controller-runtime-metrics.json b/testdata/project-v4-with-metrics/grafana/controller-runtime-metrics.json deleted file mode 100644 index 70023a42d8..0000000000 --- a/testdata/project-v4-with-metrics/grafana/controller-runtime-metrics.json +++ /dev/null @@ -1,710 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__requires": [ - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - } - ], - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "datasource", - "uid": "grafana" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "target": { - "limit": 100, - "matchAny": false, - "tags": [], - "type": "dashboard" - }, - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "links": [], - "liveNow": false, - "panels": [ - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 9, - "panels": [], - "title": "Reconciliation Metrics", - "type": "row" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "Total number of reconciliations per controller", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "cpm" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 0, - "y": 1 - }, - "id": 7, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "editorMode": "code", - "exemplar": true, - "expr": "sum(rate(controller_runtime_reconcile_total{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, pod)", - "interval": "", - "legendFormat": "{{instance}} {{pod}}", - "range": true, - "refId": "A" - } - ], - "title": "Total Reconciliation Count Per Controller", - "type": "timeseries" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "Total number of reconciliation errors per controller", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "cpm" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 12, - "y": 1 - }, - "id": 6, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "editorMode": "code", - "exemplar": true, - "expr": "sum(rate(controller_runtime_reconcile_errors_total{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, pod)", - "interval": "", - "legendFormat": "{{instance}} {{pod}}", - "range": true, - "refId": "A" - } - ], - "title": "Reconciliation Error Count Per Controller", - "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 8 - }, - "id": 11, - "panels": [], - "title": "Work Queue Metrics", - "type": "row" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "How long in seconds an item stays in workqueue before being requested", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 0, - "y": 9 - }, - "id": 13, - "options": { - "legend": { - "calcs": [ - "max", - "mean" - ], - "displayMode": "list", - "placement": "right" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.50, sum(rate(workqueue_queue_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "interval": "", - "legendFormat": "P50 {{name}} {{instance}} ", - "refId": "A" - }, - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.90, sum(rate(workqueue_queue_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "hide": false, - "interval": "", - "legendFormat": "P90 {{name}} {{instance}} ", - "refId": "B" - }, - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.99, sum(rate(workqueue_queue_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "hide": false, - "interval": "", - "legendFormat": "P99 {{name}} {{instance}} ", - "refId": "C" - } - ], - "title": "Seconds For Items Stay In Queue (before being requested) (P50, P90, P99)", - "type": "timeseries" - }, - { - "datasource": "${DS_PROMETHEUS}", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 12, - "y": 9 - }, - "id": 15, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "8.4.3", - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "sum(rate(workqueue_adds_total{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name)", - "interval": "", - "legendFormat": "{{name}} {{instance}}", - "refId": "A" - } - ], - "title": "Work Queue Add Rate", - "type": "timeseries" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "How long in seconds processing an item from workqueue takes.", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 0, - "y": 16 - }, - "id": 19, - "options": { - "legend": { - "calcs": [ - "max", - "mean" - ], - "displayMode": "table", - "placement": "right" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.50, sum(rate(workqueue_work_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "interval": "", - "legendFormat": "P50 {{name}} {{instance}} ", - "refId": "A" - }, - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.90, sum(rate(workqueue_work_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "hide": false, - "interval": "", - "legendFormat": "P90 {{name}} {{instance}} ", - "refId": "B" - }, - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "histogram_quantile(0.99, sum(rate(workqueue_work_duration_seconds_bucket{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name, le))", - "hide": false, - "interval": "", - "legendFormat": "P99 {{name}} {{instance}} ", - "refId": "C" - } - ], - "title": "Seconds Processing Items From WorkQueue (P50, P90, P99)", - "type": "timeseries" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "Total number of retries handled by workqueue", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 12, - "y": 16 - }, - "id": 17, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "sum(rate(workqueue_retries_total{job=\"$job\", namespace=\"$namespace\"}[5m])) by (instance, name)", - "interval": "", - "legendFormat": "{{name}} {{instance}} ", - "refId": "A" - } - ], - "title": "Work Queue Retries Rate", - "type": "timeseries" - } - ], - "refresh": "", - "style": "dark", - "tags": [], - "templating": { - "list": [ - { - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\"}, job)", - "hide": 0, - "includeAll": false, - "multi": false, - "name": "job", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\"}, job)", - "refId": "StandardVariableQuery" - }, - "refresh": 2, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total, namespace)", - "hide": 0, - "includeAll": false, - "multi": false, - "name": "namespace", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total, namespace)", - "refId": "StandardVariableQuery" - }, - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "current": { - "selected": true, - "text": [ - "All" - ], - "value": [ - "$__all" - ] - }, - "datasource": "${DS_PROMETHEUS}", - "definition": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\", job=~\"$job\"}, pod)", - "hide": 2, - "includeAll": true, - "label": "pod", - "multi": true, - "name": "pod", - "options": [], - "query": { - "query": "label_values(controller_runtime_reconcile_total{namespace=~\"$namespace\", job=~\"$job\"}, pod)", - "refId": "StandardVariableQuery" - }, - "refresh": 2, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - } - ] - }, - "time": { - "from": "now-15m", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "Controller-Runtime-Metrics", - "weekStart": "" -} diff --git a/testdata/project-v4-with-metrics/grafana/custom-metrics/config.yaml b/testdata/project-v4-with-metrics/grafana/custom-metrics/config.yaml deleted file mode 100644 index 3ee1bebdf2..0000000000 --- a/testdata/project-v4-with-metrics/grafana/custom-metrics/config.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -customMetrics: -# - metric: # Raw custom metric (required) -# type: # Metric type: counter/gauge/histogram (required) -# expr: # Prom_ql for the metric (optional) -# unit: # Unit of measurement, examples: s,none,bytes,percent,etc. (optional) -# -# -# Example: -# --- -# customMetrics: -# - metric: foo_bar -# unit: none -# type: histogram -# expr: histogram_quantile(0.90, sum by(instance, le) (rate(foo_bar{job=\"$job\", namespace=\"$namespace\"}[5m])))