From f966d02d69a6725b6bdaddadb9a5b40a87fb4bf1 Mon Sep 17 00:00:00 2001 From: Camila Macedo Date: Wed, 22 May 2024 08:44:51 +0100 Subject: [PATCH] fix place where the metrics service should be scaffolded --- .../project/config/manager/kustomization.yaml | 2 + .../{rbac => manager}/metrics_service.yaml | 0 .../project/config/rbac/kustomization.yaml | 1 - .../project/config/manager/kustomization.yaml | 2 + .../{rbac => manager}/metrics_service.yaml | 0 .../project/config/rbac/kustomization.yaml | 1 - docs/book/src/reference/metrics.md | 8 ++ .../common/kustomize/v2/scaffolds/init.go | 2 +- .../templates/config/manager/kustomization.go | 2 + .../{rbac => manager}/metrics_service.go | 4 +- .../templates/config/rbac/kustomization.go | 1 - test/e2e/v4/generate_test.go | 6 + test/e2e/v4/plugin_cluster_test.go | 107 +++++++++--------- .../{rbac => manager}/metrics_service.yaml | 0 .../config/rbac/kustomization.yaml | 1 - .../dist/install.yaml | 18 --- .../{rbac => manager}/metrics_service.yaml | 0 .../config/rbac/kustomization.yaml | 1 - .../project-v4-multigroup/dist/install.yaml | 18 --- .../{rbac => manager}/metrics_service.yaml | 0 .../config/rbac/kustomization.yaml | 1 - .../dist/install.yaml | 18 --- .../{rbac => manager}/metrics_service.yaml | 0 .../config/rbac/kustomization.yaml | 1 - .../project-v4-with-grafana/dist/install.yaml | 18 --- .../{rbac => manager}/metrics_service.yaml | 0 .../project-v4/config/rbac/kustomization.yaml | 1 - testdata/project-v4/dist/install.yaml | 18 --- 28 files changed, 74 insertions(+), 157 deletions(-) rename docs/book/src/cronjob-tutorial/testdata/project/config/{rbac => manager}/metrics_service.yaml (100%) rename docs/book/src/getting-started/testdata/project/config/{rbac => manager}/metrics_service.yaml (100%) rename pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/{rbac => manager}/metrics_service.go (94%) rename testdata/project-v4-multigroup-with-deploy-image/config/{rbac => manager}/metrics_service.yaml (100%) rename testdata/project-v4-multigroup/config/{rbac => manager}/metrics_service.yaml (100%) rename testdata/project-v4-with-deploy-image/config/{rbac => manager}/metrics_service.yaml (100%) rename testdata/project-v4-with-grafana/config/{rbac => manager}/metrics_service.yaml (100%) rename testdata/project-v4/config/{rbac => manager}/metrics_service.yaml (100%) diff --git a/docs/book/src/cronjob-tutorial/testdata/project/config/manager/kustomization.yaml b/docs/book/src/cronjob-tutorial/testdata/project/config/manager/kustomization.yaml index 5c5f0b84cba..b20065c3d5c 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/config/manager/kustomization.yaml +++ b/docs/book/src/cronjob-tutorial/testdata/project/config/manager/kustomization.yaml @@ -1,2 +1,4 @@ resources: - manager.yaml +# If you want to expose the metrics endpoint without TLS/HTTP protection, uncomment the following line. +#- metrics_service.yaml diff --git a/docs/book/src/cronjob-tutorial/testdata/project/config/rbac/metrics_service.yaml b/docs/book/src/cronjob-tutorial/testdata/project/config/manager/metrics_service.yaml similarity index 100% rename from docs/book/src/cronjob-tutorial/testdata/project/config/rbac/metrics_service.yaml rename to docs/book/src/cronjob-tutorial/testdata/project/config/manager/metrics_service.yaml diff --git a/docs/book/src/cronjob-tutorial/testdata/project/config/rbac/kustomization.yaml b/docs/book/src/cronjob-tutorial/testdata/project/config/rbac/kustomization.yaml index 09d2ee4d606..46cb71e7bf1 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/config/rbac/kustomization.yaml +++ b/docs/book/src/cronjob-tutorial/testdata/project/config/rbac/kustomization.yaml @@ -9,7 +9,6 @@ resources: - role_binding.yaml - leader_election_role.yaml - leader_election_role_binding.yaml -- metrics_service.yaml # For each CRD, "Editor" and "Viewer" roles are scaffolded by # default, aiding admins in cluster management. Those roles are # not used by the Project itself. You can comment the following lines diff --git a/docs/book/src/getting-started/testdata/project/config/manager/kustomization.yaml b/docs/book/src/getting-started/testdata/project/config/manager/kustomization.yaml index 5c5f0b84cba..b20065c3d5c 100644 --- a/docs/book/src/getting-started/testdata/project/config/manager/kustomization.yaml +++ b/docs/book/src/getting-started/testdata/project/config/manager/kustomization.yaml @@ -1,2 +1,4 @@ resources: - manager.yaml +# If you want to expose the metrics endpoint without TLS/HTTP protection, uncomment the following line. +#- metrics_service.yaml diff --git a/docs/book/src/getting-started/testdata/project/config/rbac/metrics_service.yaml b/docs/book/src/getting-started/testdata/project/config/manager/metrics_service.yaml similarity index 100% rename from docs/book/src/getting-started/testdata/project/config/rbac/metrics_service.yaml rename to docs/book/src/getting-started/testdata/project/config/manager/metrics_service.yaml diff --git a/docs/book/src/getting-started/testdata/project/config/rbac/kustomization.yaml b/docs/book/src/getting-started/testdata/project/config/rbac/kustomization.yaml index a8f1075285b..75c7d0c2b48 100644 --- a/docs/book/src/getting-started/testdata/project/config/rbac/kustomization.yaml +++ b/docs/book/src/getting-started/testdata/project/config/rbac/kustomization.yaml @@ -9,7 +9,6 @@ resources: - role_binding.yaml - leader_election_role.yaml - leader_election_role_binding.yaml -- metrics_service.yaml # For each CRD, "Editor" and "Viewer" roles are scaffolded by # default, aiding admins in cluster management. Those roles are # not used by the Project itself. You can comment the following lines diff --git a/docs/book/src/reference/metrics.md b/docs/book/src/reference/metrics.md index 32aa09610c7..657d12dc9a3 100644 --- a/docs/book/src/reference/metrics.md +++ b/docs/book/src/reference/metrics.md @@ -54,6 +54,14 @@ in the file `config/default/kustomization.yaml`, see: # kind: Deployment ``` +Then, you will need to enable the Metrics Service in `config/manager/kustomization.yaml`: + +```yaml +- manager.yaml +# If you want to expose the metrics endpoint without TLS/HTTP protection, uncomment the following line. +#- metrics_service.yaml +``` + Note that projects are scaffolded by default passing the flag `--metrics-bind-address=0` to the manager to ensure that metrics are disabled. See the [controller-runtime implementation](https://github.com/kubernetes-sigs/controller-runtime/blob/834905b07c7b5a78e86d21d764f7c2fdaa9602e0/pkg/metrics/server/server.go#L119-L122) diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/init.go b/pkg/plugins/common/kustomize/v2/scaffolds/init.go index b3a5c1a72f4..5fca6c5c3e1 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/init.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/init.go @@ -64,7 +64,7 @@ func (s *initScaffolder) Scaffold() error { templates := []machinery.Builder{ &rbac.Kustomization{}, - &rbac.MetricsService{}, + &manager.MetricsService{}, &rbac.RoleBinding{}, // We need to create a Role because if the project // has not CRD define the controller-gen will not generate this file diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/kustomization.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/kustomization.go index 1331da90115..d107a0d1cd1 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/kustomization.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/kustomization.go @@ -44,4 +44,6 @@ func (f *Kustomization) SetTemplateDefaults() error { const kustomizeManagerTemplate = `resources: - manager.yaml +# If you want to expose the metrics endpoint without TLS/HTTP protection, uncomment the following line. +#- metrics_service.yaml ` diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/rbac/metrics_service.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/metrics_service.go similarity index 94% rename from pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/rbac/metrics_service.go rename to pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/metrics_service.go index 7a0619cf6a5..91a7f0417f0 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/rbac/metrics_service.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/metrics_service.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package rbac +package manager import ( "path/filepath" @@ -33,7 +33,7 @@ type MetricsService struct { // SetTemplateDefaults implements file.Template func (f *MetricsService) SetTemplateDefaults() error { if f.Path == "" { - f.Path = filepath.Join("config", "rbac", "metrics_service.yaml") + f.Path = filepath.Join("config", "manager", "metrics_service.yaml") } f.TemplateBody = metricsServiceTemplate diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/rbac/kustomization.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/rbac/kustomization.go index 92859d83b8f..099c099ea58 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/rbac/kustomization.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/rbac/kustomization.go @@ -53,5 +53,4 @@ const kustomizeRBACTemplate = `resources: - role_binding.yaml - leader_election_role.yaml - leader_election_role_binding.yaml -- metrics_service.yaml ` diff --git a/test/e2e/v4/generate_test.go b/test/e2e/v4/generate_test.go index 651977d6d92..7f66a8d6c25 100644 --- a/test/e2e/v4/generate_test.go +++ b/test/e2e/v4/generate_test.go @@ -66,6 +66,9 @@ func GenerateV4(kbc *utils.TestContext) { ExpectWithOffset(1, pluginutil.UncommentCode( filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"), metricsTarget, "#")).To(Succeed()) + ExpectWithOffset(1, pluginutil.UncommentCode( + filepath.Join(kbc.Dir, "config", "manager", "kustomization.yaml"), + "#- metrics_service.yaml", "#")).To(Succeed()) ExpectWithOffset(1, pluginutil.UncommentCode(filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"), certManagerTarget, "#")).To(Succeed()) @@ -126,6 +129,9 @@ func GenerateV4WithoutWebhooks(kbc *utils.TestContext) { ExpectWithOffset(1, pluginutil.UncommentCode( filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"), metricsTarget, "#")).To(Succeed()) + ExpectWithOffset(1, pluginutil.UncommentCode( + filepath.Join(kbc.Dir, "config", "manager", "kustomization.yaml"), + "#- metrics_service.yaml", "#")).To(Succeed()) if kbc.IsRestricted { By("uncomment kustomize files to ensure that pods are restricted") diff --git a/test/e2e/v4/plugin_cluster_test.go b/test/e2e/v4/plugin_cluster_test.go index 71c2d36fa50..c6ad9d548e6 100644 --- a/test/e2e/v4/plugin_cluster_test.go +++ b/test/e2e/v4/plugin_cluster_test.go @@ -278,66 +278,47 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, hasMetrics bool) // curlMetrics curl's the /metrics endpoint, returning all logs once a 200 status is returned. func curlMetrics(kbc *utils.TestContext, hasMetrics bool) string { - By("validating that the controller-manager service is available") - _, err := kbc.Kubectl.Get( - true, - "service", fmt.Sprintf("e2e-%s-controller-manager-metrics-service", kbc.TestSuffix), - ) - ExpectWithOffset(2, err).NotTo(HaveOccurred(), "Controller-manager service should exist") - - By("validating that the controller-manager deployment is ready") - verifyDeploymentReady := func() error { - output, err := kbc.Kubectl.Get( + var metricsOutput string + if hasMetrics { + By("validating that the controller-manager service is available") + _, err := kbc.Kubectl.Get( true, - "deployment", fmt.Sprintf("e2e-%s-controller-manager", kbc.TestSuffix), - "-o", "jsonpath={.status.readyReplicas}", + "service", fmt.Sprintf("e2e-%s-controller-manager-metrics-service", kbc.TestSuffix), ) - if err != nil { - return err - } - readyReplicas, _ := strconv.Atoi(output) - if readyReplicas < 1 { - return fmt.Errorf("expected at least 1 ready replica, got %d", readyReplicas) - } - return nil - } - EventuallyWithOffset(2, verifyDeploymentReady, 240*time.Second, time.Second).Should(Succeed(), - "Deployment is not ready") + ExpectWithOffset(2, err).NotTo(HaveOccurred(), "Controller-manager service should exist") - By("ensuring the service endpoint is ready") - eventuallyCheckServiceEndpoint := func() error { - output, err := kbc.Kubectl.Get( - true, - "endpoints", fmt.Sprintf("e2e-%s-controller-manager-metrics-service", kbc.TestSuffix), - "-o", "jsonpath={.subsets[*].addresses[*].ip}", - ) - if err != nil { - return err + By("ensuring the service endpoint is ready") + eventuallyCheckServiceEndpoint := func() error { + output, err := kbc.Kubectl.Get( + true, + "endpoints", fmt.Sprintf("e2e-%s-controller-manager-metrics-service", kbc.TestSuffix), + "-o", "jsonpath={.subsets[*].addresses[*].ip}", + ) + if err != nil { + return err + } + if output == "" { + return fmt.Errorf("no endpoints found") + } + return nil } - if output == "" { - return fmt.Errorf("no endpoints found") + EventuallyWithOffset(2, eventuallyCheckServiceEndpoint, 2*time.Minute, time.Second).Should(Succeed(), + "Service endpoint should be ready") + + By("creating a curl pod to access the metrics endpoint") + // nolint:lll + cmdOpts := []string{ + "run", "curl", + "--restart=Never", + "--namespace", kbc.Kubectl.Namespace, + "--image=curlimages/curl:7.78.0", + "--", + "/bin/sh", "-c", fmt.Sprintf("curl -v -k http://e2e-%s-controller-manager-metrics-service.%s.svc.cluster.local:8080/metrics", + kbc.TestSuffix, kbc.Kubectl.Namespace), } - return nil - } - EventuallyWithOffset(2, eventuallyCheckServiceEndpoint, 2*time.Minute, time.Second).Should(Succeed(), - "Service endpoint should be ready") - - By("creating a curl pod to access the metrics endpoint") - // nolint:lll - cmdOpts := []string{ - "run", "curl", - "--restart=Never", - "--namespace", kbc.Kubectl.Namespace, - "--image=curlimages/curl:7.78.0", - "--", - "/bin/sh", "-c", fmt.Sprintf("curl -v -k http://e2e-%s-controller-manager-metrics-service.%s.svc.cluster.local:8080/metrics", - kbc.TestSuffix, kbc.Kubectl.Namespace), - } - _, err = kbc.Kubectl.CommandInNamespace(cmdOpts...) - ExpectWithOffset(2, err).NotTo(HaveOccurred()) + _, err = kbc.Kubectl.CommandInNamespace(cmdOpts...) + ExpectWithOffset(2, err).NotTo(HaveOccurred()) - var metricsOutput string - if hasMetrics { By("validating that the curl pod is running as expected") verifyCurlUp := func() error { status, err := kbc.Kubectl.Get( @@ -359,6 +340,20 @@ func curlMetrics(kbc *utils.TestContext, hasMetrics bool) string { } EventuallyWithOffset(2, getCurlLogs, 10*time.Second, time.Second).Should(ContainSubstring("< HTTP/1.1 200 OK")) } else { + By("creating a curl pod to access the metrics endpoint") + // nolint:lll + cmdOpts := []string{ + "run", "curl", + "--restart=Never", + "--namespace", kbc.Kubectl.Namespace, + "--image=curlimages/curl:7.78.0", + "--", + "/bin/sh", "-c", fmt.Sprintf("curl -v -k http://e2e-%s-controller-manager-metrics-service.%s.svc.cluster.local:8080/metrics", + kbc.TestSuffix, kbc.Kubectl.Namespace), + } + _, err := kbc.Kubectl.CommandInNamespace(cmdOpts...) + ExpectWithOffset(2, err).NotTo(HaveOccurred()) + By("validating that the curl pod fail as expected") verifyCurlUp := func() error { status, err := kbc.Kubectl.Get( @@ -375,14 +370,14 @@ func curlMetrics(kbc *utils.TestContext, hasMetrics bool) string { By("validating that the metrics endpoint is not working as expected") getCurlLogs := func() string { - metricsOutput, err = kbc.Kubectl.Logs("curl") + metricsOutput, err := kbc.Kubectl.Logs("curl") ExpectWithOffset(3, err).NotTo(HaveOccurred()) return metricsOutput } EventuallyWithOffset(2, getCurlLogs, 10*time.Second, time.Second).Should(ContainSubstring("Connection refused")) } By("cleaning up the curl pod") - _, err = kbc.Kubectl.Delete(true, "pods/curl") + _, err := kbc.Kubectl.Delete(true, "pods/curl") ExpectWithOffset(3, err).NotTo(HaveOccurred()) return metricsOutput diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/metrics_service.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/manager/metrics_service.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/metrics_service.yaml rename to testdata/project-v4-multigroup-with-deploy-image/config/manager/metrics_service.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/kustomization.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/kustomization.yaml index 51bf3b2bea4..a2f9efd10a3 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/kustomization.yaml +++ b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/kustomization.yaml @@ -9,7 +9,6 @@ resources: - role_binding.yaml - leader_election_role.yaml - leader_election_role_binding.yaml -- metrics_service.yaml # For each CRD, "Editor" and "Viewer" roles are scaffolded by # default, aiding admins in cluster management. Those roles are # not used by the Project itself. You can comment the following lines diff --git a/testdata/project-v4-multigroup-with-deploy-image/dist/install.yaml b/testdata/project-v4-multigroup-with-deploy-image/dist/install.yaml index a9d09c8aebb..9a4abb101e0 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/dist/install.yaml +++ b/testdata/project-v4-multigroup-with-deploy-image/dist/install.yaml @@ -1474,24 +1474,6 @@ subjects: --- apiVersion: v1 kind: Service -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - control-plane: controller-manager - name: project-v4-multigroup-with-deploy-image-controller-manager-metrics-service - namespace: project-v4-multigroup-with-deploy-image-system -spec: - ports: - - name: http - port: 8080 - protocol: TCP - targetPort: 8080 - selector: - control-plane: controller-manager ---- -apiVersion: v1 -kind: Service metadata: labels: app.kubernetes.io/managed-by: kustomize diff --git a/testdata/project-v4-multigroup/config/rbac/metrics_service.yaml b/testdata/project-v4-multigroup/config/manager/metrics_service.yaml similarity index 100% rename from testdata/project-v4-multigroup/config/rbac/metrics_service.yaml rename to testdata/project-v4-multigroup/config/manager/metrics_service.yaml diff --git a/testdata/project-v4-multigroup/config/rbac/kustomization.yaml b/testdata/project-v4-multigroup/config/rbac/kustomization.yaml index 51bf3b2bea4..a2f9efd10a3 100644 --- a/testdata/project-v4-multigroup/config/rbac/kustomization.yaml +++ b/testdata/project-v4-multigroup/config/rbac/kustomization.yaml @@ -9,7 +9,6 @@ resources: - role_binding.yaml - leader_election_role.yaml - leader_election_role_binding.yaml -- metrics_service.yaml # For each CRD, "Editor" and "Viewer" roles are scaffolded by # default, aiding admins in cluster management. Those roles are # not used by the Project itself. You can comment the following lines diff --git a/testdata/project-v4-multigroup/dist/install.yaml b/testdata/project-v4-multigroup/dist/install.yaml index 4d4a95129c3..1694d276d0f 100644 --- a/testdata/project-v4-multigroup/dist/install.yaml +++ b/testdata/project-v4-multigroup/dist/install.yaml @@ -1474,24 +1474,6 @@ subjects: --- apiVersion: v1 kind: Service -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - control-plane: controller-manager - name: project-v4-multigroup-controller-manager-metrics-service - namespace: project-v4-multigroup-system -spec: - ports: - - name: http - port: 8080 - protocol: TCP - targetPort: 8080 - selector: - control-plane: controller-manager ---- -apiVersion: v1 -kind: Service metadata: labels: app.kubernetes.io/managed-by: kustomize diff --git a/testdata/project-v4-with-deploy-image/config/rbac/metrics_service.yaml b/testdata/project-v4-with-deploy-image/config/manager/metrics_service.yaml similarity index 100% rename from testdata/project-v4-with-deploy-image/config/rbac/metrics_service.yaml rename to testdata/project-v4-with-deploy-image/config/manager/metrics_service.yaml diff --git a/testdata/project-v4-with-deploy-image/config/rbac/kustomization.yaml b/testdata/project-v4-with-deploy-image/config/rbac/kustomization.yaml index 234947b0ce5..1a988b476a3 100644 --- a/testdata/project-v4-with-deploy-image/config/rbac/kustomization.yaml +++ b/testdata/project-v4-with-deploy-image/config/rbac/kustomization.yaml @@ -9,7 +9,6 @@ resources: - role_binding.yaml - leader_election_role.yaml - leader_election_role_binding.yaml -- metrics_service.yaml # For each CRD, "Editor" and "Viewer" roles are scaffolded by # default, aiding admins in cluster management. Those roles are # not used by the Project itself. You can comment the following lines diff --git a/testdata/project-v4-with-deploy-image/dist/install.yaml b/testdata/project-v4-with-deploy-image/dist/install.yaml index a2ac764e08c..6a99fdc2f2e 100644 --- a/testdata/project-v4-with-deploy-image/dist/install.yaml +++ b/testdata/project-v4-with-deploy-image/dist/install.yaml @@ -550,24 +550,6 @@ subjects: --- apiVersion: v1 kind: Service -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-with-deploy-image - control-plane: controller-manager - name: project-v4-with-deploy-image-controller-manager-metrics-service - namespace: project-v4-with-deploy-image-system -spec: - ports: - - name: http - port: 8080 - protocol: TCP - targetPort: 8080 - selector: - control-plane: controller-manager ---- -apiVersion: v1 -kind: Service metadata: labels: app.kubernetes.io/managed-by: kustomize diff --git a/testdata/project-v4-with-grafana/config/rbac/metrics_service.yaml b/testdata/project-v4-with-grafana/config/manager/metrics_service.yaml similarity index 100% rename from testdata/project-v4-with-grafana/config/rbac/metrics_service.yaml rename to testdata/project-v4-with-grafana/config/manager/metrics_service.yaml diff --git a/testdata/project-v4-with-grafana/config/rbac/kustomization.yaml b/testdata/project-v4-with-grafana/config/rbac/kustomization.yaml index cb51d20d1cf..166fe79868f 100644 --- a/testdata/project-v4-with-grafana/config/rbac/kustomization.yaml +++ b/testdata/project-v4-with-grafana/config/rbac/kustomization.yaml @@ -9,4 +9,3 @@ resources: - role_binding.yaml - leader_election_role.yaml - leader_election_role_binding.yaml -- metrics_service.yaml diff --git a/testdata/project-v4-with-grafana/dist/install.yaml b/testdata/project-v4-with-grafana/dist/install.yaml index 144e0d4f7d2..6831125a6a1 100644 --- a/testdata/project-v4-with-grafana/dist/install.yaml +++ b/testdata/project-v4-with-grafana/dist/install.yaml @@ -107,24 +107,6 @@ subjects: name: project-v4-with-grafana-controller-manager namespace: project-v4-with-grafana-system --- -apiVersion: v1 -kind: Service -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-with-grafana - control-plane: controller-manager - name: project-v4-with-grafana-controller-manager-metrics-service - namespace: project-v4-with-grafana-system -spec: - ports: - - name: http - port: 8080 - protocol: TCP - targetPort: 8080 - selector: - control-plane: controller-manager ---- apiVersion: apps/v1 kind: Deployment metadata: diff --git a/testdata/project-v4/config/rbac/metrics_service.yaml b/testdata/project-v4/config/manager/metrics_service.yaml similarity index 100% rename from testdata/project-v4/config/rbac/metrics_service.yaml rename to testdata/project-v4/config/manager/metrics_service.yaml diff --git a/testdata/project-v4/config/rbac/kustomization.yaml b/testdata/project-v4/config/rbac/kustomization.yaml index 6dd56c7db27..2a7debcd3a1 100644 --- a/testdata/project-v4/config/rbac/kustomization.yaml +++ b/testdata/project-v4/config/rbac/kustomization.yaml @@ -9,7 +9,6 @@ resources: - role_binding.yaml - leader_election_role.yaml - leader_election_role_binding.yaml -- metrics_service.yaml # For each CRD, "Editor" and "Viewer" roles are scaffolded by # default, aiding admins in cluster management. Those roles are # not used by the Project itself. You can comment the following lines diff --git a/testdata/project-v4/dist/install.yaml b/testdata/project-v4/dist/install.yaml index ada9cb0e05d..4144d2f3017 100644 --- a/testdata/project-v4/dist/install.yaml +++ b/testdata/project-v4/dist/install.yaml @@ -544,24 +544,6 @@ subjects: --- apiVersion: v1 kind: Service -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4 - control-plane: controller-manager - name: project-v4-controller-manager-metrics-service - namespace: project-v4-system -spec: - ports: - - name: http - port: 8080 - protocol: TCP - targetPort: 8080 - selector: - control-plane: controller-manager ---- -apiVersion: v1 -kind: Service metadata: labels: app.kubernetes.io/managed-by: kustomize