diff --git a/test/testdata/generate.sh b/test/testdata/generate.sh index 5a517bdf9b7..42a1f2d2807 100755 --- a/test/testdata/generate.sh +++ b/test/testdata/generate.sh @@ -32,29 +32,19 @@ function scaffold_test_project { pushd $testdata_dir/$project header_text "Generating project ${project} with flags: ${init_flags}" - go mod init sigs.k8s.io/kubebuilder/testdata/$project # our repo autodetection will traverse up to the kb module if we don't do this - header_text "Initializing project ..." $kb init $init_flags --domain testproject.org --license apache2 --owner "The Kubernetes authors" - if [ $project == "project-v4" ] || [ $project == "project-v4-config" ]; then + if [ $project == "project-v4" ] ; then header_text 'Creating APIs ...' $kb create api --group crew --version v1 --kind Captain --controller=true --resource=true --make=false $kb create api --group crew --version v1 --kind Captain --controller=true --resource=true --make=false --force $kb create webhook --group crew --version v1 --kind Captain --defaulting --programmatic-validation $kb create api --group crew --version v1 --kind FirstMate --controller=true --resource=true --make=false $kb create webhook --group crew --version v1 --kind FirstMate --conversion - - if [ $project == "project-v4" ]; then - $kb create api --group crew --version v1 --kind Admiral --plural=admirales --controller=true --resource=true --namespaced=false --make=false - $kb create webhook --group crew --version v1 --kind Admiral --plural=admirales --defaulting - else - $kb create api --group crew --version v1 --kind Admiral --controller=true --resource=true --namespaced=false --make=false - $kb create webhook --group crew --version v1 --kind Admiral --defaulting - fi - - $kb create api --group crew --version v1 --kind Laker --controller=true --resource=false --make=false + $kb create api --group crew --version v1 --kind Admiral --plural=admirales --controller=true --resource=true --namespaced=false --make=false + $kb create webhook --group crew --version v1 --kind Admiral --plural=admirales --defaulting elif [[ $project =~ multigroup ]]; then header_text 'Switching to multigroup layout ...' $kb edit --multigroup=true @@ -65,46 +55,36 @@ function scaffold_test_project { $kb create api --group ship --version v1beta1 --kind Frigate --controller=true --resource=true --make=false $kb create webhook --group ship --version v1beta1 --kind Frigate --conversion - $kb create api --group ship --version v1 --kind Destroyer --controller=true --resource=true --namespaced=false --make=false $kb create webhook --group ship --version v1 --kind Destroyer --defaulting - $kb create api --group ship --version v2alpha1 --kind Cruiser --controller=true --resource=true --namespaced=false --make=false $kb create webhook --group ship --version v2alpha1 --kind Cruiser --programmatic-validation $kb create api --group sea-creatures --version v1beta1 --kind Kraken --controller=true --resource=true --make=false - $kb create api --group sea-creatures --version v1beta2 --kind Leviathan --controller=true --resource=true --make=false - $kb create api --group foo.policy --version v1 --kind HealthCheckPolicy --controller=true --resource=true --make=false - $kb create api --group apps --version v1 --kind Deployment --controller=true --resource=false --make=false - $kb create api --group foo --version v1 --kind Bar --controller=true --resource=true --make=false $kb create api --group fiz --version v1 --kind Bar --controller=true --resource=true --make=false - if [ $project == "project-v4-multigroup" ] || [ $project == "project-v4-multigroup-with-deploy-image" ] ; then - $kb create api --version v1 --kind Lakers --controller=true --resource=true --make=false - $kb create webhook --version v1 --kind Lakers --defaulting --programmatic-validation + $kb create api --version v1 --kind Lakers --controller=true --resource=true --make=false + $kb create webhook --version v1 --kind Lakers --defaulting --programmatic-validation + elif [[ $project =~ deploy-image ]] || [[ $project =~ multigroup ]]; then + header_text 'Creating Memcached API with deploy-image plugin ...' + $kb create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:memcached:1.6.26-alpine3.19 --image-container-command="memcached,-m=64,-o,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha" --make=false + if [[ $project =~ deploy-image ]]; then + header_text 'Creating Busybox API with deploy-image plugin ...' + $kb create api --group example.com --version v1alpha1 --kind Busybox --image=busybox:1.36.1 --plugins="deploy-image/v1-alpha" --make=false + header_text 'Creating Validating webhook for Memcached ...' + $kb create webhook --group example.com --version v1alpha1 --kind Memcached --programmatic-validation + fi + if [[ $project =~ multigroup ]]; then + header_text 'Editing project with Grafana plugin ...' + $kb edit --plugins=grafana.kubebuilder.io/v1-alpha fi - elif [[ $project =~ deploy-image ]]; then - header_text 'Creating Memcached API with deploy-image plugin ...' - $kb create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:memcached:1.6.26-alpine3.19 --image-container-command="memcached,-m=64,-o,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha" --make=false - $kb create api --group example.com --version v1alpha1 --kind Busybox --image=busybox:1.36.1 --plugins="deploy-image/v1-alpha" --make=false - header_text 'Creating Memcached webhook ...' - $kb create webhook --group example.com --version v1alpha1 --kind Memcached --programmatic-validation - fi - - if [[ $project == project-v4-with-grafana ]]; then - header_text 'Editing project with Grafana plugin ...' - $kb edit --plugins=grafana.kubebuilder.io/v1-alpha - fi - - make generate manifests - if [[ $project =~ v4 ]]; then - make build-installer fi + make build-installer rm -f go.sum go mod tidy popd @@ -113,7 +93,5 @@ function scaffold_test_project { build_kb scaffold_test_project project-v4 --plugins="go/v4" -scaffold_test_project project-v4-multigroup --plugins="go/v4" -scaffold_test_project project-v4-multigroup-with-deploy-image --plugins="go/v4" +scaffold_test_project project-v4-multigroup-with-optional-plugins --plugins="go/v4" scaffold_test_project project-v4-with-deploy-image --plugins="go/v4" -scaffold_test_project project-v4-with-grafana --plugins="go/v4" diff --git a/test/testdata/test.sh b/test/testdata/test.sh index abf7ffb5f04..3edb90ddcf6 100755 --- a/test/testdata/test.sh +++ b/test/testdata/test.sh @@ -32,7 +32,5 @@ build_kb # Project version v4-alpha test_project project-v4 -test_project project-v4-multigroup -test_project project-v4-multigroup-with-deploy-image +test_project project-v4-multigroup-with-optional-plugins test_project project-v4-with-deploy-image -test_project project-v4-with-grafana diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/default/kustomization.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/default/kustomization.yaml deleted file mode 100644 index ef209c84019..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/default/kustomization.yaml +++ /dev/null @@ -1,151 +0,0 @@ -# Adds namespace to all resources. -namespace: project-v4-multigroup-with-deploy-image-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-multigroup-with-deploy-image- - -# Labels to add to all resources and selectors. -#labels: -#- includeSelectors: true -# pairs: -# someName: someValue - -resources: -- ../crd -- ../rbac -- ../manager -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in -# crd/kustomization.yaml -- ../webhook -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required. -#- ../certmanager -# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. -#- ../prometheus -# [METRICS] Expose the controller manager metrics service. -- metrics_service.yaml -# [NETWORK POLICY] Protect the /metrics endpoint and Webhook Server with NetworkPolicy. -# Only Pod(s) running a namespace labeled with 'metrics: enabled' will be able to gather the metrics. -# Only CR(s) which requires webhooks and are applied on namespaces labeled with 'webhooks: enabled' will -# be able to communicate with the Webhook Server. -#- ../network-policy - -# Uncomment the patches line if you enable Metrics, and/or are using webhooks and cert-manager -patches: -# [METRICS] The following patch will enable the metrics endpoint using HTTPS and the port :8443. -# More info: https://book.kubebuilder.io/reference/metrics -- path: manager_metrics_patch.yaml - target: - kind: Deployment - -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in -# crd/kustomization.yaml -- path: manager_webhook_patch.yaml - -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. -# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks. -# 'CERTMANAGER' needs to be enabled to use ca injection -#- path: webhookcainjection_patch.yaml - -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. -# Uncomment the following replacements to add the cert-manager CA injection annotations -#replacements: -# - source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -# fieldPath: .metadata.namespace # namespace of the certificate CR -# targets: -# - select: -# kind: ValidatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - select: -# kind: MutatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - select: -# kind: CustomResourceDefinition -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - source: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -# fieldPath: .metadata.name -# targets: -# - select: -# kind: ValidatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - select: -# kind: MutatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - select: -# kind: CustomResourceDefinition -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - source: # Add cert-manager annotation to the webhook Service -# kind: Service -# version: v1 -# name: webhook-service -# fieldPath: .metadata.name # namespace of the service -# targets: -# - select: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# fieldPaths: -# - .spec.dnsNames.0 -# - .spec.dnsNames.1 -# options: -# delimiter: '.' -# index: 0 -# create: true -# - source: -# kind: Service -# version: v1 -# name: webhook-service -# fieldPath: .metadata.namespace # namespace of the service -# targets: -# - select: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# fieldPaths: -# - .spec.dnsNames.0 -# - .spec.dnsNames.1 -# options: -# delimiter: '.' -# index: 1 -# create: true diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/default/metrics_service.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/default/metrics_service.yaml deleted file mode 100644 index d2be1833a4c..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/default/metrics_service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - control-plane: controller-manager - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: controller-manager-metrics-service - namespace: system -spec: - ports: - - name: https - port: 8443 - protocol: TCP - targetPort: 8443 - selector: - control-plane: controller-manager diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/network-policy/allow-metrics-traffic.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/network-policy/allow-metrics-traffic.yaml deleted file mode 100644 index 14e2a89ee75..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/network-policy/allow-metrics-traffic.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# This NetworkPolicy allows ingress traffic -# with Pods running on namespaces labeled with 'metrics: enabled'. Only Pods on those -# namespaces are able to gathering data from the metrics endpoint. -apiVersion: networking.k8s.io/v1 -kind: NetworkPolicy -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: allow-metrics-traffic - namespace: system -spec: - podSelector: - matchLabels: - control-plane: controller-manager - policyTypes: - - Ingress - ingress: - # This allows ingress traffic from any namespace with the label metrics: enabled - - from: - - namespaceSelector: - matchLabels: - metrics: enabled # Only from namespaces with this label - ports: - - port: 8443 - protocol: TCP diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/network-policy/allow-webhook-traffic.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/network-policy/allow-webhook-traffic.yaml deleted file mode 100644 index c5a8be28260..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/network-policy/allow-webhook-traffic.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# This NetworkPolicy allows ingress traffic to your webhook server running -# as part of the controller-manager from specific namespaces and pods. CR(s) which uses webhooks -# will only work when applied in namespaces labeled with 'webhook: enabled' -apiVersion: networking.k8s.io/v1 -kind: NetworkPolicy -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: allow-webhook-traffic - namespace: system -spec: - podSelector: - matchLabels: - control-plane: controller-manager - policyTypes: - - Ingress - ingress: - # This allows ingress traffic from any namespace with the label webhook: enabled - - from: - - namespaceSelector: - matchLabels: - webhook: enabled # Only from namespaces with this label - ports: - - port: 443 - protocol: TCP diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/prometheus/monitor.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/prometheus/monitor.yaml deleted file mode 100644 index 34e71995b62..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/prometheus/monitor.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Prometheus Monitor Service (Metrics) -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - labels: - control-plane: controller-manager - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: controller-manager-metrics-monitor - namespace: system -spec: - endpoints: - - path: /metrics - port: https # Ensure this is the name of the port that exposes HTTPS metrics - scheme: https - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token - tlsConfig: - # TODO(user): The option insecureSkipVerify: true is not recommended for production since it disables - # certificate verification. This poses a significant security risk by making the system vulnerable to - # man-in-the-middle attacks, where an attacker could intercept and manipulate the communication between - # Prometheus and the monitored services. This could lead to unauthorized access to sensitive metrics data, - # compromising the integrity and confidentiality of the information. - # Please use the following options for secure configurations: - # caFile: /etc/metrics-certs/ca.crt - # certFile: /etc/metrics-certs/tls.crt - # keyFile: /etc/metrics-certs/tls.key - insecureSkipVerify: true - selector: - matchLabels: - control-plane: controller-manager diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/crew_captain_editor_role.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/crew_captain_editor_role.yaml deleted file mode 100644 index 68ef9aa89e4..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/crew_captain_editor_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to edit captains. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: crew-captain-editor-role -rules: -- apiGroups: - - crew.testproject.org - resources: - - captains - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - crew.testproject.org - resources: - - captains/status - verbs: - - get diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/crew_captain_viewer_role.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/crew_captain_viewer_role.yaml deleted file mode 100644 index 3f638c7766e..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/crew_captain_viewer_role.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# permissions for end users to view captains. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: crew-captain-viewer-role -rules: -- apiGroups: - - crew.testproject.org - resources: - - captains - verbs: - - get - - list - - watch -- apiGroups: - - crew.testproject.org - resources: - - captains/status - verbs: - - get diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/fiz_bar_viewer_role.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/fiz_bar_viewer_role.yaml deleted file mode 100644 index 66ab8490b61..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/fiz_bar_viewer_role.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# permissions for end users to view bars. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: fiz-bar-viewer-role -rules: -- apiGroups: - - fiz.testproject.org - resources: - - bars - verbs: - - get - - list - - watch -- apiGroups: - - fiz.testproject.org - resources: - - bars/status - verbs: - - get diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo.policy_healthcheckpolicy_editor_role.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo.policy_healthcheckpolicy_editor_role.yaml deleted file mode 100644 index 1c7824d9942..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo.policy_healthcheckpolicy_editor_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to edit healthcheckpolicies. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: foo.policy-healthcheckpolicy-editor-role -rules: -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies/status - verbs: - - get diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo_bar_editor_role.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo_bar_editor_role.yaml deleted file mode 100644 index b20dabf9bad..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo_bar_editor_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to edit bars. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: foo-bar-editor-role -rules: -- apiGroups: - - foo.testproject.org - resources: - - bars - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - foo.testproject.org - resources: - - bars/status - verbs: - - get diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/lakers_editor_role.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/lakers_editor_role.yaml deleted file mode 100644 index d77c7e58169..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/lakers_editor_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to edit lakers. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: lakers-editor-role -rules: -- apiGroups: - - testproject.org - resources: - - lakers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - testproject.org - resources: - - lakers/status - verbs: - - get diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/lakers_viewer_role.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/lakers_viewer_role.yaml deleted file mode 100644 index e0863e68a65..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/lakers_viewer_role.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# permissions for end users to view lakers. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: lakers-viewer-role -rules: -- apiGroups: - - testproject.org - resources: - - lakers - verbs: - - get - - list - - watch -- apiGroups: - - testproject.org - resources: - - lakers/status - verbs: - - get diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/leader_election_role_binding.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/leader_election_role_binding.yaml deleted file mode 100644 index 7612b3e3f66..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/leader_election_role_binding.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: leader-election-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: leader-election-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_leviathan_viewer_role.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_leviathan_viewer_role.yaml deleted file mode 100644 index cb22d2cc7ea..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_leviathan_viewer_role.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# permissions for end users to view leviathans. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: sea-creatures-leviathan-viewer-role -rules: -- apiGroups: - - sea-creatures.testproject.org - resources: - - leviathans - verbs: - - get - - list - - watch -- apiGroups: - - sea-creatures.testproject.org - resources: - - leviathans/status - verbs: - - get diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/service_account.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/service_account.yaml deleted file mode 100644 index 929b9eb1584..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/service_account.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: controller-manager - namespace: system diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_destroyer_editor_role.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_destroyer_editor_role.yaml deleted file mode 100644 index 2aa4623823d..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_destroyer_editor_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to edit destroyers. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: ship-destroyer-editor-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - destroyers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - ship.testproject.org - resources: - - destroyers/status - verbs: - - get diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_destroyer_viewer_role.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_destroyer_viewer_role.yaml deleted file mode 100644 index e35439a76ee..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_destroyer_viewer_role.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# permissions for end users to view destroyers. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: ship-destroyer-viewer-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - destroyers - verbs: - - get - - list - - watch -- apiGroups: - - ship.testproject.org - resources: - - destroyers/status - verbs: - - get diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_frigate_editor_role.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_frigate_editor_role.yaml deleted file mode 100644 index 6938a6b55ea..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_frigate_editor_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to edit frigates. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: ship-frigate-editor-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - frigates - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - ship.testproject.org - resources: - - frigates/status - verbs: - - get diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/samples/crew_v1_captain.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/samples/crew_v1_captain.yaml deleted file mode 100644 index 5ee2dcbccdf..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/samples/crew_v1_captain.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: crew.testproject.org/v1 -kind: Captain -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: captain-sample -spec: - # TODO(user): Add fields here diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/samples/fiz_v1_bar.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/samples/fiz_v1_bar.yaml deleted file mode 100644 index 98d30c85204..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/samples/fiz_v1_bar.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: fiz.testproject.org/v1 -kind: Bar -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: bar-sample -spec: - # TODO(user): Add fields here diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/webhook/service.yaml b/testdata/project-v4-multigroup-with-deploy-image/config/webhook/service.yaml deleted file mode 100644 index 55a8a9cbcb7..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/config/webhook/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - app.kubernetes.io/managed-by: kustomize - name: webhook-service - namespace: system -spec: - ports: - - port: 443 - protocol: TCP - targetPort: 9443 - selector: - control-plane: controller-manager diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo.policy/healthcheckpolicy_controller_test.go b/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo.policy/healthcheckpolicy_controller_test.go deleted file mode 100644 index 57b911e8893..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo.policy/healthcheckpolicy_controller_test.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package foopolicy - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/foo.policy/v1" -) - -var _ = Describe("HealthCheckPolicy Controller", func() { - Context("When reconciling a resource", func() { - const resourceName = "test-resource" - - ctx := context.Background() - - typeNamespacedName := types.NamespacedName{ - Name: resourceName, - Namespace: "default", // TODO(user):Modify as needed - } - healthcheckpolicy := &foopolicyv1.HealthCheckPolicy{} - - BeforeEach(func() { - By("creating the custom resource for the Kind HealthCheckPolicy") - err := k8sClient.Get(ctx, typeNamespacedName, healthcheckpolicy) - if err != nil && errors.IsNotFound(err) { - resource := &foopolicyv1.HealthCheckPolicy{ - ObjectMeta: metav1.ObjectMeta{ - Name: resourceName, - Namespace: "default", - }, - // TODO(user): Specify other spec details if needed. - } - Expect(k8sClient.Create(ctx, resource)).To(Succeed()) - } - }) - - AfterEach(func() { - // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &foopolicyv1.HealthCheckPolicy{} - err := k8sClient.Get(ctx, typeNamespacedName, resource) - Expect(err).NotTo(HaveOccurred()) - - By("Cleanup the specific resource instance HealthCheckPolicy") - Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) - }) - It("should successfully reconcile the resource", func() { - By("Reconciling the created resource") - controllerReconciler := &HealthCheckPolicyReconciler{ - Client: k8sClient, - Scheme: k8sClient.Scheme(), - } - - _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ - NamespacedName: typeNamespacedName, - }) - Expect(err).NotTo(HaveOccurred()) - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -}) diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo.policy/suite_test.go b/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo.policy/suite_test.go deleted file mode 100644 index 443b6e97462..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo.policy/suite_test.go +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package foopolicy - -import ( - "context" - "fmt" - "path/filepath" - "runtime" - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - - foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/foo.policy/v1" - // +kubebuilder:scaffold:imports -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestControllers(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Controller Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: true, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - err = foopolicyv1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/lakers_controller.go b/testdata/project-v4-multigroup-with-deploy-image/internal/controller/lakers_controller.go deleted file mode 100644 index 4605f649509..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/lakers_controller.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" - - testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/v1" -) - -// LakersReconciler reconciles a Lakers object -type LakersReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=testproject.org,resources=lakers,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=testproject.org,resources=lakers/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=testproject.org,resources=lakers/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the Lakers object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *LakersReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *LakersReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - For(&testprojectorgv1.Lakers{}). - Complete(r) -} diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/cruiser_controller.go b/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/cruiser_controller.go deleted file mode 100644 index 26685efed97..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/cruiser_controller.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package ship - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" - - shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1" -) - -// CruiserReconciler reconciles a Cruiser object -type CruiserReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=ship.testproject.org,resources=cruisers,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=ship.testproject.org,resources=cruisers/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=ship.testproject.org,resources=cruisers/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the Cruiser object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *CruiserReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *CruiserReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - For(&shipv2alpha1.Cruiser{}). - Complete(r) -} diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/frigate_controller.go b/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/frigate_controller.go deleted file mode 100644 index a6969cebc5a..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/frigate_controller.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package ship - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" - - shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1" -) - -// FrigateReconciler reconciles a Frigate object -type FrigateReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=ship.testproject.org,resources=frigates,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=ship.testproject.org,resources=frigates/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=ship.testproject.org,resources=frigates/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the Frigate object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *FrigateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *FrigateReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - For(&shipv1beta1.Frigate{}). - Complete(r) -} diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/frigate_controller_test.go b/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/frigate_controller_test.go deleted file mode 100644 index d8597e00598..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/frigate_controller_test.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package ship - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1" -) - -var _ = Describe("Frigate Controller", func() { - Context("When reconciling a resource", func() { - const resourceName = "test-resource" - - ctx := context.Background() - - typeNamespacedName := types.NamespacedName{ - Name: resourceName, - Namespace: "default", // TODO(user):Modify as needed - } - frigate := &shipv1beta1.Frigate{} - - BeforeEach(func() { - By("creating the custom resource for the Kind Frigate") - err := k8sClient.Get(ctx, typeNamespacedName, frigate) - if err != nil && errors.IsNotFound(err) { - resource := &shipv1beta1.Frigate{ - ObjectMeta: metav1.ObjectMeta{ - Name: resourceName, - Namespace: "default", - }, - // TODO(user): Specify other spec details if needed. - } - Expect(k8sClient.Create(ctx, resource)).To(Succeed()) - } - }) - - AfterEach(func() { - // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &shipv1beta1.Frigate{} - err := k8sClient.Get(ctx, typeNamespacedName, resource) - Expect(err).NotTo(HaveOccurred()) - - By("Cleanup the specific resource instance Frigate") - Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) - }) - It("should successfully reconcile the resource", func() { - By("Reconciling the created resource") - controllerReconciler := &FrigateReconciler{ - Client: k8sClient, - Scheme: k8sClient.Scheme(), - } - - _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ - NamespacedName: typeNamespacedName, - }) - Expect(err).NotTo(HaveOccurred()) - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -}) diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/suite_test.go b/testdata/project-v4-multigroup-with-deploy-image/internal/controller/suite_test.go deleted file mode 100644 index 2fd64959065..00000000000 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/suite_test.go +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "context" - "fmt" - "path/filepath" - "runtime" - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - - testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/v1" - // +kubebuilder:scaffold:imports -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestControllers(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Controller Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: true, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - err = testprojectorgv1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup-with-deploy-image/.devcontainer/devcontainer.json b/testdata/project-v4-multigroup-with-optional-plugins/.devcontainer/devcontainer.json similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/.devcontainer/devcontainer.json rename to testdata/project-v4-multigroup-with-optional-plugins/.devcontainer/devcontainer.json diff --git a/testdata/project-v4-multigroup-with-deploy-image/.devcontainer/post-install.sh b/testdata/project-v4-multigroup-with-optional-plugins/.devcontainer/post-install.sh similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/.devcontainer/post-install.sh rename to testdata/project-v4-multigroup-with-optional-plugins/.devcontainer/post-install.sh diff --git a/testdata/project-v4-multigroup-with-deploy-image/.dockerignore b/testdata/project-v4-multigroup-with-optional-plugins/.dockerignore similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/.dockerignore rename to testdata/project-v4-multigroup-with-optional-plugins/.dockerignore diff --git a/testdata/project-v4-multigroup-with-deploy-image/.gitignore b/testdata/project-v4-multigroup-with-optional-plugins/.gitignore similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/.gitignore rename to testdata/project-v4-multigroup-with-optional-plugins/.gitignore diff --git a/testdata/project-v4-multigroup-with-deploy-image/.golangci.yml b/testdata/project-v4-multigroup-with-optional-plugins/.golangci.yml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/.golangci.yml rename to testdata/project-v4-multigroup-with-optional-plugins/.golangci.yml diff --git a/testdata/project-v4-multigroup-with-deploy-image/Dockerfile b/testdata/project-v4-multigroup-with-optional-plugins/Dockerfile similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/Dockerfile rename to testdata/project-v4-multigroup-with-optional-plugins/Dockerfile diff --git a/testdata/project-v4-multigroup-with-deploy-image/Makefile b/testdata/project-v4-multigroup-with-optional-plugins/Makefile similarity index 97% rename from testdata/project-v4-multigroup-with-deploy-image/Makefile rename to testdata/project-v4-multigroup-with-optional-plugins/Makefile index be1d2738b96..124cc8e5569 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/Makefile +++ b/testdata/project-v4-multigroup-with-optional-plugins/Makefile @@ -120,10 +120,10 @@ PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le docker-buildx: ## Build and push docker image for the manager for cross-platform support # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross - - $(CONTAINER_TOOL) buildx create --name project-v4-multigroup-with-deploy-image-builder - $(CONTAINER_TOOL) buildx use project-v4-multigroup-with-deploy-image-builder + - $(CONTAINER_TOOL) buildx create --name project-v4-multigroup-with-optional-plugins-builder + $(CONTAINER_TOOL) buildx use project-v4-multigroup-with-optional-plugins-builder - $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . - - $(CONTAINER_TOOL) buildx rm project-v4-multigroup-with-deploy-image-builder + - $(CONTAINER_TOOL) buildx rm project-v4-multigroup-with-optional-plugins-builder rm Dockerfile.cross .PHONY: build-installer diff --git a/testdata/project-v4-multigroup-with-deploy-image/PROJECT b/testdata/project-v4-multigroup-with-optional-plugins/PROJECT similarity index 86% rename from testdata/project-v4-multigroup-with-deploy-image/PROJECT rename to testdata/project-v4-multigroup-with-optional-plugins/PROJECT index c225adc3d9e..5a6e0e8d04c 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/PROJECT +++ b/testdata/project-v4-multigroup-with-optional-plugins/PROJECT @@ -6,8 +6,8 @@ domain: testproject.org layout: - go.kubebuilder.io/v4 multigroup: true -projectName: project-v4-multigroup-with-deploy-image -repo: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image +projectName: project-v4-multigroup-with-optional-plugins +repo: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins resources: - api: crdVersion: v1 @@ -16,7 +16,7 @@ resources: domain: testproject.org group: crew kind: Captain - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/crew/v1 + path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1 version: v1 webhooks: defaulting: true @@ -29,7 +29,7 @@ resources: domain: testproject.org group: ship kind: Frigate - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1 + path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1 version: v1beta1 webhooks: conversion: true @@ -40,7 +40,7 @@ resources: domain: testproject.org group: ship kind: Destroyer - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1 + path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1 version: v1 webhooks: defaulting: true @@ -51,7 +51,7 @@ resources: domain: testproject.org group: ship kind: Cruiser - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1 + path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1 version: v2alpha1 webhooks: validation: true @@ -63,7 +63,7 @@ resources: domain: testproject.org group: sea-creatures kind: Kraken - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta1 + path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta1 version: v1beta1 - api: crdVersion: v1 @@ -72,7 +72,7 @@ resources: domain: testproject.org group: sea-creatures kind: Leviathan - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta2 + path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta2 version: v1beta2 - api: crdVersion: v1 @@ -81,7 +81,7 @@ resources: domain: testproject.org group: foo.policy kind: HealthCheckPolicy - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/foo.policy/v1 + path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/foo.policy/v1 version: v1 - controller: true group: apps @@ -95,7 +95,7 @@ resources: domain: testproject.org group: foo kind: Bar - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/foo/v1 + path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/foo/v1 version: v1 - api: crdVersion: v1 @@ -104,7 +104,7 @@ resources: domain: testproject.org group: fiz kind: Bar - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/fiz/v1 + path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/fiz/v1 version: v1 - api: crdVersion: v1 @@ -112,7 +112,7 @@ resources: controller: true domain: testproject.org kind: Lakers - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/v1 + path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/v1 version: v1 webhooks: defaulting: true diff --git a/testdata/project-v4-multigroup-with-deploy-image/README.md b/testdata/project-v4-multigroup-with-optional-plugins/README.md similarity index 92% rename from testdata/project-v4-multigroup-with-deploy-image/README.md rename to testdata/project-v4-multigroup-with-optional-plugins/README.md index eef188fbd05..3e32ad83eea 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/README.md +++ b/testdata/project-v4-multigroup-with-optional-plugins/README.md @@ -1,4 +1,4 @@ -# project-v4-multigroup-with-deploy-image +# project-v4-multigroup-with-optional-plugins // TODO(user): Add simple overview of use/purpose ## Description @@ -16,7 +16,7 @@ **Build and push your image to the location specified by `IMG`:** ```sh -make docker-build docker-push IMG=/project-v4-multigroup-with-deploy-image:tag +make docker-build docker-push IMG=/project-v4-multigroup-with-optional-plugins:tag ``` **NOTE:** This image ought to be published in the personal registry you specified. @@ -32,7 +32,7 @@ make install **Deploy the Manager to the cluster with the image specified by `IMG`:** ```sh -make deploy IMG=/project-v4-multigroup-with-deploy-image:tag +make deploy IMG=/project-v4-multigroup-with-optional-plugins:tag ``` > **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin @@ -73,7 +73,7 @@ Following are the steps to build the installer and distribute this project to us 1. Build the installer for the image built and published in the registry: ```sh -make build-installer IMG=/project-v4-multigroup-with-deploy-image:tag +make build-installer IMG=/project-v4-multigroup-with-optional-plugins:tag ``` NOTE: The makefile target mentioned above generates an 'install.yaml' @@ -86,7 +86,7 @@ its dependencies. Users can just run kubectl apply -f to install the project, i.e.: ```sh -kubectl apply -f https://raw.githubusercontent.com//project-v4-multigroup-with-deploy-image//dist/install.yaml +kubectl apply -f https://raw.githubusercontent.com//project-v4-multigroup-with-optional-plugins//dist/install.yaml ``` ## Contributing diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/captain_types.go b/testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/captain_types.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/captain_types.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/captain_types.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/captain_webhook.go b/testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/captain_webhook.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/captain_webhook.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/captain_webhook.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/captain_webhook_test.go b/testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/captain_webhook_test.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/captain_webhook_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/captain_webhook_test.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/groupversion_info.go b/testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/groupversion_info.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/groupversion_info.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/groupversion_info.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/webhook_suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/webhook_suite_test.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/webhook_suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/webhook_suite_test.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/zz_generated.deepcopy.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/zz_generated.deepcopy.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1/zz_generated.deepcopy.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/fiz/v1/bar_types.go b/testdata/project-v4-multigroup-with-optional-plugins/api/fiz/v1/bar_types.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/fiz/v1/bar_types.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/fiz/v1/bar_types.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/fiz/v1/groupversion_info.go b/testdata/project-v4-multigroup-with-optional-plugins/api/fiz/v1/groupversion_info.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/fiz/v1/groupversion_info.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/fiz/v1/groupversion_info.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/fiz/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup-with-optional-plugins/api/fiz/v1/zz_generated.deepcopy.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/fiz/v1/zz_generated.deepcopy.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/fiz/v1/zz_generated.deepcopy.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/foo.policy/v1/groupversion_info.go b/testdata/project-v4-multigroup-with-optional-plugins/api/foo.policy/v1/groupversion_info.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/foo.policy/v1/groupversion_info.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/foo.policy/v1/groupversion_info.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/foo.policy/v1/healthcheckpolicy_types.go b/testdata/project-v4-multigroup-with-optional-plugins/api/foo.policy/v1/healthcheckpolicy_types.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/foo.policy/v1/healthcheckpolicy_types.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/foo.policy/v1/healthcheckpolicy_types.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/foo.policy/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup-with-optional-plugins/api/foo.policy/v1/zz_generated.deepcopy.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/foo.policy/v1/zz_generated.deepcopy.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/foo.policy/v1/zz_generated.deepcopy.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/foo/v1/bar_types.go b/testdata/project-v4-multigroup-with-optional-plugins/api/foo/v1/bar_types.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/foo/v1/bar_types.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/foo/v1/bar_types.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/foo/v1/groupversion_info.go b/testdata/project-v4-multigroup-with-optional-plugins/api/foo/v1/groupversion_info.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/foo/v1/groupversion_info.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/foo/v1/groupversion_info.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/foo/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup-with-optional-plugins/api/foo/v1/zz_generated.deepcopy.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/foo/v1/zz_generated.deepcopy.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/foo/v1/zz_generated.deepcopy.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta1/groupversion_info.go b/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta1/groupversion_info.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta1/groupversion_info.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta1/groupversion_info.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta1/kraken_types.go b/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta1/kraken_types.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta1/kraken_types.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta1/kraken_types.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta1/zz_generated.deepcopy.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta1/zz_generated.deepcopy.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta1/zz_generated.deepcopy.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta2/groupversion_info.go b/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta2/groupversion_info.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta2/groupversion_info.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta2/groupversion_info.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta2/leviathan_types.go b/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta2/leviathan_types.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta2/leviathan_types.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta2/leviathan_types.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta2/zz_generated.deepcopy.go b/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta2/zz_generated.deepcopy.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta2/zz_generated.deepcopy.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta2/zz_generated.deepcopy.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/destroyer_types.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/destroyer_types.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/destroyer_types.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/destroyer_types.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/destroyer_webhook.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/destroyer_webhook.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/destroyer_webhook.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/destroyer_webhook.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/destroyer_webhook_test.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/destroyer_webhook_test.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/destroyer_webhook_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/destroyer_webhook_test.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/groupversion_info.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/groupversion_info.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/groupversion_info.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/groupversion_info.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/webhook_suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/webhook_suite_test.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/webhook_suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/webhook_suite_test.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/zz_generated.deepcopy.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/zz_generated.deepcopy.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1/zz_generated.deepcopy.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1/frigate_types.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1/frigate_types.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1/frigate_types.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1/frigate_types.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1/frigate_webhook.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1/frigate_webhook.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1/frigate_webhook.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1/frigate_webhook.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1/frigate_webhook_test.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1/frigate_webhook_test.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1/frigate_webhook_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1/frigate_webhook_test.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1/groupversion_info.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1/groupversion_info.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1/groupversion_info.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1/groupversion_info.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1/zz_generated.deepcopy.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1/zz_generated.deepcopy.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1/zz_generated.deepcopy.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/cruiser_types.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/cruiser_types.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/cruiser_types.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/cruiser_types.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/cruiser_webhook.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/cruiser_webhook.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/cruiser_webhook.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/cruiser_webhook.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/cruiser_webhook_test.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/cruiser_webhook_test.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/cruiser_webhook_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/cruiser_webhook_test.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/groupversion_info.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/groupversion_info.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/groupversion_info.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/groupversion_info.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/webhook_suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/webhook_suite_test.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/webhook_suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/webhook_suite_test.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/zz_generated.deepcopy.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/zz_generated.deepcopy.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1/zz_generated.deepcopy.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/v1/groupversion_info.go b/testdata/project-v4-multigroup-with-optional-plugins/api/v1/groupversion_info.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/v1/groupversion_info.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/v1/groupversion_info.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/v1/lakers_types.go b/testdata/project-v4-multigroup-with-optional-plugins/api/v1/lakers_types.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/v1/lakers_types.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/v1/lakers_types.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/v1/lakers_webhook.go b/testdata/project-v4-multigroup-with-optional-plugins/api/v1/lakers_webhook.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/v1/lakers_webhook.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/v1/lakers_webhook.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/v1/lakers_webhook_test.go b/testdata/project-v4-multigroup-with-optional-plugins/api/v1/lakers_webhook_test.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/v1/lakers_webhook_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/v1/lakers_webhook_test.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/v1/webhook_suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/api/v1/webhook_suite_test.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/v1/webhook_suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/v1/webhook_suite_test.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/api/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup-with-optional-plugins/api/v1/zz_generated.deepcopy.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/api/v1/zz_generated.deepcopy.go rename to testdata/project-v4-multigroup-with-optional-plugins/api/v1/zz_generated.deepcopy.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/cmd/main.go b/testdata/project-v4-multigroup-with-optional-plugins/cmd/main.go similarity index 92% rename from testdata/project-v4-multigroup-with-deploy-image/cmd/main.go rename to testdata/project-v4-multigroup-with-optional-plugins/cmd/main.go index 2f3408ec2be..c1baf3966ba 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/cmd/main.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/cmd/main.go @@ -35,24 +35,24 @@ import ( metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" "sigs.k8s.io/controller-runtime/pkg/webhook" - crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/crew/v1" - fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/fiz/v1" - foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/foo.policy/v1" - foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/foo/v1" - seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta1" - seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta2" - shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1" - shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1" - shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1" - testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/v1" - "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/internal/controller" - appscontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/internal/controller/apps" - crewcontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/internal/controller/crew" - fizcontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/internal/controller/fiz" - foocontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo" - foopolicycontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo.policy" - seacreaturescontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures" - shipcontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship" + crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1" + fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/fiz/v1" + foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/foo.policy/v1" + foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/foo/v1" + seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta1" + seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta2" + shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1" + shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1" + shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1" + testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/v1" + "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/internal/controller" + appscontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/apps" + crewcontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/crew" + fizcontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/fiz" + foocontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo" + foopolicycontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo.policy" + seacreaturescontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures" + shipcontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship" // +kubebuilder:scaffold:imports ) @@ -151,7 +151,7 @@ func main() { WebhookServer: webhookServer, HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, - LeaderElectionID: "65c8a5ec.testproject.org", + LeaderElectionID: "20654b5a.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-multigroup-with-deploy-image/config/certmanager/certificate.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/certmanager/certificate.yaml similarity index 83% rename from testdata/project-v4-multigroup-with-deploy-image/config/certmanager/certificate.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/certmanager/certificate.yaml index baf7c627d73..799f26b199f 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/certmanager/certificate.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/certmanager/certificate.yaml @@ -5,7 +5,7 @@ apiVersion: cert-manager.io/v1 kind: Issuer metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: selfsigned-issuer namespace: system @@ -19,8 +19,8 @@ metadata: app.kubernetes.io/name: certificate app.kubernetes.io/instance: serving-cert app.kubernetes.io/component: certificate - app.kubernetes.io/created-by: project-v4-multigroup-with-deploy-image - app.kubernetes.io/part-of: project-v4-multigroup-with-deploy-image + app.kubernetes.io/created-by: project-v4-multigroup-with-optional-plugins + app.kubernetes.io/part-of: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml namespace: system diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/certmanager/kustomization.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/certmanager/kustomization.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/certmanager/kustomization.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/certmanager/kustomization.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/certmanager/kustomizeconfig.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/certmanager/kustomizeconfig.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/certmanager/kustomizeconfig.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/certmanager/kustomizeconfig.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/crew.testproject.org_captains.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/crew.testproject.org_captains.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/crew.testproject.org_captains.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/crew.testproject.org_captains.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/fiz.testproject.org_bars.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/fiz.testproject.org_bars.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/fiz.testproject.org_bars.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/fiz.testproject.org_bars.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/foo.policy.testproject.org_healthcheckpolicies.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/foo.policy.testproject.org_healthcheckpolicies.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/foo.policy.testproject.org_healthcheckpolicies.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/foo.policy.testproject.org_healthcheckpolicies.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/foo.testproject.org_bars.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/foo.testproject.org_bars.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/foo.testproject.org_bars.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/foo.testproject.org_bars.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/sea-creatures.testproject.org_krakens.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/sea-creatures.testproject.org_krakens.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/sea-creatures.testproject.org_krakens.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/sea-creatures.testproject.org_krakens.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/sea-creatures.testproject.org_leviathans.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/sea-creatures.testproject.org_leviathans.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/sea-creatures.testproject.org_leviathans.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/sea-creatures.testproject.org_leviathans.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/ship.testproject.org_cruisers.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/ship.testproject.org_cruisers.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/ship.testproject.org_cruisers.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/ship.testproject.org_cruisers.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/ship.testproject.org_destroyers.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/ship.testproject.org_destroyers.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/ship.testproject.org_destroyers.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/ship.testproject.org_destroyers.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/ship.testproject.org_frigates.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/ship.testproject.org_frigates.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/ship.testproject.org_frigates.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/ship.testproject.org_frigates.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/testproject.org_lakers.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/testproject.org_lakers.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/bases/testproject.org_lakers.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/bases/testproject.org_lakers.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/kustomization.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/kustomization.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/kustomization.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/kustomization.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/kustomizeconfig.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/kustomizeconfig.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/kustomizeconfig.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/kustomizeconfig.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/cainjection_in_crew_captains.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/cainjection_in_crew_captains.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/cainjection_in_crew_captains.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/cainjection_in_crew_captains.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/cainjection_in_lakers.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/cainjection_in_lakers.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/cainjection_in_lakers.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/cainjection_in_lakers.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/cainjection_in_ship_cruisers.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/cainjection_in_ship_cruisers.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/cainjection_in_ship_cruisers.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/cainjection_in_ship_cruisers.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/cainjection_in_ship_destroyers.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/cainjection_in_ship_destroyers.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/cainjection_in_ship_destroyers.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/cainjection_in_ship_destroyers.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/cainjection_in_ship_frigates.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/cainjection_in_ship_frigates.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/cainjection_in_ship_frigates.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/cainjection_in_ship_frigates.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/webhook_in_crew_captains.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/webhook_in_crew_captains.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/webhook_in_crew_captains.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/webhook_in_crew_captains.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/webhook_in_lakers.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/webhook_in_lakers.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/webhook_in_lakers.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/webhook_in_lakers.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/webhook_in_ship_cruisers.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/webhook_in_ship_cruisers.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/webhook_in_ship_cruisers.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/webhook_in_ship_cruisers.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/webhook_in_ship_destroyers.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/webhook_in_ship_destroyers.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/webhook_in_ship_destroyers.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/webhook_in_ship_destroyers.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/webhook_in_ship_frigates.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/webhook_in_ship_frigates.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/crd/patches/webhook_in_ship_frigates.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/crd/patches/webhook_in_ship_frigates.yaml diff --git a/testdata/project-v4-multigroup/config/default/kustomization.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/default/kustomization.yaml similarity index 97% rename from testdata/project-v4-multigroup/config/default/kustomization.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/default/kustomization.yaml index 32e0e86801e..27da7ed806f 100644 --- a/testdata/project-v4-multigroup/config/default/kustomization.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/default/kustomization.yaml @@ -1,12 +1,12 @@ # Adds namespace to all resources. -namespace: project-v4-multigroup-system +namespace: project-v4-multigroup-with-optional-plugins-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-multigroup- +namePrefix: project-v4-multigroup-with-optional-plugins- # Labels to add to all resources and selectors. #labels: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/default/manager_metrics_patch.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/default/manager_metrics_patch.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/default/manager_metrics_patch.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/default/manager_metrics_patch.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/default/manager_webhook_patch.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/default/manager_webhook_patch.yaml similarity index 88% rename from testdata/project-v4-multigroup-with-deploy-image/config/default/manager_webhook_patch.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/default/manager_webhook_patch.yaml index 306f6ceec53..69b7c4c802d 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/default/manager_webhook_patch.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/default/manager_webhook_patch.yaml @@ -4,7 +4,7 @@ metadata: name: controller-manager namespace: system labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize spec: template: diff --git a/testdata/project-v4-with-grafana/config/default/metrics_service.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/default/metrics_service.yaml similarity index 82% rename from testdata/project-v4-with-grafana/config/default/metrics_service.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/default/metrics_service.yaml index fded59c2325..155317f9dd2 100644 --- a/testdata/project-v4-with-grafana/config/default/metrics_service.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/default/metrics_service.yaml @@ -3,7 +3,7 @@ kind: Service metadata: labels: control-plane: controller-manager - app.kubernetes.io/name: project-v4-with-grafana + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-service namespace: system diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/default/webhookcainjection_patch.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/default/webhookcainjection_patch.yaml similarity index 79% rename from testdata/project-v4-multigroup-with-deploy-image/config/default/webhookcainjection_patch.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/default/webhookcainjection_patch.yaml index 78417368c6f..351c4409f29 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/default/webhookcainjection_patch.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/default/webhookcainjection_patch.yaml @@ -4,7 +4,7 @@ apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: mutating-webhook-configuration annotations: @@ -17,8 +17,8 @@ metadata: app.kubernetes.io/name: validatingwebhookconfiguration app.kubernetes.io/instance: validating-webhook-configuration app.kubernetes.io/component: webhook - app.kubernetes.io/created-by: project-v4-multigroup-with-deploy-image - app.kubernetes.io/part-of: project-v4-multigroup-with-deploy-image + app.kubernetes.io/created-by: project-v4-multigroup-with-optional-plugins + app.kubernetes.io/part-of: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: validating-webhook-configuration annotations: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/manager/kustomization.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/manager/kustomization.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/manager/kustomization.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/manager/kustomization.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/manager/manager.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/manager/manager.yaml similarity index 95% rename from testdata/project-v4-multigroup-with-deploy-image/config/manager/manager.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/manager/manager.yaml index 6059ca1e238..a45a5acfeba 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/manager/manager.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/manager/manager.yaml @@ -3,7 +3,7 @@ kind: Namespace metadata: labels: control-plane: controller-manager - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: system --- @@ -14,7 +14,7 @@ metadata: namespace: system labels: control-plane: controller-manager - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize spec: selector: diff --git a/testdata/project-v4-multigroup/config/network-policy/allow-metrics-traffic.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/network-policy/allow-metrics-traffic.yaml similarity index 91% rename from testdata/project-v4-multigroup/config/network-policy/allow-metrics-traffic.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/network-policy/allow-metrics-traffic.yaml index 3f144fb140e..b4443b13590 100644 --- a/testdata/project-v4-multigroup/config/network-policy/allow-metrics-traffic.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/network-policy/allow-metrics-traffic.yaml @@ -5,7 +5,7 @@ apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: allow-metrics-traffic namespace: system diff --git a/testdata/project-v4-multigroup/config/network-policy/allow-webhook-traffic.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/network-policy/allow-webhook-traffic.yaml similarity index 91% rename from testdata/project-v4-multigroup/config/network-policy/allow-webhook-traffic.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/network-policy/allow-webhook-traffic.yaml index ec32d71710c..df9364a02e3 100644 --- a/testdata/project-v4-multigroup/config/network-policy/allow-webhook-traffic.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/network-policy/allow-webhook-traffic.yaml @@ -5,7 +5,7 @@ apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: allow-webhook-traffic namespace: system diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/network-policy/kustomization.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/network-policy/kustomization.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/network-policy/kustomization.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/network-policy/kustomization.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/prometheus/kustomization.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/prometheus/kustomization.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/prometheus/kustomization.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/prometheus/kustomization.yaml diff --git a/testdata/project-v4-multigroup/config/prometheus/monitor.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/prometheus/monitor.yaml similarity index 94% rename from testdata/project-v4-multigroup/config/prometheus/monitor.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/prometheus/monitor.yaml index 89d2f351f5b..c5d1ea1849c 100644 --- a/testdata/project-v4-multigroup/config/prometheus/monitor.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/prometheus/monitor.yaml @@ -4,7 +4,7 @@ kind: ServiceMonitor metadata: labels: control-plane: controller-manager - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-monitor namespace: system diff --git a/testdata/project-v4-multigroup/config/rbac/crew_captain_editor_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/crew_captain_editor_role.yaml similarity index 85% rename from testdata/project-v4-multigroup/config/rbac/crew_captain_editor_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/crew_captain_editor_role.yaml index c6a33cbfbda..f20d24c0f3e 100644 --- a/testdata/project-v4-multigroup/config/rbac/crew_captain_editor_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/crew_captain_editor_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: crew-captain-editor-role rules: diff --git a/testdata/project-v4-multigroup/config/rbac/crew_captain_viewer_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/crew_captain_viewer_role.yaml similarity index 84% rename from testdata/project-v4-multigroup/config/rbac/crew_captain_viewer_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/crew_captain_viewer_role.yaml index 7d723490e56..8e14b715e64 100644 --- a/testdata/project-v4-multigroup/config/rbac/crew_captain_viewer_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/crew_captain_viewer_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: crew-captain-viewer-role rules: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/fiz_bar_editor_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/fiz_bar_editor_role.yaml similarity index 85% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/fiz_bar_editor_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/fiz_bar_editor_role.yaml index 336f67a59bf..1b564a117a0 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/fiz_bar_editor_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/fiz_bar_editor_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: fiz-bar-editor-role rules: diff --git a/testdata/project-v4-multigroup/config/rbac/fiz_bar_viewer_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/fiz_bar_viewer_role.yaml similarity index 84% rename from testdata/project-v4-multigroup/config/rbac/fiz_bar_viewer_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/fiz_bar_viewer_role.yaml index 744a0a955c0..1416651b26b 100644 --- a/testdata/project-v4-multigroup/config/rbac/fiz_bar_viewer_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/fiz_bar_viewer_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: fiz-bar-viewer-role rules: diff --git a/testdata/project-v4-multigroup/config/rbac/foo.policy_healthcheckpolicy_editor_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo.policy_healthcheckpolicy_editor_role.yaml similarity index 87% rename from testdata/project-v4-multigroup/config/rbac/foo.policy_healthcheckpolicy_editor_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo.policy_healthcheckpolicy_editor_role.yaml index 66fa7944f70..c98da12e485 100644 --- a/testdata/project-v4-multigroup/config/rbac/foo.policy_healthcheckpolicy_editor_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo.policy_healthcheckpolicy_editor_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: foo.policy-healthcheckpolicy-editor-role rules: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo.policy_healthcheckpolicy_viewer_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo.policy_healthcheckpolicy_viewer_role.yaml similarity index 86% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo.policy_healthcheckpolicy_viewer_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo.policy_healthcheckpolicy_viewer_role.yaml index b4ad7c339a3..16320a837f0 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo.policy_healthcheckpolicy_viewer_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo.policy_healthcheckpolicy_viewer_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: foo.policy-healthcheckpolicy-viewer-role rules: diff --git a/testdata/project-v4-multigroup/config/rbac/foo_bar_editor_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo_bar_editor_role.yaml similarity index 85% rename from testdata/project-v4-multigroup/config/rbac/foo_bar_editor_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo_bar_editor_role.yaml index f05089941a4..b4769cf7135 100644 --- a/testdata/project-v4-multigroup/config/rbac/foo_bar_editor_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo_bar_editor_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: foo-bar-editor-role rules: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo_bar_viewer_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo_bar_viewer_role.yaml similarity index 84% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo_bar_viewer_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo_bar_viewer_role.yaml index 0994bd6706a..de70297605f 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/foo_bar_viewer_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/foo_bar_viewer_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: foo-bar-viewer-role rules: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/kustomization.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/kustomization.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/kustomization.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/kustomization.yaml diff --git a/testdata/project-v4-multigroup/config/rbac/lakers_editor_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/lakers_editor_role.yaml similarity index 85% rename from testdata/project-v4-multigroup/config/rbac/lakers_editor_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/lakers_editor_role.yaml index d2ee17631dd..99fab9b491e 100644 --- a/testdata/project-v4-multigroup/config/rbac/lakers_editor_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/lakers_editor_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: lakers-editor-role rules: diff --git a/testdata/project-v4-multigroup/config/rbac/lakers_viewer_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/lakers_viewer_role.yaml similarity index 83% rename from testdata/project-v4-multigroup/config/rbac/lakers_viewer_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/lakers_viewer_role.yaml index 3097aa81c5e..dd9aad84ac8 100644 --- a/testdata/project-v4-multigroup/config/rbac/lakers_viewer_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/lakers_viewer_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: lakers-viewer-role rules: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/leader_election_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/leader_election_role.yaml similarity index 88% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/leader_election_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/leader_election_role.yaml index f844786953c..ccfbb06b2ab 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/leader_election_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/leader_election_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: leader-election-role rules: diff --git a/testdata/project-v4-with-grafana/config/rbac/leader_election_role_binding.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/leader_election_role_binding.yaml similarity index 82% rename from testdata/project-v4-with-grafana/config/rbac/leader_election_role_binding.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/leader_election_role_binding.yaml index 24ead23b976..552a24a9891 100644 --- a/testdata/project-v4-with-grafana/config/rbac/leader_election_role_binding.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/leader_election_role_binding.yaml @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: labels: - app.kubernetes.io/name: project-v4-with-grafana + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: leader-election-rolebinding roleRef: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/metrics_auth_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/metrics_auth_role.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/metrics_auth_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/metrics_auth_role.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/metrics_auth_role_binding.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/metrics_auth_role_binding.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/metrics_auth_role_binding.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/metrics_auth_role_binding.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/metrics_reader_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/metrics_reader_role.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/metrics_reader_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/metrics_reader_role.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/role.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/role.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/role_binding.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/role_binding.yaml similarity index 81% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/role_binding.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/role_binding.yaml index 599a71b991f..43bb7067972 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/role_binding.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/role_binding.yaml @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: manager-rolebinding roleRef: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_kraken_editor_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_kraken_editor_role.yaml similarity index 86% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_kraken_editor_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_kraken_editor_role.yaml index 4424f108e5b..0fd90a8becd 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_kraken_editor_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_kraken_editor_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: sea-creatures-kraken-editor-role rules: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_kraken_viewer_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_kraken_viewer_role.yaml similarity index 85% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_kraken_viewer_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_kraken_viewer_role.yaml index 1912dd24ffb..ef950154b1e 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_kraken_viewer_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_kraken_viewer_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: sea-creatures-kraken-viewer-role rules: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_leviathan_editor_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_leviathan_editor_role.yaml similarity index 86% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_leviathan_editor_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_leviathan_editor_role.yaml index b856daabda2..4d7287dcc61 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/sea-creatures_leviathan_editor_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_leviathan_editor_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: sea-creatures-leviathan-editor-role rules: diff --git a/testdata/project-v4-multigroup/config/rbac/sea-creatures_leviathan_viewer_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_leviathan_viewer_role.yaml similarity index 85% rename from testdata/project-v4-multigroup/config/rbac/sea-creatures_leviathan_viewer_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_leviathan_viewer_role.yaml index e0344e4699b..216bc1f5a42 100644 --- a/testdata/project-v4-multigroup/config/rbac/sea-creatures_leviathan_viewer_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/sea-creatures_leviathan_viewer_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: sea-creatures-leviathan-viewer-role rules: diff --git a/testdata/project-v4-with-grafana/config/rbac/service_account.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/service_account.yaml similarity index 67% rename from testdata/project-v4-with-grafana/config/rbac/service_account.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/service_account.yaml index 24c0d3eb365..7ec84d49932 100644 --- a/testdata/project-v4-with-grafana/config/rbac/service_account.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/service_account.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ServiceAccount metadata: labels: - app.kubernetes.io/name: project-v4-with-grafana + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: controller-manager namespace: system diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_cruiser_editor_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_cruiser_editor_role.yaml similarity index 85% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_cruiser_editor_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_cruiser_editor_role.yaml index f9e767b202b..0f18d05d764 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_cruiser_editor_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_cruiser_editor_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: ship-cruiser-editor-role rules: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_cruiser_viewer_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_cruiser_viewer_role.yaml similarity index 84% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_cruiser_viewer_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_cruiser_viewer_role.yaml index b3ab524cd6d..3895ecff9bb 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_cruiser_viewer_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_cruiser_viewer_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: ship-cruiser-viewer-role rules: diff --git a/testdata/project-v4-multigroup/config/rbac/ship_destroyer_editor_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_destroyer_editor_role.yaml similarity index 86% rename from testdata/project-v4-multigroup/config/rbac/ship_destroyer_editor_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_destroyer_editor_role.yaml index 8b0aa1da540..37566c261f8 100644 --- a/testdata/project-v4-multigroup/config/rbac/ship_destroyer_editor_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_destroyer_editor_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: ship-destroyer-editor-role rules: diff --git a/testdata/project-v4-multigroup/config/rbac/ship_destroyer_viewer_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_destroyer_viewer_role.yaml similarity index 84% rename from testdata/project-v4-multigroup/config/rbac/ship_destroyer_viewer_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_destroyer_viewer_role.yaml index 027ff57455a..02b66827c01 100644 --- a/testdata/project-v4-multigroup/config/rbac/ship_destroyer_viewer_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_destroyer_viewer_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: ship-destroyer-viewer-role rules: diff --git a/testdata/project-v4-multigroup/config/rbac/ship_frigate_editor_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_frigate_editor_role.yaml similarity index 85% rename from testdata/project-v4-multigroup/config/rbac/ship_frigate_editor_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_frigate_editor_role.yaml index d0b243c8886..d29d336353b 100644 --- a/testdata/project-v4-multigroup/config/rbac/ship_frigate_editor_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_frigate_editor_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: ship-frigate-editor-role rules: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_frigate_viewer_role.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_frigate_viewer_role.yaml similarity index 84% rename from testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_frigate_viewer_role.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_frigate_viewer_role.yaml index 4d12c969627..39b12c11966 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/rbac/ship_frigate_viewer_role.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/rbac/ship_frigate_viewer_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: ship-frigate-viewer-role rules: diff --git a/testdata/project-v4-multigroup/config/samples/crew_v1_captain.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/crew_v1_captain.yaml similarity index 70% rename from testdata/project-v4-multigroup/config/samples/crew_v1_captain.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/samples/crew_v1_captain.yaml index 0eed664c7cb..6cd4cf986ed 100644 --- a/testdata/project-v4-multigroup/config/samples/crew_v1_captain.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/crew_v1_captain.yaml @@ -2,7 +2,7 @@ apiVersion: crew.testproject.org/v1 kind: Captain metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: captain-sample spec: diff --git a/testdata/project-v4-multigroup/config/samples/fiz_v1_bar.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/fiz_v1_bar.yaml similarity index 69% rename from testdata/project-v4-multigroup/config/samples/fiz_v1_bar.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/samples/fiz_v1_bar.yaml index ded18d76876..9459b67aa0f 100644 --- a/testdata/project-v4-multigroup/config/samples/fiz_v1_bar.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/fiz_v1_bar.yaml @@ -2,7 +2,7 @@ apiVersion: fiz.testproject.org/v1 kind: Bar metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: bar-sample spec: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/samples/foo.policy_v1_healthcheckpolicy.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/foo.policy_v1_healthcheckpolicy.yaml similarity index 73% rename from testdata/project-v4-multigroup-with-deploy-image/config/samples/foo.policy_v1_healthcheckpolicy.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/samples/foo.policy_v1_healthcheckpolicy.yaml index 5fc59688452..449f8901de0 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/samples/foo.policy_v1_healthcheckpolicy.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/foo.policy_v1_healthcheckpolicy.yaml @@ -2,7 +2,7 @@ apiVersion: foo.policy.testproject.org/v1 kind: HealthCheckPolicy metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: healthcheckpolicy-sample spec: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/samples/foo_v1_bar.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/foo_v1_bar.yaml similarity index 69% rename from testdata/project-v4-multigroup-with-deploy-image/config/samples/foo_v1_bar.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/samples/foo_v1_bar.yaml index c9fc87fdb34..051af278278 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/samples/foo_v1_bar.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/foo_v1_bar.yaml @@ -2,7 +2,7 @@ apiVersion: foo.testproject.org/v1 kind: Bar metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: bar-sample spec: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/samples/kustomization.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/kustomization.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/samples/kustomization.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/samples/kustomization.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/samples/sea-creatures_v1beta1_kraken.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/sea-creatures_v1beta1_kraken.yaml similarity index 72% rename from testdata/project-v4-multigroup-with-deploy-image/config/samples/sea-creatures_v1beta1_kraken.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/samples/sea-creatures_v1beta1_kraken.yaml index 962a8694f99..6b981ba8cf4 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/samples/sea-creatures_v1beta1_kraken.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/sea-creatures_v1beta1_kraken.yaml @@ -2,7 +2,7 @@ apiVersion: sea-creatures.testproject.org/v1beta1 kind: Kraken metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: kraken-sample spec: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/samples/sea-creatures_v1beta2_leviathan.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/sea-creatures_v1beta2_leviathan.yaml similarity index 72% rename from testdata/project-v4-multigroup-with-deploy-image/config/samples/sea-creatures_v1beta2_leviathan.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/samples/sea-creatures_v1beta2_leviathan.yaml index 9f81f626ca4..23598d1f98e 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/samples/sea-creatures_v1beta2_leviathan.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/sea-creatures_v1beta2_leviathan.yaml @@ -2,7 +2,7 @@ apiVersion: sea-creatures.testproject.org/v1beta2 kind: Leviathan metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: leviathan-sample spec: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/samples/ship_v1_destroyer.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/ship_v1_destroyer.yaml similarity index 71% rename from testdata/project-v4-multigroup-with-deploy-image/config/samples/ship_v1_destroyer.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/samples/ship_v1_destroyer.yaml index d3e31a73a65..12ce57656a7 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/samples/ship_v1_destroyer.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/ship_v1_destroyer.yaml @@ -2,7 +2,7 @@ apiVersion: ship.testproject.org/v1 kind: Destroyer metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: destroyer-sample spec: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/samples/ship_v1beta1_frigate.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/ship_v1beta1_frigate.yaml similarity index 71% rename from testdata/project-v4-multigroup-with-deploy-image/config/samples/ship_v1beta1_frigate.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/samples/ship_v1beta1_frigate.yaml index 71166a0cf15..f9035c548a8 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/samples/ship_v1beta1_frigate.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/ship_v1beta1_frigate.yaml @@ -2,7 +2,7 @@ apiVersion: ship.testproject.org/v1beta1 kind: Frigate metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: frigate-sample spec: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/samples/ship_v2alpha1_cruiser.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/ship_v2alpha1_cruiser.yaml similarity index 71% rename from testdata/project-v4-multigroup-with-deploy-image/config/samples/ship_v2alpha1_cruiser.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/samples/ship_v2alpha1_cruiser.yaml index e6872d9f31a..e0f93f4a484 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/samples/ship_v2alpha1_cruiser.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/ship_v2alpha1_cruiser.yaml @@ -2,7 +2,7 @@ apiVersion: ship.testproject.org/v2alpha1 kind: Cruiser metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: cruiser-sample spec: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/samples/v1_lakers.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/v1_lakers.yaml similarity index 70% rename from testdata/project-v4-multigroup-with-deploy-image/config/samples/v1_lakers.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/samples/v1_lakers.yaml index 134b5aafa57..bfbcb14b9a6 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/config/samples/v1_lakers.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/samples/v1_lakers.yaml @@ -2,7 +2,7 @@ apiVersion: testproject.org/v1 kind: Lakers metadata: labels: - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: lakers-sample spec: diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/webhook/kustomization.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/webhook/kustomization.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/webhook/kustomization.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/webhook/kustomization.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/webhook/kustomizeconfig.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/webhook/kustomizeconfig.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/webhook/kustomizeconfig.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/webhook/kustomizeconfig.yaml diff --git a/testdata/project-v4-multigroup-with-deploy-image/config/webhook/manifests.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/webhook/manifests.yaml similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/config/webhook/manifests.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/webhook/manifests.yaml diff --git a/testdata/project-v4-multigroup/config/webhook/service.yaml b/testdata/project-v4-multigroup-with-optional-plugins/config/webhook/service.yaml similarity index 78% rename from testdata/project-v4-multigroup/config/webhook/service.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/config/webhook/service.yaml index 0ba1f669758..2c328134139 100644 --- a/testdata/project-v4-multigroup/config/webhook/service.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/config/webhook/service.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: labels: - app.kubernetes.io/name: project-v4-multigroup + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins app.kubernetes.io/managed-by: kustomize name: webhook-service namespace: system diff --git a/testdata/project-v4-multigroup-with-deploy-image/dist/install.yaml b/testdata/project-v4-multigroup-with-optional-plugins/dist/install.yaml similarity index 83% rename from testdata/project-v4-multigroup-with-deploy-image/dist/install.yaml rename to testdata/project-v4-multigroup-with-optional-plugins/dist/install.yaml index 3ded802d61f..39363f0e636 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/dist/install.yaml +++ b/testdata/project-v4-multigroup-with-optional-plugins/dist/install.yaml @@ -3,9 +3,9 @@ kind: Namespace metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins control-plane: controller-manager - name: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-system --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -127,8 +127,8 @@ spec: webhook: clientConfig: service: - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system path: /convert conversionReviewVersions: - v1 @@ -191,8 +191,8 @@ spec: webhook: clientConfig: service: - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system path: /convert conversionReviewVersions: - v1 @@ -255,8 +255,8 @@ spec: webhook: clientConfig: service: - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system path: /convert conversionReviewVersions: - v1 @@ -319,8 +319,8 @@ spec: webhook: clientConfig: service: - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system path: /convert conversionReviewVersions: - v1 @@ -491,8 +491,8 @@ spec: webhook: clientConfig: service: - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system path: /convert conversionReviewVersions: - v1 @@ -602,18 +602,18 @@ kind: ServiceAccount metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-controller-manager - namespace: project-v4-multigroup-with-deploy-image-system + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-controller-manager + namespace: project-v4-multigroup-with-optional-plugins-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-leader-election-role - namespace: project-v4-multigroup-with-deploy-image-system + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-leader-election-role + namespace: project-v4-multigroup-with-optional-plugins-system rules: - apiGroups: - "" @@ -652,8 +652,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-crew-captain-editor-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-crew-captain-editor-role rules: - apiGroups: - crew.testproject.org @@ -679,8 +679,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-crew-captain-viewer-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-crew-captain-viewer-role rules: - apiGroups: - crew.testproject.org @@ -702,8 +702,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-fiz-bar-editor-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-fiz-bar-editor-role rules: - apiGroups: - fiz.testproject.org @@ -729,8 +729,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-fiz-bar-viewer-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-fiz-bar-viewer-role rules: - apiGroups: - fiz.testproject.org @@ -752,8 +752,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-foo-bar-editor-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-foo-bar-editor-role rules: - apiGroups: - foo.testproject.org @@ -779,8 +779,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-foo-bar-viewer-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-foo-bar-viewer-role rules: - apiGroups: - foo.testproject.org @@ -802,8 +802,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-foo.policy-healthcheckpolicy-editor-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-foo.policy-healthcheckpolicy-editor-role rules: - apiGroups: - foo.policy.testproject.org @@ -829,8 +829,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-foo.policy-healthcheckpolicy-viewer-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-foo.policy-healthcheckpolicy-viewer-role rules: - apiGroups: - foo.policy.testproject.org @@ -852,8 +852,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-lakers-editor-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-lakers-editor-role rules: - apiGroups: - testproject.org @@ -879,8 +879,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-lakers-viewer-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-lakers-viewer-role rules: - apiGroups: - testproject.org @@ -900,7 +900,7 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: project-v4-multigroup-with-deploy-image-manager-role + name: project-v4-multigroup-with-optional-plugins-manager-role rules: - apiGroups: - apps @@ -1100,7 +1100,7 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: project-v4-multigroup-with-deploy-image-metrics-auth-role + name: project-v4-multigroup-with-optional-plugins-metrics-auth-role rules: - apiGroups: - authentication.k8s.io @@ -1118,7 +1118,7 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: project-v4-multigroup-with-deploy-image-metrics-reader + name: project-v4-multigroup-with-optional-plugins-metrics-reader rules: - nonResourceURLs: - /metrics @@ -1130,8 +1130,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-sea-creatures-kraken-editor-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-sea-creatures-kraken-editor-role rules: - apiGroups: - sea-creatures.testproject.org @@ -1157,8 +1157,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-sea-creatures-kraken-viewer-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-sea-creatures-kraken-viewer-role rules: - apiGroups: - sea-creatures.testproject.org @@ -1180,8 +1180,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-sea-creatures-leviathan-editor-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-sea-creatures-leviathan-editor-role rules: - apiGroups: - sea-creatures.testproject.org @@ -1207,8 +1207,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-sea-creatures-leviathan-viewer-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-sea-creatures-leviathan-viewer-role rules: - apiGroups: - sea-creatures.testproject.org @@ -1230,8 +1230,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-ship-cruiser-editor-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-ship-cruiser-editor-role rules: - apiGroups: - ship.testproject.org @@ -1257,8 +1257,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-ship-cruiser-viewer-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-ship-cruiser-viewer-role rules: - apiGroups: - ship.testproject.org @@ -1280,8 +1280,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-ship-destroyer-editor-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-ship-destroyer-editor-role rules: - apiGroups: - ship.testproject.org @@ -1307,8 +1307,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-ship-destroyer-viewer-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-ship-destroyer-viewer-role rules: - apiGroups: - ship.testproject.org @@ -1330,8 +1330,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-ship-frigate-editor-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-ship-frigate-editor-role rules: - apiGroups: - ship.testproject.org @@ -1357,8 +1357,8 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-ship-frigate-viewer-role + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-ship-frigate-viewer-role rules: - apiGroups: - ship.testproject.org @@ -1380,56 +1380,56 @@ kind: RoleBinding metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-leader-election-rolebinding - namespace: project-v4-multigroup-with-deploy-image-system + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-leader-election-rolebinding + namespace: project-v4-multigroup-with-optional-plugins-system roleRef: apiGroup: rbac.authorization.k8s.io kind: Role - name: project-v4-multigroup-with-deploy-image-leader-election-role + name: project-v4-multigroup-with-optional-plugins-leader-election-role subjects: - kind: ServiceAccount - name: project-v4-multigroup-with-deploy-image-controller-manager - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-controller-manager + namespace: project-v4-multigroup-with-optional-plugins-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-manager-rolebinding + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-manager-rolebinding roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: project-v4-multigroup-with-deploy-image-manager-role + name: project-v4-multigroup-with-optional-plugins-manager-role subjects: - kind: ServiceAccount - name: project-v4-multigroup-with-deploy-image-controller-manager - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-controller-manager + namespace: project-v4-multigroup-with-optional-plugins-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: project-v4-multigroup-with-deploy-image-metrics-auth-rolebinding + name: project-v4-multigroup-with-optional-plugins-metrics-auth-rolebinding roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: project-v4-multigroup-with-deploy-image-metrics-auth-role + name: project-v4-multigroup-with-optional-plugins-metrics-auth-role subjects: - kind: ServiceAccount - name: project-v4-multigroup-with-deploy-image-controller-manager - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-controller-manager + namespace: project-v4-multigroup-with-optional-plugins-system --- apiVersion: v1 kind: Service metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins control-plane: controller-manager - name: project-v4-multigroup-with-deploy-image-controller-manager-metrics-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-controller-manager-metrics-service + namespace: project-v4-multigroup-with-optional-plugins-system spec: ports: - name: https @@ -1444,9 +1444,9 @@ kind: Service metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system spec: ports: - port: 443 @@ -1460,10 +1460,10 @@ kind: Deployment metadata: labels: app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup-with-deploy-image + app.kubernetes.io/name: project-v4-multigroup-with-optional-plugins control-plane: controller-manager - name: project-v4-multigroup-with-deploy-image-controller-manager - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-controller-manager + namespace: project-v4-multigroup-with-optional-plugins-system spec: replicas: 1 selector: @@ -1519,7 +1519,7 @@ spec: readOnly: true securityContext: runAsNonRoot: true - serviceAccountName: project-v4-multigroup-with-deploy-image-controller-manager + serviceAccountName: project-v4-multigroup-with-optional-plugins-controller-manager terminationGracePeriodSeconds: 10 volumes: - name: cert @@ -1530,14 +1530,14 @@ spec: apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: - name: project-v4-multigroup-with-deploy-image-mutating-webhook-configuration + name: project-v4-multigroup-with-optional-plugins-mutating-webhook-configuration webhooks: - admissionReviewVersions: - v1 clientConfig: service: - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system path: /mutate-crew-testproject-org-v1-captain failurePolicy: Fail name: mcaptain.kb.io @@ -1556,8 +1556,8 @@ webhooks: - v1 clientConfig: service: - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system path: /mutate-ship-testproject-org-v1-destroyer failurePolicy: Fail name: mdestroyer.kb.io @@ -1576,8 +1576,8 @@ webhooks: - v1 clientConfig: service: - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system path: /mutate-testproject-org-v1-lakers failurePolicy: Fail name: mlakers.kb.io @@ -1596,14 +1596,14 @@ webhooks: apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: - name: project-v4-multigroup-with-deploy-image-validating-webhook-configuration + name: project-v4-multigroup-with-optional-plugins-validating-webhook-configuration webhooks: - admissionReviewVersions: - v1 clientConfig: service: - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system path: /validate-crew-testproject-org-v1-captain failurePolicy: Fail name: vcaptain.kb.io @@ -1622,8 +1622,8 @@ webhooks: - v1 clientConfig: service: - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system path: /validate-ship-testproject-org-v2alpha1-cruiser failurePolicy: Fail name: vcruiser.kb.io @@ -1642,8 +1642,8 @@ webhooks: - v1 clientConfig: service: - name: project-v4-multigroup-with-deploy-image-webhook-service - namespace: project-v4-multigroup-with-deploy-image-system + name: project-v4-multigroup-with-optional-plugins-webhook-service + namespace: project-v4-multigroup-with-optional-plugins-system path: /validate-testproject-org-v1-lakers failurePolicy: Fail name: vlakers.kb.io diff --git a/testdata/project-v4-multigroup-with-deploy-image/go.mod b/testdata/project-v4-multigroup-with-optional-plugins/go.mod similarity index 99% rename from testdata/project-v4-multigroup-with-deploy-image/go.mod rename to testdata/project-v4-multigroup-with-optional-plugins/go.mod index 8a7e66e7e17..a1f17a45ff3 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/go.mod +++ b/testdata/project-v4-multigroup-with-optional-plugins/go.mod @@ -1,4 +1,4 @@ -module sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image +module sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins go 1.22.0 diff --git a/testdata/project-v4-multigroup-with-deploy-image/hack/boilerplate.go.txt b/testdata/project-v4-multigroup-with-optional-plugins/hack/boilerplate.go.txt similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/hack/boilerplate.go.txt rename to testdata/project-v4-multigroup-with-optional-plugins/hack/boilerplate.go.txt diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/apps/deployment_controller.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/apps/deployment_controller.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/apps/deployment_controller.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/apps/deployment_controller.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/apps/deployment_controller_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/apps/deployment_controller_test.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/apps/deployment_controller_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/apps/deployment_controller_test.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/apps/suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/apps/suite_test.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/apps/suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/apps/suite_test.go diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/crew/captain_controller.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/crew/captain_controller.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/crew/captain_controller.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/crew/captain_controller.go index d9bea97e751..f9a99a6121d 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/crew/captain_controller.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/crew/captain_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/crew/v1" + crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1" ) // CaptainReconciler reconciles a Captain object diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/crew/captain_controller_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/crew/captain_controller_test.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/crew/captain_controller_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/crew/captain_controller_test.go index b2be385dd91..d45b2f7c8c4 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/crew/captain_controller_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/crew/captain_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/crew/v1" + crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1" ) var _ = Describe("Captain Controller", func() { diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/crew/suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/crew/suite_test.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/crew/suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/crew/suite_test.go index 6278a1a114a..6d131635202 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/crew/suite_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/crew/suite_test.go @@ -33,7 +33,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/crew/v1" + crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/crew/v1" // +kubebuilder:scaffold:imports ) diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/fiz/bar_controller.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/fiz/bar_controller.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/fiz/bar_controller.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/fiz/bar_controller.go index a29f9b5ce27..1e50f6a4c7b 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/fiz/bar_controller.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/fiz/bar_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/fiz/v1" + fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/fiz/v1" ) // BarReconciler reconciles a Bar object diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/fiz/bar_controller_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/fiz/bar_controller_test.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/fiz/bar_controller_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/fiz/bar_controller_test.go index 2b9c388f1d5..3b3312a9ff7 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/fiz/bar_controller_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/fiz/bar_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/fiz/v1" + fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/fiz/v1" ) var _ = Describe("Bar Controller", func() { diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/fiz/suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/fiz/suite_test.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/fiz/suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/fiz/suite_test.go index 5545a274be6..a7714669fb2 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/fiz/suite_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/fiz/suite_test.go @@ -33,7 +33,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/fiz/v1" + fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/fiz/v1" // +kubebuilder:scaffold:imports ) diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo.policy/healthcheckpolicy_controller.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo.policy/healthcheckpolicy_controller.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo.policy/healthcheckpolicy_controller.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo.policy/healthcheckpolicy_controller.go index aeb22951253..899ab6dd75a 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo.policy/healthcheckpolicy_controller.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo.policy/healthcheckpolicy_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/foo.policy/v1" + foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/foo.policy/v1" ) // HealthCheckPolicyReconciler reconciles a HealthCheckPolicy object diff --git a/testdata/project-v4-multigroup/internal/controller/foo.policy/healthcheckpolicy_controller_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo.policy/healthcheckpolicy_controller_test.go similarity index 98% rename from testdata/project-v4-multigroup/internal/controller/foo.policy/healthcheckpolicy_controller_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo.policy/healthcheckpolicy_controller_test.go index 55de998a0a2..cfe44d513d9 100644 --- a/testdata/project-v4-multigroup/internal/controller/foo.policy/healthcheckpolicy_controller_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo.policy/healthcheckpolicy_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/foo.policy/v1" + foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/foo.policy/v1" ) var _ = Describe("HealthCheckPolicy Controller", func() { diff --git a/testdata/project-v4-multigroup/internal/controller/foo.policy/suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo.policy/suite_test.go similarity index 98% rename from testdata/project-v4-multigroup/internal/controller/foo.policy/suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo.policy/suite_test.go index a7a3cafc613..4e2182e5c50 100644 --- a/testdata/project-v4-multigroup/internal/controller/foo.policy/suite_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo.policy/suite_test.go @@ -33,7 +33,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/foo.policy/v1" + foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/foo.policy/v1" // +kubebuilder:scaffold:imports ) diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo/bar_controller.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo/bar_controller.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo/bar_controller.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo/bar_controller.go index 149973eab2f..3a66a4e78fe 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo/bar_controller.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo/bar_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/foo/v1" + foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/foo/v1" ) // BarReconciler reconciles a Bar object diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo/bar_controller_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo/bar_controller_test.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo/bar_controller_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo/bar_controller_test.go index c0bd76e8f26..ef2414e7bb8 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo/bar_controller_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo/bar_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/foo/v1" + foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/foo/v1" ) var _ = Describe("Bar Controller", func() { diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo/suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo/suite_test.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo/suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo/suite_test.go index 4e63dcf1b9d..4ba81579924 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/foo/suite_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/foo/suite_test.go @@ -33,7 +33,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/foo/v1" + foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/foo/v1" // +kubebuilder:scaffold:imports ) diff --git a/testdata/project-v4-multigroup/internal/controller/lakers_controller.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/lakers_controller.go similarity index 98% rename from testdata/project-v4-multigroup/internal/controller/lakers_controller.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/lakers_controller.go index d52562a3014..ed86ecf2662 100644 --- a/testdata/project-v4-multigroup/internal/controller/lakers_controller.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/lakers_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/v1" + testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/v1" ) // LakersReconciler reconciles a Lakers object diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/lakers_controller_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/lakers_controller_test.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/lakers_controller_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/lakers_controller_test.go index 55ddba24b09..a9c44cd919d 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/lakers_controller_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/lakers_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/v1" + testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/v1" ) var _ = Describe("Lakers Controller", func() { diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/kraken_controller.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/kraken_controller.go similarity index 97% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/kraken_controller.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/kraken_controller.go index 4df51119033..8e37e2e684c 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/kraken_controller.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/kraken_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta1" + seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta1" ) // KrakenReconciler reconciles a Kraken object diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/kraken_controller_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/kraken_controller_test.go similarity index 97% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/kraken_controller_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/kraken_controller_test.go index 531252dca2b..63fc608896c 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/kraken_controller_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/kraken_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta1" + seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta1" ) var _ = Describe("Kraken Controller", func() { diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/leviathan_controller.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/leviathan_controller.go similarity index 97% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/leviathan_controller.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/leviathan_controller.go index ef6b284961f..ef182faaa2b 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/leviathan_controller.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/leviathan_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta2" + seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta2" ) // LeviathanReconciler reconciles a Leviathan object diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/leviathan_controller_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/leviathan_controller_test.go similarity index 97% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/leviathan_controller_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/leviathan_controller_test.go index 9c0a6d79d87..df488511657 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/leviathan_controller_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/leviathan_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta2" + seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta2" ) var _ = Describe("Leviathan Controller", func() { diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/suite_test.go similarity index 96% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/suite_test.go index 8de94de7707..2d4b7c950a9 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/sea-creatures/suite_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/sea-creatures/suite_test.go @@ -33,8 +33,8 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta1" - seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/sea-creatures/v1beta2" + seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta1" + seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/sea-creatures/v1beta2" // +kubebuilder:scaffold:imports ) diff --git a/testdata/project-v4-multigroup/internal/controller/ship/cruiser_controller.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/cruiser_controller.go similarity index 97% rename from testdata/project-v4-multigroup/internal/controller/ship/cruiser_controller.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/cruiser_controller.go index 161c3e3358b..a10b27706a5 100644 --- a/testdata/project-v4-multigroup/internal/controller/ship/cruiser_controller.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/cruiser_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v2alpha1" + shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1" ) // CruiserReconciler reconciles a Cruiser object diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/cruiser_controller_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/cruiser_controller_test.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/cruiser_controller_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/cruiser_controller_test.go index 6c008717e68..8933796a3ef 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/cruiser_controller_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/cruiser_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1" + shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1" ) var _ = Describe("Cruiser Controller", func() { diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/destroyer_controller.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/destroyer_controller.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/destroyer_controller.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/destroyer_controller.go index 06102652693..9243894fb09 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/destroyer_controller.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/destroyer_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1" + shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1" ) // DestroyerReconciler reconciles a Destroyer object diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/destroyer_controller_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/destroyer_controller_test.go similarity index 98% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/destroyer_controller_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/destroyer_controller_test.go index fff4e22fc60..21a77cf6570 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/destroyer_controller_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/destroyer_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1" + shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1" ) var _ = Describe("Destroyer Controller", func() { diff --git a/testdata/project-v4-multigroup/internal/controller/ship/frigate_controller.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/frigate_controller.go similarity index 97% rename from testdata/project-v4-multigroup/internal/controller/ship/frigate_controller.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/frigate_controller.go index 120c374d4e2..7016a85020f 100644 --- a/testdata/project-v4-multigroup/internal/controller/ship/frigate_controller.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/frigate_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v1beta1" + shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1" ) // FrigateReconciler reconciles a Frigate object diff --git a/testdata/project-v4-multigroup/internal/controller/ship/frigate_controller_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/frigate_controller_test.go similarity index 98% rename from testdata/project-v4-multigroup/internal/controller/ship/frigate_controller_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/frigate_controller_test.go index f36a8679754..de8d95aea7a 100644 --- a/testdata/project-v4-multigroup/internal/controller/ship/frigate_controller_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/frigate_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v1beta1" + shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1" ) var _ = Describe("Frigate Controller", func() { diff --git a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/suite_test.go similarity index 96% rename from testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/suite_test.go index 9192c6ee3cd..9e8d4c5998e 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/internal/controller/ship/suite_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/ship/suite_test.go @@ -33,9 +33,9 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1" - shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1" - shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1" + shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1" + shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v1beta1" + shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/ship/v2alpha1" // +kubebuilder:scaffold:imports ) diff --git a/testdata/project-v4-multigroup/internal/controller/suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/suite_test.go similarity index 98% rename from testdata/project-v4-multigroup/internal/controller/suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/internal/controller/suite_test.go index 5dc7c07a170..e542ac34c0f 100644 --- a/testdata/project-v4-multigroup/internal/controller/suite_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/internal/controller/suite_test.go @@ -33,7 +33,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/v1" + testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/api/v1" // +kubebuilder:scaffold:imports ) diff --git a/testdata/project-v4-multigroup-with-deploy-image/test/e2e/e2e_suite_test.go b/testdata/project-v4-multigroup-with-optional-plugins/test/e2e/e2e_suite_test.go similarity index 95% rename from testdata/project-v4-multigroup-with-deploy-image/test/e2e/e2e_suite_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/test/e2e/e2e_suite_test.go index ae4e19086c6..fd4061e72a9 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/test/e2e/e2e_suite_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/test/e2e/e2e_suite_test.go @@ -25,7 +25,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/test/utils" + "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/test/utils" ) var ( @@ -43,7 +43,7 @@ var ( // projectImage is the name of the image which will be build and loaded // with the code source changes to be tested. - projectImage = "example.com/project-v4-multigroup-with-deploy-image:v0.0.1" + projectImage = "example.com/project-v4-multigroup-with-optional-plugins:v0.0.1" ) // TestE2E runs the end-to-end (e2e) test suite for the project. These tests execute in an isolated, @@ -52,7 +52,7 @@ var ( // CertManager and Prometheus. func TestE2E(t *testing.T) { RegisterFailHandler(Fail) - _, _ = fmt.Fprintf(GinkgoWriter, "Starting project-v4-multigroup-with-deploy-image integration test suite\n") + _, _ = fmt.Fprintf(GinkgoWriter, "Starting project-v4-multigroup-with-optional-plugins integration test suite\n") RunSpecs(t, "e2e suite") } diff --git a/testdata/project-v4-multigroup-with-deploy-image/test/e2e/e2e_test.go b/testdata/project-v4-multigroup-with-optional-plugins/test/e2e/e2e_test.go similarity index 96% rename from testdata/project-v4-multigroup-with-deploy-image/test/e2e/e2e_test.go rename to testdata/project-v4-multigroup-with-optional-plugins/test/e2e/e2e_test.go index fe3a6e4d75d..ef601e870af 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/test/e2e/e2e_test.go +++ b/testdata/project-v4-multigroup-with-optional-plugins/test/e2e/e2e_test.go @@ -24,10 +24,10 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image/test/utils" + "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-optional-plugins/test/utils" ) -const namespace = "project-v4-multigroup-with-deploy-image-system" +const namespace = "project-v4-multigroup-with-optional-plugins-system" // Define a set of end-to-end (e2e) tests to validate the behavior of the controller. var _ = Describe("controller", Ordered, func() { diff --git a/testdata/project-v4-multigroup-with-deploy-image/test/utils/utils.go b/testdata/project-v4-multigroup-with-optional-plugins/test/utils/utils.go similarity index 100% rename from testdata/project-v4-multigroup-with-deploy-image/test/utils/utils.go rename to testdata/project-v4-multigroup-with-optional-plugins/test/utils/utils.go diff --git a/testdata/project-v4-multigroup/.devcontainer/devcontainer.json b/testdata/project-v4-multigroup/.devcontainer/devcontainer.json deleted file mode 100644 index e2cdc09c96c..00000000000 --- a/testdata/project-v4-multigroup/.devcontainer/devcontainer.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "Kubebuilder DevContainer", - "image": "golang:1.22", - "features": { - "ghcr.io/devcontainers/features/docker-in-docker:2": {}, - "ghcr.io/devcontainers/features/git:1": {} - }, - - "runArgs": ["--network=host"], - - "customizations": { - "vscode": { - "settings": { - "terminal.integrated.shell.linux": "/bin/bash" - }, - "extensions": [ - "ms-kubernetes-tools.vscode-kubernetes-tools", - "ms-azuretools.vscode-docker" - ] - } - }, - - "onCreateCommand": "bash .devcontainer/post-install.sh" -} - diff --git a/testdata/project-v4-multigroup/.devcontainer/post-install.sh b/testdata/project-v4-multigroup/.devcontainer/post-install.sh deleted file mode 100644 index 265c43ee8d3..00000000000 --- a/testdata/project-v4-multigroup/.devcontainer/post-install.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -x - -curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 -chmod +x ./kind -mv ./kind /usr/local/bin/kind - -curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/linux/amd64 -chmod +x kubebuilder -mv kubebuilder /usr/local/bin/ - -KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt) -curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl" -chmod +x kubectl -mv kubectl /usr/local/bin/kubectl - -docker network create -d=bridge --subnet=172.19.0.0/24 kind - -kind version -kubebuilder version -docker --version -go version -kubectl version --client diff --git a/testdata/project-v4-multigroup/.dockerignore b/testdata/project-v4-multigroup/.dockerignore deleted file mode 100644 index a3aab7af70c..00000000000 --- a/testdata/project-v4-multigroup/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file -# Ignore build and test binaries. -bin/ diff --git a/testdata/project-v4-multigroup/.gitignore b/testdata/project-v4-multigroup/.gitignore deleted file mode 100644 index ada68ff086c..00000000000 --- a/testdata/project-v4-multigroup/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib -bin/* -Dockerfile.cross - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Go workspace file -go.work - -# Kubernetes Generated files - skip generated files, except for vendored files -!vendor/**/zz_generated.* - -# editor and IDE paraphernalia -.idea -.vscode -*.swp -*.swo -*~ diff --git a/testdata/project-v4-multigroup/.golangci.yml b/testdata/project-v4-multigroup/.golangci.yml deleted file mode 100644 index aac8a13f928..00000000000 --- a/testdata/project-v4-multigroup/.golangci.yml +++ /dev/null @@ -1,47 +0,0 @@ -run: - timeout: 5m - allow-parallel-runners: true - -issues: - # don't skip warning about doc comments - # don't exclude the default set of lint - exclude-use-default: false - # restore some of the defaults - # (fill in the rest as needed) - exclude-rules: - - path: "api/*" - linters: - - lll - - path: "internal/*" - linters: - - dupl - - lll -linters: - disable-all: true - enable: - - dupl - - errcheck - - exportloopref - - ginkgolinter - - goconst - - gocyclo - - gofmt - - goimports - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - prealloc - - revive - - staticcheck - - typecheck - - unconvert - - unparam - - unused - -linters-settings: - revive: - rules: - - name: comment-spacings diff --git a/testdata/project-v4-multigroup/Dockerfile b/testdata/project-v4-multigroup/Dockerfile deleted file mode 100644 index a48973ee7f3..00000000000 --- a/testdata/project-v4-multigroup/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# Build the manager binary -FROM golang:1.22 AS builder -ARG TARGETOS -ARG TARGETARCH - -WORKDIR /workspace -# Copy the Go Modules manifests -COPY go.mod go.mod -COPY go.sum go.sum -# cache deps before building and copying source so that we don't need to re-download as much -# and so that source changes don't invalidate our downloaded layer -RUN go mod download - -# Copy the go source -COPY cmd/main.go cmd/main.go -COPY api/ api/ -COPY internal/controller/ internal/controller/ - -# Build -# the GOARCH has not a default value to allow the binary be built according to the host where the command -# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO -# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, -# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. -RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go - -# Use distroless as minimal base image to package the manager binary -# Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot -WORKDIR / -COPY --from=builder /workspace/manager . -USER 65532:65532 - -ENTRYPOINT ["/manager"] diff --git a/testdata/project-v4-multigroup/Makefile b/testdata/project-v4-multigroup/Makefile deleted file mode 100644 index be8efe91823..00000000000 --- a/testdata/project-v4-multigroup/Makefile +++ /dev/null @@ -1,212 +0,0 @@ -# Image URL to use all building/pushing image targets -IMG ?= controller:latest -# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. -ENVTEST_K8S_VERSION = 1.31.0 - -# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) -ifeq (,$(shell go env GOBIN)) -GOBIN=$(shell go env GOPATH)/bin -else -GOBIN=$(shell go env GOBIN) -endif - -# CONTAINER_TOOL defines the container tool to be used for building images. -# Be aware that the target commands are only tested with Docker which is -# scaffolded by default. However, you might want to replace it to use other -# tools. (i.e. podman) -CONTAINER_TOOL ?= docker - -# Setting SHELL to bash allows bash commands to be executed by recipes. -# Options are set to exit when a recipe line exits non-zero or a piped command fails. -SHELL = /usr/bin/env bash -o pipefail -.SHELLFLAGS = -ec - -.PHONY: all -all: build - -##@ General - -# The help target prints out all targets with their descriptions organized -# beneath their categories. The categories are represented by '##@' and the -# target descriptions by '##'. The awk command is responsible for reading the -# entire set of makefiles included in this invocation, looking for lines of the -# file as xyz: ## something, and then pretty-format the target and help. Then, -# if there's a line with ##@ something, that gets pretty-printed as a category. -# More info on the usage of ANSI control characters for terminal formatting: -# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters -# More info on the awk command: -# http://linuxcommand.org/lc3_adv_awk.php - -.PHONY: help -help: ## Display this help. - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) - -##@ Development - -.PHONY: manifests -manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. - $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases - -.PHONY: generate -generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. - $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." - -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - -.PHONY: test -test: manifests generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out - -# TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'. -# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally. -# Prometheus and CertManager are installed by default; skip with: -# - PROMETHEUS_INSTALL_SKIP=true -# - CERT_MANAGER_INSTALL_SKIP=true -.PHONY: test-e2e -test-e2e: ## Run the e2e tests. Expected an isolated environment using Kind. - @command -v kind >/dev/null 2>&1 || { \ - echo "Kind is not installed. Please install Kind manually."; \ - exit 1; \ - } - @kind get clusters | grep -q 'kind' || { \ - echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \ - exit 1; \ - } - go test ./test/e2e/ -v -ginkgo.v - -.PHONY: lint -lint: golangci-lint ## Run golangci-lint linter - $(GOLANGCI_LINT) run - -.PHONY: lint-fix -lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes - $(GOLANGCI_LINT) run --fix - -##@ Build - -.PHONY: build -build: manifests generate fmt vet ## Build manager binary. - go build -o bin/manager cmd/main.go - -.PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. - go run ./cmd/main.go - -# If you wish to build the manager image targeting other platforms you can use the --platform flag. -# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it. -# More info: https://docs.docker.com/develop/develop-images/build_enhancements/ -.PHONY: docker-build -docker-build: ## Build docker image with the manager. - $(CONTAINER_TOOL) build -t ${IMG} . - -.PHONY: docker-push -docker-push: ## Push docker image with the manager. - $(CONTAINER_TOOL) push ${IMG} - -# PLATFORMS defines the target platforms for the manager image be built to provide support to multiple -# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to: -# - be able to use docker buildx. More info: https://docs.docker.com/build/buildx/ -# - have enabled BuildKit. More info: https://docs.docker.com/develop/develop-images/build_enhancements/ -# - be able to push the image to your registry (i.e. if you do not set a valid value via IMG=> then the export will fail) -# To adequately provide solutions that are compatible with multiple platforms, you should consider using this option. -PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le -.PHONY: docker-buildx -docker-buildx: ## Build and push docker image for the manager for cross-platform support - # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile - sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross - - $(CONTAINER_TOOL) buildx create --name project-v4-multigroup-builder - $(CONTAINER_TOOL) buildx use project-v4-multigroup-builder - - $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . - - $(CONTAINER_TOOL) buildx rm project-v4-multigroup-builder - rm Dockerfile.cross - -.PHONY: build-installer -build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment. - mkdir -p dist - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/default > dist/install.yaml - -##@ Deployment - -ifndef ignore-not-found - ignore-not-found = false -endif - -.PHONY: install -install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. - $(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f - - -.PHONY: uninstall -uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f - - -.PHONY: deploy -deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/default | $(KUBECTL) apply -f - - -.PHONY: undeploy -undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f - - -##@ Dependencies - -## Location to install dependencies to -LOCALBIN ?= $(shell pwd)/bin -$(LOCALBIN): - mkdir -p $(LOCALBIN) - -## Tool Binaries -KUBECTL ?= kubectl -KUSTOMIZE ?= $(LOCALBIN)/kustomize -CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen -ENVTEST ?= $(LOCALBIN)/setup-envtest -GOLANGCI_LINT = $(LOCALBIN)/golangci-lint - -## Tool Versions -KUSTOMIZE_VERSION ?= v5.4.3 -CONTROLLER_TOOLS_VERSION ?= v0.16.1 -ENVTEST_VERSION ?= release-0.19 -GOLANGCI_LINT_VERSION ?= v1.59.1 - -.PHONY: kustomize -kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. -$(KUSTOMIZE): $(LOCALBIN) - $(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION)) - -.PHONY: controller-gen -controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. -$(CONTROLLER_GEN): $(LOCALBIN) - $(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION)) - -.PHONY: envtest -envtest: $(ENVTEST) ## Download setup-envtest locally if necessary. -$(ENVTEST): $(LOCALBIN) - $(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION)) - -.PHONY: golangci-lint -golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. -$(GOLANGCI_LINT): $(LOCALBIN) - $(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION)) - -# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist -# $1 - target path with name of binary -# $2 - package url which can be installed -# $3 - specific version of package -define go-install-tool -@[ -f "$(1)-$(3)" ] || { \ -set -e; \ -package=$(2)@$(3) ;\ -echo "Downloading $${package}" ;\ -rm -f $(1) || true ;\ -GOBIN=$(LOCALBIN) go install $${package} ;\ -mv $(1) $(1)-$(3) ;\ -} ;\ -ln -sf $(1)-$(3) $(1) -endef diff --git a/testdata/project-v4-multigroup/PROJECT b/testdata/project-v4-multigroup/PROJECT deleted file mode 100644 index 92f8bcfd7a5..00000000000 --- a/testdata/project-v4-multigroup/PROJECT +++ /dev/null @@ -1,121 +0,0 @@ -# Code generated by tool. DO NOT EDIT. -# This file is used to track the info used to scaffold your project -# and allow the plugins properly work. -# More info: https://book.kubebuilder.io/reference/project-config.html -domain: testproject.org -layout: -- go.kubebuilder.io/v4 -multigroup: true -projectName: project-v4-multigroup -repo: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup -resources: -- api: - crdVersion: v1 - namespaced: true - controller: true - domain: testproject.org - group: crew - kind: Captain - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/crew/v1 - version: v1 - webhooks: - defaulting: true - validation: true - webhookVersion: v1 -- api: - crdVersion: v1 - namespaced: true - controller: true - domain: testproject.org - group: ship - kind: Frigate - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v1beta1 - version: v1beta1 - webhooks: - conversion: true - webhookVersion: v1 -- api: - crdVersion: v1 - controller: true - domain: testproject.org - group: ship - kind: Destroyer - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v1 - version: v1 - webhooks: - defaulting: true - webhookVersion: v1 -- api: - crdVersion: v1 - controller: true - domain: testproject.org - group: ship - kind: Cruiser - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v2alpha1 - version: v2alpha1 - webhooks: - validation: true - webhookVersion: v1 -- api: - crdVersion: v1 - namespaced: true - controller: true - domain: testproject.org - group: sea-creatures - kind: Kraken - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/sea-creatures/v1beta1 - version: v1beta1 -- api: - crdVersion: v1 - namespaced: true - controller: true - domain: testproject.org - group: sea-creatures - kind: Leviathan - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/sea-creatures/v1beta2 - version: v1beta2 -- api: - crdVersion: v1 - namespaced: true - controller: true - domain: testproject.org - group: foo.policy - kind: HealthCheckPolicy - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/foo.policy/v1 - version: v1 -- controller: true - group: apps - kind: Deployment - path: k8s.io/api/apps/v1 - version: v1 -- api: - crdVersion: v1 - namespaced: true - controller: true - domain: testproject.org - group: foo - kind: Bar - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/foo/v1 - version: v1 -- api: - crdVersion: v1 - namespaced: true - controller: true - domain: testproject.org - group: fiz - kind: Bar - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/fiz/v1 - version: v1 -- api: - crdVersion: v1 - namespaced: true - controller: true - domain: testproject.org - kind: Lakers - path: sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/v1 - version: v1 - webhooks: - defaulting: true - validation: true - webhookVersion: v1 -version: "3" diff --git a/testdata/project-v4-multigroup/README.md b/testdata/project-v4-multigroup/README.md deleted file mode 100644 index be36750a352..00000000000 --- a/testdata/project-v4-multigroup/README.md +++ /dev/null @@ -1,114 +0,0 @@ -# project-v4-multigroup -// TODO(user): Add simple overview of use/purpose - -## Description -// TODO(user): An in-depth paragraph about your project and overview of use - -## Getting Started - -### Prerequisites -- go version v1.22.0+ -- docker version 17.03+. -- kubectl version v1.11.3+. -- Access to a Kubernetes v1.11.3+ cluster. - -### To Deploy on the cluster -**Build and push your image to the location specified by `IMG`:** - -```sh -make docker-build docker-push IMG=/project-v4-multigroup:tag -``` - -**NOTE:** This image ought to be published in the personal registry you specified. -And it is required to have access to pull the image from the working environment. -Make sure you have the proper permission to the registry if the above commands don’t work. - -**Install the CRDs into the cluster:** - -```sh -make install -``` - -**Deploy the Manager to the cluster with the image specified by `IMG`:** - -```sh -make deploy IMG=/project-v4-multigroup:tag -``` - -> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin -privileges or be logged in as admin. - -**Create instances of your solution** -You can apply the samples (examples) from the config/sample: - -```sh -kubectl apply -k config/samples/ -``` - ->**NOTE**: Ensure that the samples has default values to test it out. - -### To Uninstall -**Delete the instances (CRs) from the cluster:** - -```sh -kubectl delete -k config/samples/ -``` - -**Delete the APIs(CRDs) from the cluster:** - -```sh -make uninstall -``` - -**UnDeploy the controller from the cluster:** - -```sh -make undeploy -``` - -## Project Distribution - -Following are the steps to build the installer and distribute this project to users. - -1. Build the installer for the image built and published in the registry: - -```sh -make build-installer IMG=/project-v4-multigroup:tag -``` - -NOTE: The makefile target mentioned above generates an 'install.yaml' -file in the dist directory. This file contains all the resources built -with Kustomize, which are necessary to install this project without -its dependencies. - -2. Using the installer - -Users can just run kubectl apply -f to install the project, i.e.: - -```sh -kubectl apply -f https://raw.githubusercontent.com//project-v4-multigroup//dist/install.yaml -``` - -## Contributing -// TODO(user): Add detailed information on how you would like others to contribute to this project - -**NOTE:** Run `make help` for more information on all potential `make` targets - -More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html) - -## License - -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - diff --git a/testdata/project-v4-multigroup/api/crew/v1/captain_types.go b/testdata/project-v4-multigroup/api/crew/v1/captain_types.go deleted file mode 100644 index 7858660467d..00000000000 --- a/testdata/project-v4-multigroup/api/crew/v1/captain_types.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// CaptainSpec defines the desired state of Captain -type CaptainSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Foo is an example field of Captain. Edit captain_types.go to remove/update - Foo string `json:"foo,omitempty"` -} - -// CaptainStatus defines the observed state of Captain -type CaptainStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status - -// Captain is the Schema for the captains API -type Captain struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec CaptainSpec `json:"spec,omitempty"` - Status CaptainStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// CaptainList contains a list of Captain -type CaptainList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Captain `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Captain{}, &CaptainList{}) -} diff --git a/testdata/project-v4-multigroup/api/crew/v1/captain_webhook.go b/testdata/project-v4-multigroup/api/crew/v1/captain_webhook.go deleted file mode 100644 index 1f2b38e1809..00000000000 --- a/testdata/project-v4-multigroup/api/crew/v1/captain_webhook.go +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" - "sigs.k8s.io/controller-runtime/pkg/webhook/admission" -) - -// nolint:unused -// log is for logging in this package. -var captainlog = logf.Log.WithName("captain-resource") - -// SetupWebhookWithManager will setup the manager to manage the webhooks -func (r *Captain) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} - -// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! - -// +kubebuilder:webhook:path=/mutate-crew-testproject-org-v1-captain,mutating=true,failurePolicy=fail,sideEffects=None,groups=crew.testproject.org,resources=captains,verbs=create;update,versions=v1,name=mcaptain.kb.io,admissionReviewVersions=v1 - -var _ webhook.Defaulter = &Captain{} - -// Default implements webhook.Defaulter so a webhook will be registered for the type -func (r *Captain) Default() { - captainlog.Info("default", "name", r.Name) - - // TODO(user): fill in your defaulting logic. -} - -// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation. -// NOTE: The 'path' attribute must follow a specific pattern and should not be modified directly here. -// Modifying the path for an invalid path can cause API server errors; failing to locate the webhook. -// +kubebuilder:webhook:path=/validate-crew-testproject-org-v1-captain,mutating=false,failurePolicy=fail,sideEffects=None,groups=crew.testproject.org,resources=captains,verbs=create;update,versions=v1,name=vcaptain.kb.io,admissionReviewVersions=v1 - -var _ webhook.Validator = &Captain{} - -// ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *Captain) ValidateCreate() (admission.Warnings, error) { - captainlog.Info("validate create", "name", r.Name) - - // TODO(user): fill in your validation logic upon object creation. - return nil, nil -} - -// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *Captain) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { - captainlog.Info("validate update", "name", r.Name) - - // TODO(user): fill in your validation logic upon object update. - return nil, nil -} - -// ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *Captain) ValidateDelete() (admission.Warnings, error) { - captainlog.Info("validate delete", "name", r.Name) - - // TODO(user): fill in your validation logic upon object deletion. - return nil, nil -} diff --git a/testdata/project-v4-multigroup/api/crew/v1/captain_webhook_test.go b/testdata/project-v4-multigroup/api/crew/v1/captain_webhook_test.go deleted file mode 100644 index 3b286582166..00000000000 --- a/testdata/project-v4-multigroup/api/crew/v1/captain_webhook_test.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - . "github.com/onsi/ginkgo/v2" -) - -var _ = Describe("Captain Webhook", func() { - - Context("When creating Captain under Defaulting Webhook", func() { - It("Should fill in the default value if a required field is empty", func() { - - // TODO(user): Add your logic here - - }) - }) - - Context("When creating Captain under Validating Webhook", func() { - It("Should deny if a required field is empty", func() { - - // TODO(user): Add your logic here - - }) - - It("Should admit if all required fields are provided", func() { - - // TODO(user): Add your logic here - - }) - }) - -}) diff --git a/testdata/project-v4-multigroup/api/crew/v1/groupversion_info.go b/testdata/project-v4-multigroup/api/crew/v1/groupversion_info.go deleted file mode 100644 index b2b4c7e7335..00000000000 --- a/testdata/project-v4-multigroup/api/crew/v1/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1 contains API Schema definitions for the crew v1 API group -// +kubebuilder:object:generate=true -// +groupName=crew.testproject.org -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "crew.testproject.org", Version: "v1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/testdata/project-v4-multigroup/api/crew/v1/webhook_suite_test.go b/testdata/project-v4-multigroup/api/crew/v1/webhook_suite_test.go deleted file mode 100644 index e6858cea95b..00000000000 --- a/testdata/project-v4-multigroup/api/crew/v1/webhook_suite_test.go +++ /dev/null @@ -1,145 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - "context" - "crypto/tls" - "fmt" - "net" - "path/filepath" - "runtime" - "testing" - "time" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - admissionv1 "k8s.io/api/admission/v1" - // +kubebuilder:scaffold:imports - apimachineryruntime "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/rest" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" - "sigs.k8s.io/controller-runtime/pkg/webhook" -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestAPIs(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Webhook Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: false, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - - WebhookInstallOptions: envtest.WebhookInstallOptions{ - Paths: []string{filepath.Join("..", "..", "..", "config", "webhook")}, - }, - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - scheme := apimachineryruntime.NewScheme() - err = AddToScheme(scheme) - Expect(err).NotTo(HaveOccurred()) - - err = admissionv1.AddToScheme(scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - - // start webhook server using Manager - webhookInstallOptions := &testEnv.WebhookInstallOptions - mgr, err := ctrl.NewManager(cfg, ctrl.Options{ - Scheme: scheme, - WebhookServer: webhook.NewServer(webhook.Options{ - Host: webhookInstallOptions.LocalServingHost, - Port: webhookInstallOptions.LocalServingPort, - CertDir: webhookInstallOptions.LocalServingCertDir, - }), - LeaderElection: false, - Metrics: metricsserver.Options{BindAddress: "0"}, - }) - Expect(err).NotTo(HaveOccurred()) - - err = (&Captain{}).SetupWebhookWithManager(mgr) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:webhook - - go func() { - defer GinkgoRecover() - err = mgr.Start(ctx) - Expect(err).NotTo(HaveOccurred()) - }() - - // wait for the webhook server to get ready - dialer := &net.Dialer{Timeout: time.Second} - addrPort := fmt.Sprintf("%s:%d", webhookInstallOptions.LocalServingHost, webhookInstallOptions.LocalServingPort) - Eventually(func() error { - conn, err := tls.DialWithDialer(dialer, "tcp", addrPort, &tls.Config{InsecureSkipVerify: true}) - if err != nil { - return err - } - return conn.Close() - }).Should(Succeed()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup/api/crew/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup/api/crew/v1/zz_generated.deepcopy.go deleted file mode 100644 index 438b50de573..00000000000 --- a/testdata/project-v4-multigroup/api/crew/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Captain) DeepCopyInto(out *Captain) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Captain. -func (in *Captain) DeepCopy() *Captain { - if in == nil { - return nil - } - out := new(Captain) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Captain) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CaptainList) DeepCopyInto(out *CaptainList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Captain, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CaptainList. -func (in *CaptainList) DeepCopy() *CaptainList { - if in == nil { - return nil - } - out := new(CaptainList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CaptainList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CaptainSpec) DeepCopyInto(out *CaptainSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CaptainSpec. -func (in *CaptainSpec) DeepCopy() *CaptainSpec { - if in == nil { - return nil - } - out := new(CaptainSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CaptainStatus) DeepCopyInto(out *CaptainStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CaptainStatus. -func (in *CaptainStatus) DeepCopy() *CaptainStatus { - if in == nil { - return nil - } - out := new(CaptainStatus) - in.DeepCopyInto(out) - return out -} diff --git a/testdata/project-v4-multigroup/api/fiz/v1/bar_types.go b/testdata/project-v4-multigroup/api/fiz/v1/bar_types.go deleted file mode 100644 index 156e9667319..00000000000 --- a/testdata/project-v4-multigroup/api/fiz/v1/bar_types.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// BarSpec defines the desired state of Bar -type BarSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Foo is an example field of Bar. Edit bar_types.go to remove/update - Foo string `json:"foo,omitempty"` -} - -// BarStatus defines the observed state of Bar -type BarStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status - -// Bar is the Schema for the bars API -type Bar struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec BarSpec `json:"spec,omitempty"` - Status BarStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// BarList contains a list of Bar -type BarList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Bar `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Bar{}, &BarList{}) -} diff --git a/testdata/project-v4-multigroup/api/fiz/v1/groupversion_info.go b/testdata/project-v4-multigroup/api/fiz/v1/groupversion_info.go deleted file mode 100644 index 2f0ef1c1438..00000000000 --- a/testdata/project-v4-multigroup/api/fiz/v1/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1 contains API Schema definitions for the fiz v1 API group -// +kubebuilder:object:generate=true -// +groupName=fiz.testproject.org -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "fiz.testproject.org", Version: "v1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/testdata/project-v4-multigroup/api/fiz/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup/api/fiz/v1/zz_generated.deepcopy.go deleted file mode 100644 index b82929d3f21..00000000000 --- a/testdata/project-v4-multigroup/api/fiz/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Bar) DeepCopyInto(out *Bar) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Bar. -func (in *Bar) DeepCopy() *Bar { - if in == nil { - return nil - } - out := new(Bar) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Bar) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BarList) DeepCopyInto(out *BarList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Bar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BarList. -func (in *BarList) DeepCopy() *BarList { - if in == nil { - return nil - } - out := new(BarList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *BarList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BarSpec) DeepCopyInto(out *BarSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BarSpec. -func (in *BarSpec) DeepCopy() *BarSpec { - if in == nil { - return nil - } - out := new(BarSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BarStatus) DeepCopyInto(out *BarStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BarStatus. -func (in *BarStatus) DeepCopy() *BarStatus { - if in == nil { - return nil - } - out := new(BarStatus) - in.DeepCopyInto(out) - return out -} diff --git a/testdata/project-v4-multigroup/api/foo.policy/v1/groupversion_info.go b/testdata/project-v4-multigroup/api/foo.policy/v1/groupversion_info.go deleted file mode 100644 index 6e98d26ab3a..00000000000 --- a/testdata/project-v4-multigroup/api/foo.policy/v1/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1 contains API Schema definitions for the foo.policy v1 API group -// +kubebuilder:object:generate=true -// +groupName=foo.policy.testproject.org -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "foo.policy.testproject.org", Version: "v1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/testdata/project-v4-multigroup/api/foo.policy/v1/healthcheckpolicy_types.go b/testdata/project-v4-multigroup/api/foo.policy/v1/healthcheckpolicy_types.go deleted file mode 100644 index fe6c9eebf16..00000000000 --- a/testdata/project-v4-multigroup/api/foo.policy/v1/healthcheckpolicy_types.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// HealthCheckPolicySpec defines the desired state of HealthCheckPolicy -type HealthCheckPolicySpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Foo is an example field of HealthCheckPolicy. Edit healthcheckpolicy_types.go to remove/update - Foo string `json:"foo,omitempty"` -} - -// HealthCheckPolicyStatus defines the observed state of HealthCheckPolicy -type HealthCheckPolicyStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status - -// HealthCheckPolicy is the Schema for the healthcheckpolicies API -type HealthCheckPolicy struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec HealthCheckPolicySpec `json:"spec,omitempty"` - Status HealthCheckPolicyStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// HealthCheckPolicyList contains a list of HealthCheckPolicy -type HealthCheckPolicyList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []HealthCheckPolicy `json:"items"` -} - -func init() { - SchemeBuilder.Register(&HealthCheckPolicy{}, &HealthCheckPolicyList{}) -} diff --git a/testdata/project-v4-multigroup/api/foo.policy/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup/api/foo.policy/v1/zz_generated.deepcopy.go deleted file mode 100644 index d0cfbe15c38..00000000000 --- a/testdata/project-v4-multigroup/api/foo.policy/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HealthCheckPolicy) DeepCopyInto(out *HealthCheckPolicy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckPolicy. -func (in *HealthCheckPolicy) DeepCopy() *HealthCheckPolicy { - if in == nil { - return nil - } - out := new(HealthCheckPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HealthCheckPolicy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HealthCheckPolicyList) DeepCopyInto(out *HealthCheckPolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]HealthCheckPolicy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckPolicyList. -func (in *HealthCheckPolicyList) DeepCopy() *HealthCheckPolicyList { - if in == nil { - return nil - } - out := new(HealthCheckPolicyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HealthCheckPolicyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HealthCheckPolicySpec) DeepCopyInto(out *HealthCheckPolicySpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckPolicySpec. -func (in *HealthCheckPolicySpec) DeepCopy() *HealthCheckPolicySpec { - if in == nil { - return nil - } - out := new(HealthCheckPolicySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HealthCheckPolicyStatus) DeepCopyInto(out *HealthCheckPolicyStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckPolicyStatus. -func (in *HealthCheckPolicyStatus) DeepCopy() *HealthCheckPolicyStatus { - if in == nil { - return nil - } - out := new(HealthCheckPolicyStatus) - in.DeepCopyInto(out) - return out -} diff --git a/testdata/project-v4-multigroup/api/foo/v1/bar_types.go b/testdata/project-v4-multigroup/api/foo/v1/bar_types.go deleted file mode 100644 index 156e9667319..00000000000 --- a/testdata/project-v4-multigroup/api/foo/v1/bar_types.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// BarSpec defines the desired state of Bar -type BarSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Foo is an example field of Bar. Edit bar_types.go to remove/update - Foo string `json:"foo,omitempty"` -} - -// BarStatus defines the observed state of Bar -type BarStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status - -// Bar is the Schema for the bars API -type Bar struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec BarSpec `json:"spec,omitempty"` - Status BarStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// BarList contains a list of Bar -type BarList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Bar `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Bar{}, &BarList{}) -} diff --git a/testdata/project-v4-multigroup/api/foo/v1/groupversion_info.go b/testdata/project-v4-multigroup/api/foo/v1/groupversion_info.go deleted file mode 100644 index fc2de1034c2..00000000000 --- a/testdata/project-v4-multigroup/api/foo/v1/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1 contains API Schema definitions for the foo v1 API group -// +kubebuilder:object:generate=true -// +groupName=foo.testproject.org -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "foo.testproject.org", Version: "v1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/testdata/project-v4-multigroup/api/foo/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup/api/foo/v1/zz_generated.deepcopy.go deleted file mode 100644 index b82929d3f21..00000000000 --- a/testdata/project-v4-multigroup/api/foo/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Bar) DeepCopyInto(out *Bar) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Bar. -func (in *Bar) DeepCopy() *Bar { - if in == nil { - return nil - } - out := new(Bar) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Bar) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BarList) DeepCopyInto(out *BarList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Bar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BarList. -func (in *BarList) DeepCopy() *BarList { - if in == nil { - return nil - } - out := new(BarList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *BarList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BarSpec) DeepCopyInto(out *BarSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BarSpec. -func (in *BarSpec) DeepCopy() *BarSpec { - if in == nil { - return nil - } - out := new(BarSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BarStatus) DeepCopyInto(out *BarStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BarStatus. -func (in *BarStatus) DeepCopy() *BarStatus { - if in == nil { - return nil - } - out := new(BarStatus) - in.DeepCopyInto(out) - return out -} diff --git a/testdata/project-v4-multigroup/api/sea-creatures/v1beta1/groupversion_info.go b/testdata/project-v4-multigroup/api/sea-creatures/v1beta1/groupversion_info.go deleted file mode 100644 index 89a558aa195..00000000000 --- a/testdata/project-v4-multigroup/api/sea-creatures/v1beta1/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1beta1 contains API Schema definitions for the sea-creatures v1beta1 API group -// +kubebuilder:object:generate=true -// +groupName=sea-creatures.testproject.org -package v1beta1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "sea-creatures.testproject.org", Version: "v1beta1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/testdata/project-v4-multigroup/api/sea-creatures/v1beta1/kraken_types.go b/testdata/project-v4-multigroup/api/sea-creatures/v1beta1/kraken_types.go deleted file mode 100644 index bd6d7036398..00000000000 --- a/testdata/project-v4-multigroup/api/sea-creatures/v1beta1/kraken_types.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// KrakenSpec defines the desired state of Kraken -type KrakenSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Foo is an example field of Kraken. Edit kraken_types.go to remove/update - Foo string `json:"foo,omitempty"` -} - -// KrakenStatus defines the observed state of Kraken -type KrakenStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status - -// Kraken is the Schema for the krakens API -type Kraken struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec KrakenSpec `json:"spec,omitempty"` - Status KrakenStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// KrakenList contains a list of Kraken -type KrakenList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Kraken `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Kraken{}, &KrakenList{}) -} diff --git a/testdata/project-v4-multigroup/api/sea-creatures/v1beta1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup/api/sea-creatures/v1beta1/zz_generated.deepcopy.go deleted file mode 100644 index 25f64b3d2b5..00000000000 --- a/testdata/project-v4-multigroup/api/sea-creatures/v1beta1/zz_generated.deepcopy.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1beta1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Kraken) DeepCopyInto(out *Kraken) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Kraken. -func (in *Kraken) DeepCopy() *Kraken { - if in == nil { - return nil - } - out := new(Kraken) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Kraken) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KrakenList) DeepCopyInto(out *KrakenList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Kraken, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KrakenList. -func (in *KrakenList) DeepCopy() *KrakenList { - if in == nil { - return nil - } - out := new(KrakenList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *KrakenList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KrakenSpec) DeepCopyInto(out *KrakenSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KrakenSpec. -func (in *KrakenSpec) DeepCopy() *KrakenSpec { - if in == nil { - return nil - } - out := new(KrakenSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KrakenStatus) DeepCopyInto(out *KrakenStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KrakenStatus. -func (in *KrakenStatus) DeepCopy() *KrakenStatus { - if in == nil { - return nil - } - out := new(KrakenStatus) - in.DeepCopyInto(out) - return out -} diff --git a/testdata/project-v4-multigroup/api/sea-creatures/v1beta2/groupversion_info.go b/testdata/project-v4-multigroup/api/sea-creatures/v1beta2/groupversion_info.go deleted file mode 100644 index 5759c272d31..00000000000 --- a/testdata/project-v4-multigroup/api/sea-creatures/v1beta2/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1beta2 contains API Schema definitions for the sea-creatures v1beta2 API group -// +kubebuilder:object:generate=true -// +groupName=sea-creatures.testproject.org -package v1beta2 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "sea-creatures.testproject.org", Version: "v1beta2"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/testdata/project-v4-multigroup/api/sea-creatures/v1beta2/leviathan_types.go b/testdata/project-v4-multigroup/api/sea-creatures/v1beta2/leviathan_types.go deleted file mode 100644 index ac1b7ae2c37..00000000000 --- a/testdata/project-v4-multigroup/api/sea-creatures/v1beta2/leviathan_types.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// LeviathanSpec defines the desired state of Leviathan -type LeviathanSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Foo is an example field of Leviathan. Edit leviathan_types.go to remove/update - Foo string `json:"foo,omitempty"` -} - -// LeviathanStatus defines the observed state of Leviathan -type LeviathanStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status - -// Leviathan is the Schema for the leviathans API -type Leviathan struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec LeviathanSpec `json:"spec,omitempty"` - Status LeviathanStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// LeviathanList contains a list of Leviathan -type LeviathanList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Leviathan `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Leviathan{}, &LeviathanList{}) -} diff --git a/testdata/project-v4-multigroup/api/sea-creatures/v1beta2/zz_generated.deepcopy.go b/testdata/project-v4-multigroup/api/sea-creatures/v1beta2/zz_generated.deepcopy.go deleted file mode 100644 index e9934a77f85..00000000000 --- a/testdata/project-v4-multigroup/api/sea-creatures/v1beta2/zz_generated.deepcopy.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1beta2 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Leviathan) DeepCopyInto(out *Leviathan) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Leviathan. -func (in *Leviathan) DeepCopy() *Leviathan { - if in == nil { - return nil - } - out := new(Leviathan) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Leviathan) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LeviathanList) DeepCopyInto(out *LeviathanList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Leviathan, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeviathanList. -func (in *LeviathanList) DeepCopy() *LeviathanList { - if in == nil { - return nil - } - out := new(LeviathanList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LeviathanList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LeviathanSpec) DeepCopyInto(out *LeviathanSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeviathanSpec. -func (in *LeviathanSpec) DeepCopy() *LeviathanSpec { - if in == nil { - return nil - } - out := new(LeviathanSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LeviathanStatus) DeepCopyInto(out *LeviathanStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeviathanStatus. -func (in *LeviathanStatus) DeepCopy() *LeviathanStatus { - if in == nil { - return nil - } - out := new(LeviathanStatus) - in.DeepCopyInto(out) - return out -} diff --git a/testdata/project-v4-multigroup/api/ship/v1/destroyer_types.go b/testdata/project-v4-multigroup/api/ship/v1/destroyer_types.go deleted file mode 100644 index 9b3c78cb0be..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v1/destroyer_types.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// DestroyerSpec defines the desired state of Destroyer -type DestroyerSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Foo is an example field of Destroyer. Edit destroyer_types.go to remove/update - Foo string `json:"foo,omitempty"` -} - -// DestroyerStatus defines the observed state of Destroyer -type DestroyerStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster - -// Destroyer is the Schema for the destroyers API -type Destroyer struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec DestroyerSpec `json:"spec,omitempty"` - Status DestroyerStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// DestroyerList contains a list of Destroyer -type DestroyerList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Destroyer `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Destroyer{}, &DestroyerList{}) -} diff --git a/testdata/project-v4-multigroup/api/ship/v1/destroyer_webhook.go b/testdata/project-v4-multigroup/api/ship/v1/destroyer_webhook.go deleted file mode 100644 index 2b48054a343..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v1/destroyer_webhook.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" -) - -// nolint:unused -// log is for logging in this package. -var destroyerlog = logf.Log.WithName("destroyer-resource") - -// SetupWebhookWithManager will setup the manager to manage the webhooks -func (r *Destroyer) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} - -// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! - -// +kubebuilder:webhook:path=/mutate-ship-testproject-org-v1-destroyer,mutating=true,failurePolicy=fail,sideEffects=None,groups=ship.testproject.org,resources=destroyers,verbs=create;update,versions=v1,name=mdestroyer.kb.io,admissionReviewVersions=v1 - -var _ webhook.Defaulter = &Destroyer{} - -// Default implements webhook.Defaulter so a webhook will be registered for the type -func (r *Destroyer) Default() { - destroyerlog.Info("default", "name", r.Name) - - // TODO(user): fill in your defaulting logic. -} diff --git a/testdata/project-v4-multigroup/api/ship/v1/destroyer_webhook_test.go b/testdata/project-v4-multigroup/api/ship/v1/destroyer_webhook_test.go deleted file mode 100644 index d9581869f03..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v1/destroyer_webhook_test.go +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - . "github.com/onsi/ginkgo/v2" -) - -var _ = Describe("Destroyer Webhook", func() { - - Context("When creating Destroyer under Defaulting Webhook", func() { - It("Should fill in the default value if a required field is empty", func() { - - // TODO(user): Add your logic here - - }) - }) - -}) diff --git a/testdata/project-v4-multigroup/api/ship/v1/groupversion_info.go b/testdata/project-v4-multigroup/api/ship/v1/groupversion_info.go deleted file mode 100644 index 8dbcf127354..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v1/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1 contains API Schema definitions for the ship v1 API group -// +kubebuilder:object:generate=true -// +groupName=ship.testproject.org -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "ship.testproject.org", Version: "v1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/testdata/project-v4-multigroup/api/ship/v1/webhook_suite_test.go b/testdata/project-v4-multigroup/api/ship/v1/webhook_suite_test.go deleted file mode 100644 index eff9dded25c..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v1/webhook_suite_test.go +++ /dev/null @@ -1,145 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - "context" - "crypto/tls" - "fmt" - "net" - "path/filepath" - "runtime" - "testing" - "time" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - admissionv1 "k8s.io/api/admission/v1" - // +kubebuilder:scaffold:imports - apimachineryruntime "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/rest" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" - "sigs.k8s.io/controller-runtime/pkg/webhook" -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestAPIs(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Webhook Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: false, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - - WebhookInstallOptions: envtest.WebhookInstallOptions{ - Paths: []string{filepath.Join("..", "..", "..", "config", "webhook")}, - }, - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - scheme := apimachineryruntime.NewScheme() - err = AddToScheme(scheme) - Expect(err).NotTo(HaveOccurred()) - - err = admissionv1.AddToScheme(scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - - // start webhook server using Manager - webhookInstallOptions := &testEnv.WebhookInstallOptions - mgr, err := ctrl.NewManager(cfg, ctrl.Options{ - Scheme: scheme, - WebhookServer: webhook.NewServer(webhook.Options{ - Host: webhookInstallOptions.LocalServingHost, - Port: webhookInstallOptions.LocalServingPort, - CertDir: webhookInstallOptions.LocalServingCertDir, - }), - LeaderElection: false, - Metrics: metricsserver.Options{BindAddress: "0"}, - }) - Expect(err).NotTo(HaveOccurred()) - - err = (&Destroyer{}).SetupWebhookWithManager(mgr) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:webhook - - go func() { - defer GinkgoRecover() - err = mgr.Start(ctx) - Expect(err).NotTo(HaveOccurred()) - }() - - // wait for the webhook server to get ready - dialer := &net.Dialer{Timeout: time.Second} - addrPort := fmt.Sprintf("%s:%d", webhookInstallOptions.LocalServingHost, webhookInstallOptions.LocalServingPort) - Eventually(func() error { - conn, err := tls.DialWithDialer(dialer, "tcp", addrPort, &tls.Config{InsecureSkipVerify: true}) - if err != nil { - return err - } - return conn.Close() - }).Should(Succeed()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup/api/ship/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup/api/ship/v1/zz_generated.deepcopy.go deleted file mode 100644 index 8931c51a317..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Destroyer) DeepCopyInto(out *Destroyer) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Destroyer. -func (in *Destroyer) DeepCopy() *Destroyer { - if in == nil { - return nil - } - out := new(Destroyer) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Destroyer) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DestroyerList) DeepCopyInto(out *DestroyerList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Destroyer, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DestroyerList. -func (in *DestroyerList) DeepCopy() *DestroyerList { - if in == nil { - return nil - } - out := new(DestroyerList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *DestroyerList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DestroyerSpec) DeepCopyInto(out *DestroyerSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DestroyerSpec. -func (in *DestroyerSpec) DeepCopy() *DestroyerSpec { - if in == nil { - return nil - } - out := new(DestroyerSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DestroyerStatus) DeepCopyInto(out *DestroyerStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DestroyerStatus. -func (in *DestroyerStatus) DeepCopy() *DestroyerStatus { - if in == nil { - return nil - } - out := new(DestroyerStatus) - in.DeepCopyInto(out) - return out -} diff --git a/testdata/project-v4-multigroup/api/ship/v1beta1/frigate_types.go b/testdata/project-v4-multigroup/api/ship/v1beta1/frigate_types.go deleted file mode 100644 index 7682b49eec6..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v1beta1/frigate_types.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// FrigateSpec defines the desired state of Frigate -type FrigateSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Foo is an example field of Frigate. Edit frigate_types.go to remove/update - Foo string `json:"foo,omitempty"` -} - -// FrigateStatus defines the observed state of Frigate -type FrigateStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status - -// Frigate is the Schema for the frigates API -type Frigate struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec FrigateSpec `json:"spec,omitempty"` - Status FrigateStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// FrigateList contains a list of Frigate -type FrigateList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Frigate `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Frigate{}, &FrigateList{}) -} diff --git a/testdata/project-v4-multigroup/api/ship/v1beta1/frigate_webhook.go b/testdata/project-v4-multigroup/api/ship/v1beta1/frigate_webhook.go deleted file mode 100644 index 4e0e4a8ebd4..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v1beta1/frigate_webhook.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" -) - -// nolint:unused -// log is for logging in this package. -var frigatelog = logf.Log.WithName("frigate-resource") - -// SetupWebhookWithManager will setup the manager to manage the webhooks -func (r *Frigate) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} - -// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! diff --git a/testdata/project-v4-multigroup/api/ship/v1beta1/frigate_webhook_test.go b/testdata/project-v4-multigroup/api/ship/v1beta1/frigate_webhook_test.go deleted file mode 100644 index 2fbb330994a..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v1beta1/frigate_webhook_test.go +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - . "github.com/onsi/ginkgo/v2" -) - -var _ = Describe("Frigate Webhook", func() { - - Context("When creating Frigate under Conversion Webhook", func() { - It("Should get the converted version of Frigate", func() { - - // TODO(user): Add your logic here - - }) - }) - -}) diff --git a/testdata/project-v4-multigroup/api/ship/v1beta1/groupversion_info.go b/testdata/project-v4-multigroup/api/ship/v1beta1/groupversion_info.go deleted file mode 100644 index 810fb705104..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v1beta1/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1beta1 contains API Schema definitions for the ship v1beta1 API group -// +kubebuilder:object:generate=true -// +groupName=ship.testproject.org -package v1beta1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "ship.testproject.org", Version: "v1beta1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/testdata/project-v4-multigroup/api/ship/v1beta1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup/api/ship/v1beta1/zz_generated.deepcopy.go deleted file mode 100644 index bfcdcf442ae..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v1beta1/zz_generated.deepcopy.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1beta1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Frigate) DeepCopyInto(out *Frigate) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Frigate. -func (in *Frigate) DeepCopy() *Frigate { - if in == nil { - return nil - } - out := new(Frigate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Frigate) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FrigateList) DeepCopyInto(out *FrigateList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Frigate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FrigateList. -func (in *FrigateList) DeepCopy() *FrigateList { - if in == nil { - return nil - } - out := new(FrigateList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FrigateList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FrigateSpec) DeepCopyInto(out *FrigateSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FrigateSpec. -func (in *FrigateSpec) DeepCopy() *FrigateSpec { - if in == nil { - return nil - } - out := new(FrigateSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FrigateStatus) DeepCopyInto(out *FrigateStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FrigateStatus. -func (in *FrigateStatus) DeepCopy() *FrigateStatus { - if in == nil { - return nil - } - out := new(FrigateStatus) - in.DeepCopyInto(out) - return out -} diff --git a/testdata/project-v4-multigroup/api/ship/v2alpha1/cruiser_types.go b/testdata/project-v4-multigroup/api/ship/v2alpha1/cruiser_types.go deleted file mode 100644 index bd5974164cf..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v2alpha1/cruiser_types.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// CruiserSpec defines the desired state of Cruiser -type CruiserSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Foo is an example field of Cruiser. Edit cruiser_types.go to remove/update - Foo string `json:"foo,omitempty"` -} - -// CruiserStatus defines the observed state of Cruiser -type CruiserStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster - -// Cruiser is the Schema for the cruisers API -type Cruiser struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec CruiserSpec `json:"spec,omitempty"` - Status CruiserStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// CruiserList contains a list of Cruiser -type CruiserList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Cruiser `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Cruiser{}, &CruiserList{}) -} diff --git a/testdata/project-v4-multigroup/api/ship/v2alpha1/cruiser_webhook.go b/testdata/project-v4-multigroup/api/ship/v2alpha1/cruiser_webhook.go deleted file mode 100644 index fbd7198afff..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v2alpha1/cruiser_webhook.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" - "sigs.k8s.io/controller-runtime/pkg/webhook/admission" -) - -// nolint:unused -// log is for logging in this package. -var cruiserlog = logf.Log.WithName("cruiser-resource") - -// SetupWebhookWithManager will setup the manager to manage the webhooks -func (r *Cruiser) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} - -// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! - -// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation. -// NOTE: The 'path' attribute must follow a specific pattern and should not be modified directly here. -// Modifying the path for an invalid path can cause API server errors; failing to locate the webhook. -// +kubebuilder:webhook:path=/validate-ship-testproject-org-v2alpha1-cruiser,mutating=false,failurePolicy=fail,sideEffects=None,groups=ship.testproject.org,resources=cruisers,verbs=create;update,versions=v2alpha1,name=vcruiser.kb.io,admissionReviewVersions=v1 - -var _ webhook.Validator = &Cruiser{} - -// ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *Cruiser) ValidateCreate() (admission.Warnings, error) { - cruiserlog.Info("validate create", "name", r.Name) - - // TODO(user): fill in your validation logic upon object creation. - return nil, nil -} - -// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *Cruiser) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { - cruiserlog.Info("validate update", "name", r.Name) - - // TODO(user): fill in your validation logic upon object update. - return nil, nil -} - -// ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *Cruiser) ValidateDelete() (admission.Warnings, error) { - cruiserlog.Info("validate delete", "name", r.Name) - - // TODO(user): fill in your validation logic upon object deletion. - return nil, nil -} diff --git a/testdata/project-v4-multigroup/api/ship/v2alpha1/cruiser_webhook_test.go b/testdata/project-v4-multigroup/api/ship/v2alpha1/cruiser_webhook_test.go deleted file mode 100644 index 7678703b212..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v2alpha1/cruiser_webhook_test.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - . "github.com/onsi/ginkgo/v2" -) - -var _ = Describe("Cruiser Webhook", func() { - - Context("When creating Cruiser under Validating Webhook", func() { - It("Should deny if a required field is empty", func() { - - // TODO(user): Add your logic here - - }) - - It("Should admit if all required fields are provided", func() { - - // TODO(user): Add your logic here - - }) - }) - -}) diff --git a/testdata/project-v4-multigroup/api/ship/v2alpha1/groupversion_info.go b/testdata/project-v4-multigroup/api/ship/v2alpha1/groupversion_info.go deleted file mode 100644 index 463a7f12ed3..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v2alpha1/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v2alpha1 contains API Schema definitions for the ship v2alpha1 API group -// +kubebuilder:object:generate=true -// +groupName=ship.testproject.org -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "ship.testproject.org", Version: "v2alpha1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/testdata/project-v4-multigroup/api/ship/v2alpha1/webhook_suite_test.go b/testdata/project-v4-multigroup/api/ship/v2alpha1/webhook_suite_test.go deleted file mode 100644 index d5b32d5b3d7..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v2alpha1/webhook_suite_test.go +++ /dev/null @@ -1,145 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - "context" - "crypto/tls" - "fmt" - "net" - "path/filepath" - "runtime" - "testing" - "time" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - admissionv1 "k8s.io/api/admission/v1" - // +kubebuilder:scaffold:imports - apimachineryruntime "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/rest" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" - "sigs.k8s.io/controller-runtime/pkg/webhook" -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestAPIs(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Webhook Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: false, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - - WebhookInstallOptions: envtest.WebhookInstallOptions{ - Paths: []string{filepath.Join("..", "..", "..", "config", "webhook")}, - }, - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - scheme := apimachineryruntime.NewScheme() - err = AddToScheme(scheme) - Expect(err).NotTo(HaveOccurred()) - - err = admissionv1.AddToScheme(scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - - // start webhook server using Manager - webhookInstallOptions := &testEnv.WebhookInstallOptions - mgr, err := ctrl.NewManager(cfg, ctrl.Options{ - Scheme: scheme, - WebhookServer: webhook.NewServer(webhook.Options{ - Host: webhookInstallOptions.LocalServingHost, - Port: webhookInstallOptions.LocalServingPort, - CertDir: webhookInstallOptions.LocalServingCertDir, - }), - LeaderElection: false, - Metrics: metricsserver.Options{BindAddress: "0"}, - }) - Expect(err).NotTo(HaveOccurred()) - - err = (&Cruiser{}).SetupWebhookWithManager(mgr) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:webhook - - go func() { - defer GinkgoRecover() - err = mgr.Start(ctx) - Expect(err).NotTo(HaveOccurred()) - }() - - // wait for the webhook server to get ready - dialer := &net.Dialer{Timeout: time.Second} - addrPort := fmt.Sprintf("%s:%d", webhookInstallOptions.LocalServingHost, webhookInstallOptions.LocalServingPort) - Eventually(func() error { - conn, err := tls.DialWithDialer(dialer, "tcp", addrPort, &tls.Config{InsecureSkipVerify: true}) - if err != nil { - return err - } - return conn.Close() - }).Should(Succeed()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup/api/ship/v2alpha1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup/api/ship/v2alpha1/zz_generated.deepcopy.go deleted file mode 100644 index 8f391c1cf27..00000000000 --- a/testdata/project-v4-multigroup/api/ship/v2alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Cruiser) DeepCopyInto(out *Cruiser) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cruiser. -func (in *Cruiser) DeepCopy() *Cruiser { - if in == nil { - return nil - } - out := new(Cruiser) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Cruiser) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CruiserList) DeepCopyInto(out *CruiserList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Cruiser, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CruiserList. -func (in *CruiserList) DeepCopy() *CruiserList { - if in == nil { - return nil - } - out := new(CruiserList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CruiserList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CruiserSpec) DeepCopyInto(out *CruiserSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CruiserSpec. -func (in *CruiserSpec) DeepCopy() *CruiserSpec { - if in == nil { - return nil - } - out := new(CruiserSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CruiserStatus) DeepCopyInto(out *CruiserStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CruiserStatus. -func (in *CruiserStatus) DeepCopy() *CruiserStatus { - if in == nil { - return nil - } - out := new(CruiserStatus) - in.DeepCopyInto(out) - return out -} diff --git a/testdata/project-v4-multigroup/api/v1/groupversion_info.go b/testdata/project-v4-multigroup/api/v1/groupversion_info.go deleted file mode 100644 index 6f7fb524313..00000000000 --- a/testdata/project-v4-multigroup/api/v1/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1 contains API Schema definitions for the v1 API group -// +kubebuilder:object:generate=true -// +groupName=testproject.org -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "testproject.org", Version: "v1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/testdata/project-v4-multigroup/api/v1/lakers_types.go b/testdata/project-v4-multigroup/api/v1/lakers_types.go deleted file mode 100644 index ab04f5e8ba0..00000000000 --- a/testdata/project-v4-multigroup/api/v1/lakers_types.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// LakersSpec defines the desired state of Lakers -type LakersSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Foo is an example field of Lakers. Edit lakers_types.go to remove/update - Foo string `json:"foo,omitempty"` -} - -// LakersStatus defines the observed state of Lakers -type LakersStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status - -// Lakers is the Schema for the lakers API -type Lakers struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec LakersSpec `json:"spec,omitempty"` - Status LakersStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// LakersList contains a list of Lakers -type LakersList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Lakers `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Lakers{}, &LakersList{}) -} diff --git a/testdata/project-v4-multigroup/api/v1/lakers_webhook.go b/testdata/project-v4-multigroup/api/v1/lakers_webhook.go deleted file mode 100644 index 808421b2aa5..00000000000 --- a/testdata/project-v4-multigroup/api/v1/lakers_webhook.go +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/webhook" - "sigs.k8s.io/controller-runtime/pkg/webhook/admission" -) - -// nolint:unused -// log is for logging in this package. -var lakerslog = logf.Log.WithName("lakers-resource") - -// SetupWebhookWithManager will setup the manager to manage the webhooks -func (r *Lakers) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} - -// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! - -// +kubebuilder:webhook:path=/mutate-testproject-org-v1-lakers,mutating=true,failurePolicy=fail,sideEffects=None,groups=testproject.org,resources=lakers,verbs=create;update,versions=v1,name=mlakers.kb.io,admissionReviewVersions=v1 - -var _ webhook.Defaulter = &Lakers{} - -// Default implements webhook.Defaulter so a webhook will be registered for the type -func (r *Lakers) Default() { - lakerslog.Info("default", "name", r.Name) - - // TODO(user): fill in your defaulting logic. -} - -// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation. -// NOTE: The 'path' attribute must follow a specific pattern and should not be modified directly here. -// Modifying the path for an invalid path can cause API server errors; failing to locate the webhook. -// +kubebuilder:webhook:path=/validate-testproject-org-v1-lakers,mutating=false,failurePolicy=fail,sideEffects=None,groups=testproject.org,resources=lakers,verbs=create;update,versions=v1,name=vlakers.kb.io,admissionReviewVersions=v1 - -var _ webhook.Validator = &Lakers{} - -// ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *Lakers) ValidateCreate() (admission.Warnings, error) { - lakerslog.Info("validate create", "name", r.Name) - - // TODO(user): fill in your validation logic upon object creation. - return nil, nil -} - -// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *Lakers) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { - lakerslog.Info("validate update", "name", r.Name) - - // TODO(user): fill in your validation logic upon object update. - return nil, nil -} - -// ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *Lakers) ValidateDelete() (admission.Warnings, error) { - lakerslog.Info("validate delete", "name", r.Name) - - // TODO(user): fill in your validation logic upon object deletion. - return nil, nil -} diff --git a/testdata/project-v4-multigroup/api/v1/lakers_webhook_test.go b/testdata/project-v4-multigroup/api/v1/lakers_webhook_test.go deleted file mode 100644 index 9f63f052c50..00000000000 --- a/testdata/project-v4-multigroup/api/v1/lakers_webhook_test.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - . "github.com/onsi/ginkgo/v2" -) - -var _ = Describe("Lakers Webhook", func() { - - Context("When creating Lakers under Defaulting Webhook", func() { - It("Should fill in the default value if a required field is empty", func() { - - // TODO(user): Add your logic here - - }) - }) - - Context("When creating Lakers under Validating Webhook", func() { - It("Should deny if a required field is empty", func() { - - // TODO(user): Add your logic here - - }) - - It("Should admit if all required fields are provided", func() { - - // TODO(user): Add your logic here - - }) - }) - -}) diff --git a/testdata/project-v4-multigroup/api/v1/webhook_suite_test.go b/testdata/project-v4-multigroup/api/v1/webhook_suite_test.go deleted file mode 100644 index 8b2ed9c5868..00000000000 --- a/testdata/project-v4-multigroup/api/v1/webhook_suite_test.go +++ /dev/null @@ -1,145 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - "context" - "crypto/tls" - "fmt" - "net" - "path/filepath" - "runtime" - "testing" - "time" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - admissionv1 "k8s.io/api/admission/v1" - // +kubebuilder:scaffold:imports - apimachineryruntime "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/rest" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" - "sigs.k8s.io/controller-runtime/pkg/webhook" -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestAPIs(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Webhook Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: false, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - - WebhookInstallOptions: envtest.WebhookInstallOptions{ - Paths: []string{filepath.Join("..", "..", "config", "webhook")}, - }, - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - scheme := apimachineryruntime.NewScheme() - err = AddToScheme(scheme) - Expect(err).NotTo(HaveOccurred()) - - err = admissionv1.AddToScheme(scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - - // start webhook server using Manager - webhookInstallOptions := &testEnv.WebhookInstallOptions - mgr, err := ctrl.NewManager(cfg, ctrl.Options{ - Scheme: scheme, - WebhookServer: webhook.NewServer(webhook.Options{ - Host: webhookInstallOptions.LocalServingHost, - Port: webhookInstallOptions.LocalServingPort, - CertDir: webhookInstallOptions.LocalServingCertDir, - }), - LeaderElection: false, - Metrics: metricsserver.Options{BindAddress: "0"}, - }) - Expect(err).NotTo(HaveOccurred()) - - err = (&Lakers{}).SetupWebhookWithManager(mgr) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:webhook - - go func() { - defer GinkgoRecover() - err = mgr.Start(ctx) - Expect(err).NotTo(HaveOccurred()) - }() - - // wait for the webhook server to get ready - dialer := &net.Dialer{Timeout: time.Second} - addrPort := fmt.Sprintf("%s:%d", webhookInstallOptions.LocalServingHost, webhookInstallOptions.LocalServingPort) - Eventually(func() error { - conn, err := tls.DialWithDialer(dialer, "tcp", addrPort, &tls.Config{InsecureSkipVerify: true}) - if err != nil { - return err - } - return conn.Close() - }).Should(Succeed()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup/api/v1/zz_generated.deepcopy.go b/testdata/project-v4-multigroup/api/v1/zz_generated.deepcopy.go deleted file mode 100644 index 64e471813a8..00000000000 --- a/testdata/project-v4-multigroup/api/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Lakers) DeepCopyInto(out *Lakers) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Lakers. -func (in *Lakers) DeepCopy() *Lakers { - if in == nil { - return nil - } - out := new(Lakers) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Lakers) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LakersList) DeepCopyInto(out *LakersList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Lakers, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LakersList. -func (in *LakersList) DeepCopy() *LakersList { - if in == nil { - return nil - } - out := new(LakersList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LakersList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LakersSpec) DeepCopyInto(out *LakersSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LakersSpec. -func (in *LakersSpec) DeepCopy() *LakersSpec { - if in == nil { - return nil - } - out := new(LakersSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LakersStatus) DeepCopyInto(out *LakersStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LakersStatus. -func (in *LakersStatus) DeepCopy() *LakersStatus { - if in == nil { - return nil - } - out := new(LakersStatus) - in.DeepCopyInto(out) - return out -} diff --git a/testdata/project-v4-multigroup/cmd/main.go b/testdata/project-v4-multigroup/cmd/main.go deleted file mode 100644 index 2057d6eaef1..00000000000 --- a/testdata/project-v4-multigroup/cmd/main.go +++ /dev/null @@ -1,300 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "crypto/tls" - "flag" - "os" - - // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) - // to ensure that exec-entrypoint and run can make use of them. - _ "k8s.io/client-go/plugin/pkg/client/auth" - - "k8s.io/apimachinery/pkg/runtime" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - clientgoscheme "k8s.io/client-go/kubernetes/scheme" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/healthz" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - "sigs.k8s.io/controller-runtime/pkg/metrics/filters" - metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" - "sigs.k8s.io/controller-runtime/pkg/webhook" - - crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/crew/v1" - fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/fiz/v1" - foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/foo.policy/v1" - foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/foo/v1" - seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/sea-creatures/v1beta1" - seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/sea-creatures/v1beta2" - shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v1" - shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v1beta1" - shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v2alpha1" - testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/v1" - "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/internal/controller" - appscontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/internal/controller/apps" - crewcontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/internal/controller/crew" - fizcontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/internal/controller/fiz" - foocontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/internal/controller/foo" - foopolicycontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/internal/controller/foo.policy" - seacreaturescontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/internal/controller/sea-creatures" - shipcontroller "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/internal/controller/ship" - // +kubebuilder:scaffold:imports -) - -var ( - scheme = runtime.NewScheme() - setupLog = ctrl.Log.WithName("setup") -) - -func init() { - utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - - utilruntime.Must(crewv1.AddToScheme(scheme)) - utilruntime.Must(shipv1beta1.AddToScheme(scheme)) - utilruntime.Must(shipv1.AddToScheme(scheme)) - utilruntime.Must(shipv2alpha1.AddToScheme(scheme)) - utilruntime.Must(seacreaturesv1beta1.AddToScheme(scheme)) - utilruntime.Must(seacreaturesv1beta2.AddToScheme(scheme)) - utilruntime.Must(foopolicyv1.AddToScheme(scheme)) - utilruntime.Must(foov1.AddToScheme(scheme)) - utilruntime.Must(fizv1.AddToScheme(scheme)) - utilruntime.Must(testprojectorgv1.AddToScheme(scheme)) - // +kubebuilder:scaffold:scheme -} - -func main() { - var metricsAddr string - var enableLeaderElection bool - var probeAddr string - var secureMetrics bool - var enableHTTP2 bool - var tlsOpts []func(*tls.Config) - flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. "+ - "Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.") - flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") - flag.BoolVar(&enableLeaderElection, "leader-elect", false, - "Enable leader election for controller manager. "+ - "Enabling this will ensure there is only one active controller manager.") - flag.BoolVar(&secureMetrics, "metrics-secure", true, - "If set, the metrics endpoint is served securely via HTTPS. Use --metrics-secure=false to use HTTP instead.") - flag.BoolVar(&enableHTTP2, "enable-http2", false, - "If set, HTTP/2 will be enabled for the metrics and webhook servers") - opts := zap.Options{ - Development: true, - } - opts.BindFlags(flag.CommandLine) - flag.Parse() - - ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) - - // if the enable-http2 flag is false (the default), http/2 should be disabled - // due to its vulnerabilities. More specifically, disabling http/2 will - // prevent from being vulnerable to the HTTP/2 Stream Cancellation and - // Rapid Reset CVEs. For more information see: - // - https://github.com/advisories/GHSA-qppj-fm5r-hxr3 - // - https://github.com/advisories/GHSA-4374-p667-p6c8 - disableHTTP2 := func(c *tls.Config) { - setupLog.Info("disabling http/2") - c.NextProtos = []string{"http/1.1"} - } - - if !enableHTTP2 { - tlsOpts = append(tlsOpts, disableHTTP2) - } - - webhookServer := webhook.NewServer(webhook.Options{ - TLSOpts: tlsOpts, - }) - - // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server. - // More info: - // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/metrics/server - // - https://book.kubebuilder.io/reference/metrics.html - metricsServerOptions := metricsserver.Options{ - BindAddress: metricsAddr, - SecureServing: secureMetrics, - // TODO(user): TLSOpts is used to allow configuring the TLS config used for the server. If certificates are - // not provided, self-signed certificates will be generated by default. This option is not recommended for - // production environments as self-signed certificates do not offer the same level of trust and security - // as certificates issued by a trusted Certificate Authority (CA). The primary risk is potentially allowing - // unauthorized access to sensitive metrics data. Consider replacing with CertDir, CertName, and KeyName - // to provide certificates, ensuring the server communicates using trusted and secure certificates. - TLSOpts: tlsOpts, - } - - if secureMetrics { - // FilterProvider is used to protect the metrics endpoint with authn/authz. - // These configurations ensure that only authorized users and service accounts - // can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info: - // https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/metrics/filters#WithAuthenticationAndAuthorization - metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization - } - - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ - Scheme: scheme, - Metrics: metricsServerOptions, - WebhookServer: webhookServer, - HealthProbeBindAddress: probeAddr, - LeaderElection: enableLeaderElection, - LeaderElectionID: "3e9f67a9.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 - // speeds up voluntary leader transitions as the new leader don't have to wait - // LeaseDuration time first. - // - // In the default scaffold provided, the program ends immediately after - // the manager stops, so would be fine to enable this option. However, - // if you are doing or is intended to do any operation such as perform cleanups - // after the manager stops then its usage might be unsafe. - // LeaderElectionReleaseOnCancel: true, - }) - if err != nil { - setupLog.Error(err, "unable to start manager") - os.Exit(1) - } - - if err = (&crewcontroller.CaptainReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Captain") - os.Exit(1) - } - // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { - if err = (&crewv1.Captain{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "Captain") - os.Exit(1) - } - } - if err = (&shipcontroller.FrigateReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Frigate") - os.Exit(1) - } - // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { - if err = (&shipv1beta1.Frigate{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "Frigate") - os.Exit(1) - } - } - if err = (&shipcontroller.DestroyerReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Destroyer") - os.Exit(1) - } - // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { - if err = (&shipv1.Destroyer{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "Destroyer") - os.Exit(1) - } - } - if err = (&shipcontroller.CruiserReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Cruiser") - os.Exit(1) - } - // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { - if err = (&shipv2alpha1.Cruiser{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "Cruiser") - os.Exit(1) - } - } - if err = (&seacreaturescontroller.KrakenReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Kraken") - os.Exit(1) - } - if err = (&seacreaturescontroller.LeviathanReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Leviathan") - os.Exit(1) - } - if err = (&foopolicycontroller.HealthCheckPolicyReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "HealthCheckPolicy") - os.Exit(1) - } - if err = (&appscontroller.DeploymentReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Deployment") - os.Exit(1) - } - if err = (&foocontroller.BarReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Bar") - os.Exit(1) - } - if err = (&fizcontroller.BarReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Bar") - os.Exit(1) - } - if err = (&controller.LakersReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Lakers") - os.Exit(1) - } - // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { - if err = (&testprojectorgv1.Lakers{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "Lakers") - os.Exit(1) - } - } - // +kubebuilder:scaffold:builder - - if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up health check") - os.Exit(1) - } - if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up ready check") - os.Exit(1) - } - - setupLog.Info("starting manager") - if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil { - setupLog.Error(err, "problem running manager") - os.Exit(1) - } -} diff --git a/testdata/project-v4-multigroup/config/certmanager/certificate.yaml b/testdata/project-v4-multigroup/config/certmanager/certificate.yaml deleted file mode 100644 index d6bd556f1b4..00000000000 --- a/testdata/project-v4-multigroup/config/certmanager/certificate.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# The following manifests contain a self-signed issuer CR and a certificate CR. -# More document can be found at https://docs.cert-manager.io -# WARNING: Targets CertManager v1.0. Check https://cert-manager.io/docs/installation/upgrading/ for breaking changes. -apiVersion: cert-manager.io/v1 -kind: Issuer -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: selfsigned-issuer - namespace: system -spec: - selfSigned: {} ---- -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - labels: - app.kubernetes.io/name: certificate - app.kubernetes.io/instance: serving-cert - app.kubernetes.io/component: certificate - app.kubernetes.io/created-by: project-v4-multigroup - app.kubernetes.io/part-of: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml - namespace: system -spec: - # SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize - dnsNames: - - SERVICE_NAME.SERVICE_NAMESPACE.svc - - SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local - issuerRef: - kind: Issuer - name: selfsigned-issuer - secretName: webhook-server-cert # this secret will not be prefixed, since it's not managed by kustomize diff --git a/testdata/project-v4-multigroup/config/certmanager/kustomization.yaml b/testdata/project-v4-multigroup/config/certmanager/kustomization.yaml deleted file mode 100644 index bebea5a595e..00000000000 --- a/testdata/project-v4-multigroup/config/certmanager/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -resources: -- certificate.yaml - -configurations: -- kustomizeconfig.yaml diff --git a/testdata/project-v4-multigroup/config/certmanager/kustomizeconfig.yaml b/testdata/project-v4-multigroup/config/certmanager/kustomizeconfig.yaml deleted file mode 100644 index cf6f89e8892..00000000000 --- a/testdata/project-v4-multigroup/config/certmanager/kustomizeconfig.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# This configuration is for teaching kustomize how to update name ref substitution -nameReference: -- kind: Issuer - group: cert-manager.io - fieldSpecs: - - kind: Certificate - group: cert-manager.io - path: spec/issuerRef/name diff --git a/testdata/project-v4-multigroup/config/crd/bases/crew.testproject.org_captains.yaml b/testdata/project-v4-multigroup/config/crd/bases/crew.testproject.org_captains.yaml deleted file mode 100644 index 2ab1cb2d245..00000000000 --- a/testdata/project-v4-multigroup/config/crd/bases/crew.testproject.org_captains.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: captains.crew.testproject.org -spec: - group: crew.testproject.org - names: - kind: Captain - listKind: CaptainList - plural: captains - singular: captain - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: Captain is the Schema for the captains API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: CaptainSpec defines the desired state of Captain - properties: - foo: - description: Foo is an example field of Captain. Edit captain_types.go - to remove/update - type: string - type: object - status: - description: CaptainStatus defines the observed state of Captain - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/testdata/project-v4-multigroup/config/crd/bases/fiz.testproject.org_bars.yaml b/testdata/project-v4-multigroup/config/crd/bases/fiz.testproject.org_bars.yaml deleted file mode 100644 index 855dd675155..00000000000 --- a/testdata/project-v4-multigroup/config/crd/bases/fiz.testproject.org_bars.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: bars.fiz.testproject.org -spec: - group: fiz.testproject.org - names: - kind: Bar - listKind: BarList - plural: bars - singular: bar - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: Bar is the Schema for the bars API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: BarSpec defines the desired state of Bar - properties: - foo: - description: Foo is an example field of Bar. Edit bar_types.go to - remove/update - type: string - type: object - status: - description: BarStatus defines the observed state of Bar - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/testdata/project-v4-multigroup/config/crd/bases/foo.policy.testproject.org_healthcheckpolicies.yaml b/testdata/project-v4-multigroup/config/crd/bases/foo.policy.testproject.org_healthcheckpolicies.yaml deleted file mode 100644 index c204a63d53a..00000000000 --- a/testdata/project-v4-multigroup/config/crd/bases/foo.policy.testproject.org_healthcheckpolicies.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: healthcheckpolicies.foo.policy.testproject.org -spec: - group: foo.policy.testproject.org - names: - kind: HealthCheckPolicy - listKind: HealthCheckPolicyList - plural: healthcheckpolicies - singular: healthcheckpolicy - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: HealthCheckPolicy is the Schema for the healthcheckpolicies API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: HealthCheckPolicySpec defines the desired state of HealthCheckPolicy - properties: - foo: - description: Foo is an example field of HealthCheckPolicy. Edit healthcheckpolicy_types.go - to remove/update - type: string - type: object - status: - description: HealthCheckPolicyStatus defines the observed state of HealthCheckPolicy - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/testdata/project-v4-multigroup/config/crd/bases/foo.testproject.org_bars.yaml b/testdata/project-v4-multigroup/config/crd/bases/foo.testproject.org_bars.yaml deleted file mode 100644 index 43b4ce46ec6..00000000000 --- a/testdata/project-v4-multigroup/config/crd/bases/foo.testproject.org_bars.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: bars.foo.testproject.org -spec: - group: foo.testproject.org - names: - kind: Bar - listKind: BarList - plural: bars - singular: bar - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: Bar is the Schema for the bars API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: BarSpec defines the desired state of Bar - properties: - foo: - description: Foo is an example field of Bar. Edit bar_types.go to - remove/update - type: string - type: object - status: - description: BarStatus defines the observed state of Bar - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/testdata/project-v4-multigroup/config/crd/bases/sea-creatures.testproject.org_krakens.yaml b/testdata/project-v4-multigroup/config/crd/bases/sea-creatures.testproject.org_krakens.yaml deleted file mode 100644 index 0d545eec558..00000000000 --- a/testdata/project-v4-multigroup/config/crd/bases/sea-creatures.testproject.org_krakens.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: krakens.sea-creatures.testproject.org -spec: - group: sea-creatures.testproject.org - names: - kind: Kraken - listKind: KrakenList - plural: krakens - singular: kraken - scope: Namespaced - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - description: Kraken is the Schema for the krakens API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: KrakenSpec defines the desired state of Kraken - properties: - foo: - description: Foo is an example field of Kraken. Edit kraken_types.go - to remove/update - type: string - type: object - status: - description: KrakenStatus defines the observed state of Kraken - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/testdata/project-v4-multigroup/config/crd/bases/sea-creatures.testproject.org_leviathans.yaml b/testdata/project-v4-multigroup/config/crd/bases/sea-creatures.testproject.org_leviathans.yaml deleted file mode 100644 index 1aeb6655fe6..00000000000 --- a/testdata/project-v4-multigroup/config/crd/bases/sea-creatures.testproject.org_leviathans.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: leviathans.sea-creatures.testproject.org -spec: - group: sea-creatures.testproject.org - names: - kind: Leviathan - listKind: LeviathanList - plural: leviathans - singular: leviathan - scope: Namespaced - versions: - - name: v1beta2 - schema: - openAPIV3Schema: - description: Leviathan is the Schema for the leviathans API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: LeviathanSpec defines the desired state of Leviathan - properties: - foo: - description: Foo is an example field of Leviathan. Edit leviathan_types.go - to remove/update - type: string - type: object - status: - description: LeviathanStatus defines the observed state of Leviathan - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/testdata/project-v4-multigroup/config/crd/bases/ship.testproject.org_cruisers.yaml b/testdata/project-v4-multigroup/config/crd/bases/ship.testproject.org_cruisers.yaml deleted file mode 100644 index b6ac9d4c51f..00000000000 --- a/testdata/project-v4-multigroup/config/crd/bases/ship.testproject.org_cruisers.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: cruisers.ship.testproject.org -spec: - group: ship.testproject.org - names: - kind: Cruiser - listKind: CruiserList - plural: cruisers - singular: cruiser - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: Cruiser is the Schema for the cruisers API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: CruiserSpec defines the desired state of Cruiser - properties: - foo: - description: Foo is an example field of Cruiser. Edit cruiser_types.go - to remove/update - type: string - type: object - status: - description: CruiserStatus defines the observed state of Cruiser - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/testdata/project-v4-multigroup/config/crd/bases/ship.testproject.org_destroyers.yaml b/testdata/project-v4-multigroup/config/crd/bases/ship.testproject.org_destroyers.yaml deleted file mode 100644 index 5e3ed99f1b2..00000000000 --- a/testdata/project-v4-multigroup/config/crd/bases/ship.testproject.org_destroyers.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: destroyers.ship.testproject.org -spec: - group: ship.testproject.org - names: - kind: Destroyer - listKind: DestroyerList - plural: destroyers - singular: destroyer - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - description: Destroyer is the Schema for the destroyers API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: DestroyerSpec defines the desired state of Destroyer - properties: - foo: - description: Foo is an example field of Destroyer. Edit destroyer_types.go - to remove/update - type: string - type: object - status: - description: DestroyerStatus defines the observed state of Destroyer - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/testdata/project-v4-multigroup/config/crd/bases/ship.testproject.org_frigates.yaml b/testdata/project-v4-multigroup/config/crd/bases/ship.testproject.org_frigates.yaml deleted file mode 100644 index 186e5a1db21..00000000000 --- a/testdata/project-v4-multigroup/config/crd/bases/ship.testproject.org_frigates.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: frigates.ship.testproject.org -spec: - group: ship.testproject.org - names: - kind: Frigate - listKind: FrigateList - plural: frigates - singular: frigate - scope: Namespaced - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - description: Frigate is the Schema for the frigates API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: FrigateSpec defines the desired state of Frigate - properties: - foo: - description: Foo is an example field of Frigate. Edit frigate_types.go - to remove/update - type: string - type: object - status: - description: FrigateStatus defines the observed state of Frigate - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/testdata/project-v4-multigroup/config/crd/bases/testproject.org_lakers.yaml b/testdata/project-v4-multigroup/config/crd/bases/testproject.org_lakers.yaml deleted file mode 100644 index d32f08f0119..00000000000 --- a/testdata/project-v4-multigroup/config/crd/bases/testproject.org_lakers.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: lakers.testproject.org -spec: - group: testproject.org - names: - kind: Lakers - listKind: LakersList - plural: lakers - singular: lakers - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: Lakers is the Schema for the lakers API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: LakersSpec defines the desired state of Lakers - properties: - foo: - description: Foo is an example field of Lakers. Edit lakers_types.go - to remove/update - type: string - type: object - status: - description: LakersStatus defines the observed state of Lakers - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/testdata/project-v4-multigroup/config/crd/kustomization.yaml b/testdata/project-v4-multigroup/config/crd/kustomization.yaml deleted file mode 100644 index c9e3a747c5e..00000000000 --- a/testdata/project-v4-multigroup/config/crd/kustomization.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# This kustomization.yaml is not intended to be run by itself, -# since it depends on service name and namespace that are out of this kustomize package. -# It should be run by config/default -resources: -- bases/crew.testproject.org_captains.yaml -- bases/ship.testproject.org_frigates.yaml -- bases/ship.testproject.org_destroyers.yaml -- bases/ship.testproject.org_cruisers.yaml -- bases/sea-creatures.testproject.org_krakens.yaml -- bases/sea-creatures.testproject.org_leviathans.yaml -- bases/foo.policy.testproject.org_healthcheckpolicies.yaml -- bases/foo.testproject.org_bars.yaml -- bases/fiz.testproject.org_bars.yaml -- bases/testproject.org_lakers.yaml -# +kubebuilder:scaffold:crdkustomizeresource - -patches: -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. -# patches here are for enabling the conversion webhook for each CRD -- path: patches/webhook_in_crew_captains.yaml -- path: patches/webhook_in_ship_frigates.yaml -- path: patches/webhook_in_ship_destroyers.yaml -- path: patches/webhook_in_ship_cruisers.yaml -- path: patches/webhook_in_lakers.yaml -# +kubebuilder:scaffold:crdkustomizewebhookpatch - -# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. -# patches here are for enabling the CA injection for each CRD -#- path: patches/cainjection_in_crew_captains.yaml -#- path: patches/cainjection_in_ship_frigates.yaml -#- path: patches/cainjection_in_ship_destroyers.yaml -#- path: patches/cainjection_in_ship_cruisers.yaml -#- path: patches/cainjection_in_sea-creatures_krakens.yaml -#- path: patches/cainjection_in_sea-creatures_leviathans.yaml -#- path: patches/cainjection_in_foo.policy_healthcheckpolicies.yaml -#- path: patches/cainjection_in_foo_bars.yaml -#- path: patches/cainjection_in_fiz_bars.yaml -#- path: patches/cainjection_in_lakers.yaml -# +kubebuilder:scaffold:crdkustomizecainjectionpatch - -# [WEBHOOK] To enable webhook, uncomment the following section -# the following config is for teaching kustomize how to do kustomization for CRDs. - -configurations: -- kustomizeconfig.yaml diff --git a/testdata/project-v4-multigroup/config/crd/kustomizeconfig.yaml b/testdata/project-v4-multigroup/config/crd/kustomizeconfig.yaml deleted file mode 100644 index ec5c150a9df..00000000000 --- a/testdata/project-v4-multigroup/config/crd/kustomizeconfig.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# This file is for teaching kustomize how to substitute name and namespace reference in CRD -nameReference: -- kind: Service - version: v1 - fieldSpecs: - - kind: CustomResourceDefinition - version: v1 - group: apiextensions.k8s.io - path: spec/conversion/webhook/clientConfig/service/name - -namespace: -- kind: CustomResourceDefinition - version: v1 - group: apiextensions.k8s.io - path: spec/conversion/webhook/clientConfig/service/namespace - create: false - -varReference: -- path: metadata/annotations diff --git a/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_crew_captains.yaml b/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_crew_captains.yaml deleted file mode 100644 index fba0c3ed6fd..00000000000 --- a/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_crew_captains.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# The following patch adds a directive for certmanager to inject CA into the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME - name: captains.crew.testproject.org diff --git a/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_lakers.yaml b/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_lakers.yaml deleted file mode 100644 index 90be9dfc598..00000000000 --- a/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_lakers.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# The following patch adds a directive for certmanager to inject CA into the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME - name: lakers.testproject.org diff --git a/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_ship_cruisers.yaml b/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_ship_cruisers.yaml deleted file mode 100644 index 0d31cb0b8af..00000000000 --- a/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_ship_cruisers.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# The following patch adds a directive for certmanager to inject CA into the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME - name: cruisers.ship.testproject.org diff --git a/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_ship_destroyers.yaml b/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_ship_destroyers.yaml deleted file mode 100644 index 865395574ff..00000000000 --- a/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_ship_destroyers.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# The following patch adds a directive for certmanager to inject CA into the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME - name: destroyers.ship.testproject.org diff --git a/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_ship_frigates.yaml b/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_ship_frigates.yaml deleted file mode 100644 index d4acb9d24c1..00000000000 --- a/testdata/project-v4-multigroup/config/crd/patches/cainjection_in_ship_frigates.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# The following patch adds a directive for certmanager to inject CA into the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME - name: frigates.ship.testproject.org diff --git a/testdata/project-v4-multigroup/config/crd/patches/webhook_in_crew_captains.yaml b/testdata/project-v4-multigroup/config/crd/patches/webhook_in_crew_captains.yaml deleted file mode 100644 index f73ae2e8abc..00000000000 --- a/testdata/project-v4-multigroup/config/crd/patches/webhook_in_crew_captains.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# The following patch enables a conversion webhook for the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: captains.crew.testproject.org -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - namespace: system - name: webhook-service - path: /convert - conversionReviewVersions: - - v1 diff --git a/testdata/project-v4-multigroup/config/crd/patches/webhook_in_lakers.yaml b/testdata/project-v4-multigroup/config/crd/patches/webhook_in_lakers.yaml deleted file mode 100644 index 58df2264dde..00000000000 --- a/testdata/project-v4-multigroup/config/crd/patches/webhook_in_lakers.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# The following patch enables a conversion webhook for the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: lakers.testproject.org -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - namespace: system - name: webhook-service - path: /convert - conversionReviewVersions: - - v1 diff --git a/testdata/project-v4-multigroup/config/crd/patches/webhook_in_ship_cruisers.yaml b/testdata/project-v4-multigroup/config/crd/patches/webhook_in_ship_cruisers.yaml deleted file mode 100644 index 99b6b6741b6..00000000000 --- a/testdata/project-v4-multigroup/config/crd/patches/webhook_in_ship_cruisers.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# The following patch enables a conversion webhook for the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: cruisers.ship.testproject.org -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - namespace: system - name: webhook-service - path: /convert - conversionReviewVersions: - - v1 diff --git a/testdata/project-v4-multigroup/config/crd/patches/webhook_in_ship_destroyers.yaml b/testdata/project-v4-multigroup/config/crd/patches/webhook_in_ship_destroyers.yaml deleted file mode 100644 index 0e0095cb3a6..00000000000 --- a/testdata/project-v4-multigroup/config/crd/patches/webhook_in_ship_destroyers.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# The following patch enables a conversion webhook for the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: destroyers.ship.testproject.org -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - namespace: system - name: webhook-service - path: /convert - conversionReviewVersions: - - v1 diff --git a/testdata/project-v4-multigroup/config/crd/patches/webhook_in_ship_frigates.yaml b/testdata/project-v4-multigroup/config/crd/patches/webhook_in_ship_frigates.yaml deleted file mode 100644 index cdc5078ae71..00000000000 --- a/testdata/project-v4-multigroup/config/crd/patches/webhook_in_ship_frigates.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# The following patch enables a conversion webhook for the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: frigates.ship.testproject.org -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - namespace: system - name: webhook-service - path: /convert - conversionReviewVersions: - - v1 diff --git a/testdata/project-v4-multigroup/config/default/manager_metrics_patch.yaml b/testdata/project-v4-multigroup/config/default/manager_metrics_patch.yaml deleted file mode 100644 index 2aaef6536f4..00000000000 --- a/testdata/project-v4-multigroup/config/default/manager_metrics_patch.yaml +++ /dev/null @@ -1,4 +0,0 @@ -# This patch adds the args to allow exposing the metrics endpoint using HTTPS -- op: add - path: /spec/template/spec/containers/0/args/0 - value: --metrics-bind-address=:8443 diff --git a/testdata/project-v4-multigroup/config/default/manager_webhook_patch.yaml b/testdata/project-v4-multigroup/config/default/manager_webhook_patch.yaml deleted file mode 100644 index 9fd690c819f..00000000000 --- a/testdata/project-v4-multigroup/config/default/manager_webhook_patch.yaml +++ /dev/null @@ -1,26 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: controller-manager - namespace: system - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize -spec: - template: - spec: - containers: - - name: manager - ports: - - containerPort: 9443 - name: webhook-server - protocol: TCP - volumeMounts: - - mountPath: /tmp/k8s-webhook-server/serving-certs - name: cert - readOnly: true - volumes: - - name: cert - secret: - defaultMode: 420 - secretName: webhook-server-cert diff --git a/testdata/project-v4-multigroup/config/default/metrics_service.yaml b/testdata/project-v4-multigroup/config/default/metrics_service.yaml deleted file mode 100644 index afd67bb43af..00000000000 --- a/testdata/project-v4-multigroup/config/default/metrics_service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - control-plane: controller-manager - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: controller-manager-metrics-service - namespace: system -spec: - ports: - - name: https - port: 8443 - protocol: TCP - targetPort: 8443 - selector: - control-plane: controller-manager diff --git a/testdata/project-v4-multigroup/config/default/webhookcainjection_patch.yaml b/testdata/project-v4-multigroup/config/default/webhookcainjection_patch.yaml deleted file mode 100644 index 5a278ed6e95..00000000000 --- a/testdata/project-v4-multigroup/config/default/webhookcainjection_patch.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# This patch add annotation to admission webhook config and -# CERTIFICATE_NAMESPACE and CERTIFICATE_NAME will be substituted by kustomize -apiVersion: admissionregistration.k8s.io/v1 -kind: MutatingWebhookConfiguration -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: mutating-webhook-configuration - annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME ---- -apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - labels: - app.kubernetes.io/name: validatingwebhookconfiguration - app.kubernetes.io/instance: validating-webhook-configuration - app.kubernetes.io/component: webhook - app.kubernetes.io/created-by: project-v4-multigroup - app.kubernetes.io/part-of: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: validating-webhook-configuration - annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME diff --git a/testdata/project-v4-multigroup/config/manager/kustomization.yaml b/testdata/project-v4-multigroup/config/manager/kustomization.yaml deleted file mode 100644 index ad13e96b3fc..00000000000 --- a/testdata/project-v4-multigroup/config/manager/kustomization.yaml +++ /dev/null @@ -1,8 +0,0 @@ -resources: -- manager.yaml -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -images: -- name: controller - newName: controller - newTag: latest diff --git a/testdata/project-v4-multigroup/config/manager/manager.yaml b/testdata/project-v4-multigroup/config/manager/manager.yaml deleted file mode 100644 index 3691f15c77e..00000000000 --- a/testdata/project-v4-multigroup/config/manager/manager.yaml +++ /dev/null @@ -1,95 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - labels: - control-plane: controller-manager - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: system ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: controller-manager - namespace: system - labels: - control-plane: controller-manager - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize -spec: - selector: - matchLabels: - control-plane: controller-manager - replicas: 1 - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: manager - labels: - control-plane: controller-manager - spec: - # TODO(user): Uncomment the following code to configure the nodeAffinity expression - # according to the platforms which are supported by your solution. - # It is considered best practice to support multiple architectures. You can - # build your manager image using the makefile target docker-buildx. - # affinity: - # nodeAffinity: - # requiredDuringSchedulingIgnoredDuringExecution: - # nodeSelectorTerms: - # - matchExpressions: - # - key: kubernetes.io/arch - # operator: In - # values: - # - amd64 - # - arm64 - # - ppc64le - # - s390x - # - key: kubernetes.io/os - # operator: In - # values: - # - linux - securityContext: - runAsNonRoot: true - # TODO(user): For common cases that do not require escalating privileges - # it is recommended to ensure that all your Pods/Containers are restrictive. - # More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted - # Please uncomment the following code if your project does NOT have to work on old Kubernetes - # versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ). - # seccompProfile: - # type: RuntimeDefault - containers: - - command: - - /manager - args: - - --leader-elect - - --health-probe-bind-address=:8081 - image: controller:latest - name: manager - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - "ALL" - livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - # TODO(user): Configure the resources accordingly based on the project requirements. - # More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - serviceAccountName: controller-manager - terminationGracePeriodSeconds: 10 diff --git a/testdata/project-v4-multigroup/config/network-policy/kustomization.yaml b/testdata/project-v4-multigroup/config/network-policy/kustomization.yaml deleted file mode 100644 index 0872bee124c..00000000000 --- a/testdata/project-v4-multigroup/config/network-policy/kustomization.yaml +++ /dev/null @@ -1,3 +0,0 @@ -resources: -- allow-webhook-traffic.yaml -- allow-metrics-traffic.yaml diff --git a/testdata/project-v4-multigroup/config/prometheus/kustomization.yaml b/testdata/project-v4-multigroup/config/prometheus/kustomization.yaml deleted file mode 100644 index ed137168a1d..00000000000 --- a/testdata/project-v4-multigroup/config/prometheus/kustomization.yaml +++ /dev/null @@ -1,2 +0,0 @@ -resources: -- monitor.yaml diff --git a/testdata/project-v4-multigroup/config/rbac/fiz_bar_editor_role.yaml b/testdata/project-v4-multigroup/config/rbac/fiz_bar_editor_role.yaml deleted file mode 100644 index 6ce5d8f2ef9..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/fiz_bar_editor_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to edit bars. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: fiz-bar-editor-role -rules: -- apiGroups: - - fiz.testproject.org - resources: - - bars - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - fiz.testproject.org - resources: - - bars/status - verbs: - - get diff --git a/testdata/project-v4-multigroup/config/rbac/foo.policy_healthcheckpolicy_viewer_role.yaml b/testdata/project-v4-multigroup/config/rbac/foo.policy_healthcheckpolicy_viewer_role.yaml deleted file mode 100644 index dff3ea7abc0..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/foo.policy_healthcheckpolicy_viewer_role.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# permissions for end users to view healthcheckpolicies. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: foo.policy-healthcheckpolicy-viewer-role -rules: -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies - verbs: - - get - - list - - watch -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies/status - verbs: - - get diff --git a/testdata/project-v4-multigroup/config/rbac/foo_bar_viewer_role.yaml b/testdata/project-v4-multigroup/config/rbac/foo_bar_viewer_role.yaml deleted file mode 100644 index eabf9ee517b..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/foo_bar_viewer_role.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# permissions for end users to view bars. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: foo-bar-viewer-role -rules: -- apiGroups: - - foo.testproject.org - resources: - - bars - verbs: - - get - - list - - watch -- apiGroups: - - foo.testproject.org - resources: - - bars/status - verbs: - - get diff --git a/testdata/project-v4-multigroup/config/rbac/kustomization.yaml b/testdata/project-v4-multigroup/config/rbac/kustomization.yaml deleted file mode 100644 index 5bdd66e47ff..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/kustomization.yaml +++ /dev/null @@ -1,45 +0,0 @@ -resources: -# All RBAC will be applied under this service account in -# the deployment namespace. You may comment out this resource -# if your manager will use a service account that exists at -# runtime. Be sure to update RoleBinding and ClusterRoleBinding -# subjects if changing service account names. -- service_account.yaml -- role.yaml -- role_binding.yaml -- leader_election_role.yaml -- leader_election_role_binding.yaml -# The following RBAC configurations are used to protect -# the metrics endpoint with authn/authz. These configurations -# ensure that only authorized users and service accounts -# can access the metrics endpoint. Comment the following -# permissions if you want to disable this protection. -# More info: https://book.kubebuilder.io/reference/metrics.html -- metrics_auth_role.yaml -- metrics_auth_role_binding.yaml -- metrics_reader_role.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 -# if you do not want those helpers be installed with your Project. -- lakers_editor_role.yaml -- lakers_viewer_role.yaml -- fiz_bar_editor_role.yaml -- fiz_bar_viewer_role.yaml -- foo_bar_editor_role.yaml -- foo_bar_viewer_role.yaml -- foo.policy_healthcheckpolicy_editor_role.yaml -- foo.policy_healthcheckpolicy_viewer_role.yaml -- sea-creatures_leviathan_editor_role.yaml -- sea-creatures_leviathan_viewer_role.yaml -- sea-creatures_kraken_editor_role.yaml -- sea-creatures_kraken_viewer_role.yaml -- ship_cruiser_editor_role.yaml -- ship_cruiser_viewer_role.yaml -- ship_destroyer_editor_role.yaml -- ship_destroyer_viewer_role.yaml -- ship_frigate_editor_role.yaml -- ship_frigate_viewer_role.yaml -- crew_captain_editor_role.yaml -- crew_captain_viewer_role.yaml - diff --git a/testdata/project-v4-multigroup/config/rbac/leader_election_role.yaml b/testdata/project-v4-multigroup/config/rbac/leader_election_role.yaml deleted file mode 100644 index 14015b3499d..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/leader_election_role.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# permissions to do leader election. -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: leader-election-role -rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch diff --git a/testdata/project-v4-multigroup/config/rbac/leader_election_role_binding.yaml b/testdata/project-v4-multigroup/config/rbac/leader_election_role_binding.yaml deleted file mode 100644 index 7af36fa2d81..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/leader_election_role_binding.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: leader-election-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: leader-election-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/testdata/project-v4-multigroup/config/rbac/metrics_auth_role.yaml b/testdata/project-v4-multigroup/config/rbac/metrics_auth_role.yaml deleted file mode 100644 index 32d2e4ec6b0..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/metrics_auth_role.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: metrics-auth-role -rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create diff --git a/testdata/project-v4-multigroup/config/rbac/metrics_auth_role_binding.yaml b/testdata/project-v4-multigroup/config/rbac/metrics_auth_role_binding.yaml deleted file mode 100644 index e775d67ff08..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/metrics_auth_role_binding.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: metrics-auth-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: metrics-auth-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/testdata/project-v4-multigroup/config/rbac/metrics_reader_role.yaml b/testdata/project-v4-multigroup/config/rbac/metrics_reader_role.yaml deleted file mode 100644 index 51a75db47a5..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/metrics_reader_role.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: metrics-reader -rules: -- nonResourceURLs: - - "/metrics" - verbs: - - get diff --git a/testdata/project-v4-multigroup/config/rbac/role.yaml b/testdata/project-v4-multigroup/config/rbac/role.yaml deleted file mode 100644 index b3e54a59959..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/role.yaml +++ /dev/null @@ -1,200 +0,0 @@ ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: manager-role -rules: -- apiGroups: - - apps - resources: - - deployments - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - apps - resources: - - deployments/finalizers - verbs: - - update -- apiGroups: - - apps - resources: - - deployments/status - verbs: - - get - - patch - - update -- apiGroups: - - crew.testproject.org - resources: - - captains - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - crew.testproject.org - resources: - - captains/finalizers - verbs: - - update -- apiGroups: - - crew.testproject.org - resources: - - captains/status - verbs: - - get - - patch - - update -- apiGroups: - - fiz.testproject.org - - foo.testproject.org - resources: - - bars - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - fiz.testproject.org - - foo.testproject.org - resources: - - bars/finalizers - verbs: - - update -- apiGroups: - - fiz.testproject.org - - foo.testproject.org - resources: - - bars/status - verbs: - - get - - patch - - update -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies/finalizers - verbs: - - update -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies/status - verbs: - - get - - patch - - update -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens - - leviathans - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens/finalizers - - leviathans/finalizers - verbs: - - update -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens/status - - leviathans/status - verbs: - - get - - patch - - update -- apiGroups: - - ship.testproject.org - resources: - - cruisers - - destroyers - - frigates - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - ship.testproject.org - resources: - - cruisers/finalizers - - destroyers/finalizers - - frigates/finalizers - verbs: - - update -- apiGroups: - - ship.testproject.org - resources: - - cruisers/status - - destroyers/status - - frigates/status - verbs: - - get - - patch - - update -- apiGroups: - - testproject.org - resources: - - lakers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - testproject.org - resources: - - lakers/finalizers - verbs: - - update -- apiGroups: - - testproject.org - resources: - - lakers/status - verbs: - - get - - patch - - update diff --git a/testdata/project-v4-multigroup/config/rbac/role_binding.yaml b/testdata/project-v4-multigroup/config/rbac/role_binding.yaml deleted file mode 100644 index ae53b6529da..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/role_binding.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: manager-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/testdata/project-v4-multigroup/config/rbac/sea-creatures_kraken_editor_role.yaml b/testdata/project-v4-multigroup/config/rbac/sea-creatures_kraken_editor_role.yaml deleted file mode 100644 index 1d372dccf66..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/sea-creatures_kraken_editor_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to edit krakens. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: sea-creatures-kraken-editor-role -rules: -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens/status - verbs: - - get diff --git a/testdata/project-v4-multigroup/config/rbac/sea-creatures_kraken_viewer_role.yaml b/testdata/project-v4-multigroup/config/rbac/sea-creatures_kraken_viewer_role.yaml deleted file mode 100644 index a65c4916546..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/sea-creatures_kraken_viewer_role.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# permissions for end users to view krakens. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: sea-creatures-kraken-viewer-role -rules: -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens - verbs: - - get - - list - - watch -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens/status - verbs: - - get diff --git a/testdata/project-v4-multigroup/config/rbac/sea-creatures_leviathan_editor_role.yaml b/testdata/project-v4-multigroup/config/rbac/sea-creatures_leviathan_editor_role.yaml deleted file mode 100644 index 77d2ff19c22..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/sea-creatures_leviathan_editor_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to edit leviathans. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: sea-creatures-leviathan-editor-role -rules: -- apiGroups: - - sea-creatures.testproject.org - resources: - - leviathans - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - sea-creatures.testproject.org - resources: - - leviathans/status - verbs: - - get diff --git a/testdata/project-v4-multigroup/config/rbac/service_account.yaml b/testdata/project-v4-multigroup/config/rbac/service_account.yaml deleted file mode 100644 index 25d4288f404..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/service_account.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: controller-manager - namespace: system diff --git a/testdata/project-v4-multigroup/config/rbac/ship_cruiser_editor_role.yaml b/testdata/project-v4-multigroup/config/rbac/ship_cruiser_editor_role.yaml deleted file mode 100644 index 32a0bcaf91e..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/ship_cruiser_editor_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to edit cruisers. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: ship-cruiser-editor-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - cruisers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - ship.testproject.org - resources: - - cruisers/status - verbs: - - get diff --git a/testdata/project-v4-multigroup/config/rbac/ship_cruiser_viewer_role.yaml b/testdata/project-v4-multigroup/config/rbac/ship_cruiser_viewer_role.yaml deleted file mode 100644 index 287ffcc397a..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/ship_cruiser_viewer_role.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# permissions for end users to view cruisers. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: ship-cruiser-viewer-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - cruisers - verbs: - - get - - list - - watch -- apiGroups: - - ship.testproject.org - resources: - - cruisers/status - verbs: - - get diff --git a/testdata/project-v4-multigroup/config/rbac/ship_frigate_viewer_role.yaml b/testdata/project-v4-multigroup/config/rbac/ship_frigate_viewer_role.yaml deleted file mode 100644 index f8d54802480..00000000000 --- a/testdata/project-v4-multigroup/config/rbac/ship_frigate_viewer_role.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# permissions for end users to view frigates. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: ship-frigate-viewer-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - frigates - verbs: - - get - - list - - watch -- apiGroups: - - ship.testproject.org - resources: - - frigates/status - verbs: - - get diff --git a/testdata/project-v4-multigroup/config/samples/foo.policy_v1_healthcheckpolicy.yaml b/testdata/project-v4-multigroup/config/samples/foo.policy_v1_healthcheckpolicy.yaml deleted file mode 100644 index 945fe8b48ad..00000000000 --- a/testdata/project-v4-multigroup/config/samples/foo.policy_v1_healthcheckpolicy.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: foo.policy.testproject.org/v1 -kind: HealthCheckPolicy -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: healthcheckpolicy-sample -spec: - # TODO(user): Add fields here diff --git a/testdata/project-v4-multigroup/config/samples/foo_v1_bar.yaml b/testdata/project-v4-multigroup/config/samples/foo_v1_bar.yaml deleted file mode 100644 index 6de418e33d7..00000000000 --- a/testdata/project-v4-multigroup/config/samples/foo_v1_bar.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: foo.testproject.org/v1 -kind: Bar -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: bar-sample -spec: - # TODO(user): Add fields here diff --git a/testdata/project-v4-multigroup/config/samples/kustomization.yaml b/testdata/project-v4-multigroup/config/samples/kustomization.yaml deleted file mode 100644 index f5e9802fed3..00000000000 --- a/testdata/project-v4-multigroup/config/samples/kustomization.yaml +++ /dev/null @@ -1,13 +0,0 @@ -## Append samples of your project ## -resources: -- crew_v1_captain.yaml -- ship_v1beta1_frigate.yaml -- ship_v1_destroyer.yaml -- ship_v2alpha1_cruiser.yaml -- sea-creatures_v1beta1_kraken.yaml -- sea-creatures_v1beta2_leviathan.yaml -- foo.policy_v1_healthcheckpolicy.yaml -- foo_v1_bar.yaml -- fiz_v1_bar.yaml -- v1_lakers.yaml -# +kubebuilder:scaffold:manifestskustomizesamples diff --git a/testdata/project-v4-multigroup/config/samples/sea-creatures_v1beta1_kraken.yaml b/testdata/project-v4-multigroup/config/samples/sea-creatures_v1beta1_kraken.yaml deleted file mode 100644 index 0e0453d7c80..00000000000 --- a/testdata/project-v4-multigroup/config/samples/sea-creatures_v1beta1_kraken.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: sea-creatures.testproject.org/v1beta1 -kind: Kraken -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: kraken-sample -spec: - # TODO(user): Add fields here diff --git a/testdata/project-v4-multigroup/config/samples/sea-creatures_v1beta2_leviathan.yaml b/testdata/project-v4-multigroup/config/samples/sea-creatures_v1beta2_leviathan.yaml deleted file mode 100644 index 5d2125ed9b7..00000000000 --- a/testdata/project-v4-multigroup/config/samples/sea-creatures_v1beta2_leviathan.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: sea-creatures.testproject.org/v1beta2 -kind: Leviathan -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: leviathan-sample -spec: - # TODO(user): Add fields here diff --git a/testdata/project-v4-multigroup/config/samples/ship_v1_destroyer.yaml b/testdata/project-v4-multigroup/config/samples/ship_v1_destroyer.yaml deleted file mode 100644 index 946dee59890..00000000000 --- a/testdata/project-v4-multigroup/config/samples/ship_v1_destroyer.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: ship.testproject.org/v1 -kind: Destroyer -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: destroyer-sample -spec: - # TODO(user): Add fields here diff --git a/testdata/project-v4-multigroup/config/samples/ship_v1beta1_frigate.yaml b/testdata/project-v4-multigroup/config/samples/ship_v1beta1_frigate.yaml deleted file mode 100644 index b758b075bcf..00000000000 --- a/testdata/project-v4-multigroup/config/samples/ship_v1beta1_frigate.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: ship.testproject.org/v1beta1 -kind: Frigate -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: frigate-sample -spec: - # TODO(user): Add fields here diff --git a/testdata/project-v4-multigroup/config/samples/ship_v2alpha1_cruiser.yaml b/testdata/project-v4-multigroup/config/samples/ship_v2alpha1_cruiser.yaml deleted file mode 100644 index 58d0c89226b..00000000000 --- a/testdata/project-v4-multigroup/config/samples/ship_v2alpha1_cruiser.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: ship.testproject.org/v2alpha1 -kind: Cruiser -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: cruiser-sample -spec: - # TODO(user): Add fields here diff --git a/testdata/project-v4-multigroup/config/samples/v1_lakers.yaml b/testdata/project-v4-multigroup/config/samples/v1_lakers.yaml deleted file mode 100644 index 50825eb1a12..00000000000 --- a/testdata/project-v4-multigroup/config/samples/v1_lakers.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: testproject.org/v1 -kind: Lakers -metadata: - labels: - app.kubernetes.io/name: project-v4-multigroup - app.kubernetes.io/managed-by: kustomize - name: lakers-sample -spec: - # TODO(user): Add fields here diff --git a/testdata/project-v4-multigroup/config/webhook/kustomization.yaml b/testdata/project-v4-multigroup/config/webhook/kustomization.yaml deleted file mode 100644 index 9cf26134e4d..00000000000 --- a/testdata/project-v4-multigroup/config/webhook/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -resources: -- manifests.yaml -- service.yaml - -configurations: -- kustomizeconfig.yaml diff --git a/testdata/project-v4-multigroup/config/webhook/kustomizeconfig.yaml b/testdata/project-v4-multigroup/config/webhook/kustomizeconfig.yaml deleted file mode 100644 index 206316e54ff..00000000000 --- a/testdata/project-v4-multigroup/config/webhook/kustomizeconfig.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# the following config is for teaching kustomize where to look at when substituting nameReference. -# It requires kustomize v2.1.0 or newer to work properly. -nameReference: -- kind: Service - version: v1 - fieldSpecs: - - kind: MutatingWebhookConfiguration - group: admissionregistration.k8s.io - path: webhooks/clientConfig/service/name - - kind: ValidatingWebhookConfiguration - group: admissionregistration.k8s.io - path: webhooks/clientConfig/service/name - -namespace: -- kind: MutatingWebhookConfiguration - group: admissionregistration.k8s.io - path: webhooks/clientConfig/service/namespace - create: true -- kind: ValidatingWebhookConfiguration - group: admissionregistration.k8s.io - path: webhooks/clientConfig/service/namespace - create: true diff --git a/testdata/project-v4-multigroup/config/webhook/manifests.yaml b/testdata/project-v4-multigroup/config/webhook/manifests.yaml deleted file mode 100644 index 62374002227..00000000000 --- a/testdata/project-v4-multigroup/config/webhook/manifests.yaml +++ /dev/null @@ -1,132 +0,0 @@ ---- -apiVersion: admissionregistration.k8s.io/v1 -kind: MutatingWebhookConfiguration -metadata: - name: mutating-webhook-configuration -webhooks: -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: webhook-service - namespace: system - path: /mutate-crew-testproject-org-v1-captain - failurePolicy: Fail - name: mcaptain.kb.io - rules: - - apiGroups: - - crew.testproject.org - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - captains - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: webhook-service - namespace: system - path: /mutate-ship-testproject-org-v1-destroyer - failurePolicy: Fail - name: mdestroyer.kb.io - rules: - - apiGroups: - - ship.testproject.org - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - destroyers - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: webhook-service - namespace: system - path: /mutate-testproject-org-v1-lakers - failurePolicy: Fail - name: mlakers.kb.io - rules: - - apiGroups: - - testproject.org - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - lakers - sideEffects: None ---- -apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - name: validating-webhook-configuration -webhooks: -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: webhook-service - namespace: system - path: /validate-crew-testproject-org-v1-captain - failurePolicy: Fail - name: vcaptain.kb.io - rules: - - apiGroups: - - crew.testproject.org - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - captains - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: webhook-service - namespace: system - path: /validate-ship-testproject-org-v2alpha1-cruiser - failurePolicy: Fail - name: vcruiser.kb.io - rules: - - apiGroups: - - ship.testproject.org - apiVersions: - - v2alpha1 - operations: - - CREATE - - UPDATE - resources: - - cruisers - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: webhook-service - namespace: system - path: /validate-testproject-org-v1-lakers - failurePolicy: Fail - name: vlakers.kb.io - rules: - - apiGroups: - - testproject.org - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - lakers - sideEffects: None diff --git a/testdata/project-v4-multigroup/dist/install.yaml b/testdata/project-v4-multigroup/dist/install.yaml deleted file mode 100644 index 49140f38c55..00000000000 --- a/testdata/project-v4-multigroup/dist/install.yaml +++ /dev/null @@ -1,1660 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - control-plane: controller-manager - name: project-v4-multigroup-system ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: bars.fiz.testproject.org -spec: - group: fiz.testproject.org - names: - kind: Bar - listKind: BarList - plural: bars - singular: bar - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: Bar is the Schema for the bars API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: BarSpec defines the desired state of Bar - properties: - foo: - description: Foo is an example field of Bar. Edit bar_types.go to - remove/update - type: string - type: object - status: - description: BarStatus defines the observed state of Bar - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: bars.foo.testproject.org -spec: - group: foo.testproject.org - names: - kind: Bar - listKind: BarList - plural: bars - singular: bar - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: Bar is the Schema for the bars API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: BarSpec defines the desired state of Bar - properties: - foo: - description: Foo is an example field of Bar. Edit bar_types.go to - remove/update - type: string - type: object - status: - description: BarStatus defines the observed state of Bar - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: captains.crew.testproject.org -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system - path: /convert - conversionReviewVersions: - - v1 - group: crew.testproject.org - names: - kind: Captain - listKind: CaptainList - plural: captains - singular: captain - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: Captain is the Schema for the captains API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: CaptainSpec defines the desired state of Captain - properties: - foo: - description: Foo is an example field of Captain. Edit captain_types.go - to remove/update - type: string - type: object - status: - description: CaptainStatus defines the observed state of Captain - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: cruisers.ship.testproject.org -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system - path: /convert - conversionReviewVersions: - - v1 - group: ship.testproject.org - names: - kind: Cruiser - listKind: CruiserList - plural: cruisers - singular: cruiser - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: Cruiser is the Schema for the cruisers API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: CruiserSpec defines the desired state of Cruiser - properties: - foo: - description: Foo is an example field of Cruiser. Edit cruiser_types.go - to remove/update - type: string - type: object - status: - description: CruiserStatus defines the observed state of Cruiser - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: destroyers.ship.testproject.org -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system - path: /convert - conversionReviewVersions: - - v1 - group: ship.testproject.org - names: - kind: Destroyer - listKind: DestroyerList - plural: destroyers - singular: destroyer - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - description: Destroyer is the Schema for the destroyers API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: DestroyerSpec defines the desired state of Destroyer - properties: - foo: - description: Foo is an example field of Destroyer. Edit destroyer_types.go - to remove/update - type: string - type: object - status: - description: DestroyerStatus defines the observed state of Destroyer - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: frigates.ship.testproject.org -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system - path: /convert - conversionReviewVersions: - - v1 - group: ship.testproject.org - names: - kind: Frigate - listKind: FrigateList - plural: frigates - singular: frigate - scope: Namespaced - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - description: Frigate is the Schema for the frigates API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: FrigateSpec defines the desired state of Frigate - properties: - foo: - description: Foo is an example field of Frigate. Edit frigate_types.go - to remove/update - type: string - type: object - status: - description: FrigateStatus defines the observed state of Frigate - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: healthcheckpolicies.foo.policy.testproject.org -spec: - group: foo.policy.testproject.org - names: - kind: HealthCheckPolicy - listKind: HealthCheckPolicyList - plural: healthcheckpolicies - singular: healthcheckpolicy - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: HealthCheckPolicy is the Schema for the healthcheckpolicies API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: HealthCheckPolicySpec defines the desired state of HealthCheckPolicy - properties: - foo: - description: Foo is an example field of HealthCheckPolicy. Edit healthcheckpolicy_types.go - to remove/update - type: string - type: object - status: - description: HealthCheckPolicyStatus defines the observed state of HealthCheckPolicy - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: krakens.sea-creatures.testproject.org -spec: - group: sea-creatures.testproject.org - names: - kind: Kraken - listKind: KrakenList - plural: krakens - singular: kraken - scope: Namespaced - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - description: Kraken is the Schema for the krakens API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: KrakenSpec defines the desired state of Kraken - properties: - foo: - description: Foo is an example field of Kraken. Edit kraken_types.go - to remove/update - type: string - type: object - status: - description: KrakenStatus defines the observed state of Kraken - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: lakers.testproject.org -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system - path: /convert - conversionReviewVersions: - - v1 - group: testproject.org - names: - kind: Lakers - listKind: LakersList - plural: lakers - singular: lakers - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: Lakers is the Schema for the lakers API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: LakersSpec defines the desired state of Lakers - properties: - foo: - description: Foo is an example field of Lakers. Edit lakers_types.go - to remove/update - type: string - type: object - status: - description: LakersStatus defines the observed state of Lakers - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: leviathans.sea-creatures.testproject.org -spec: - group: sea-creatures.testproject.org - names: - kind: Leviathan - listKind: LeviathanList - plural: leviathans - singular: leviathan - scope: Namespaced - versions: - - name: v1beta2 - schema: - openAPIV3Schema: - description: Leviathan is the Schema for the leviathans API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: LeviathanSpec defines the desired state of Leviathan - properties: - foo: - description: Foo is an example field of Leviathan. Edit leviathan_types.go - to remove/update - type: string - type: object - status: - description: LeviathanStatus defines the observed state of Leviathan - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-controller-manager - namespace: project-v4-multigroup-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-leader-election-role - namespace: project-v4-multigroup-system -rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-crew-captain-editor-role -rules: -- apiGroups: - - crew.testproject.org - resources: - - captains - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - crew.testproject.org - resources: - - captains/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-crew-captain-viewer-role -rules: -- apiGroups: - - crew.testproject.org - resources: - - captains - verbs: - - get - - list - - watch -- apiGroups: - - crew.testproject.org - resources: - - captains/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-fiz-bar-editor-role -rules: -- apiGroups: - - fiz.testproject.org - resources: - - bars - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - fiz.testproject.org - resources: - - bars/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-fiz-bar-viewer-role -rules: -- apiGroups: - - fiz.testproject.org - resources: - - bars - verbs: - - get - - list - - watch -- apiGroups: - - fiz.testproject.org - resources: - - bars/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-foo-bar-editor-role -rules: -- apiGroups: - - foo.testproject.org - resources: - - bars - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - foo.testproject.org - resources: - - bars/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-foo-bar-viewer-role -rules: -- apiGroups: - - foo.testproject.org - resources: - - bars - verbs: - - get - - list - - watch -- apiGroups: - - foo.testproject.org - resources: - - bars/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-foo.policy-healthcheckpolicy-editor-role -rules: -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-foo.policy-healthcheckpolicy-viewer-role -rules: -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies - verbs: - - get - - list - - watch -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-lakers-editor-role -rules: -- apiGroups: - - testproject.org - resources: - - lakers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - testproject.org - resources: - - lakers/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-lakers-viewer-role -rules: -- apiGroups: - - testproject.org - resources: - - lakers - verbs: - - get - - list - - watch -- apiGroups: - - testproject.org - resources: - - lakers/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: project-v4-multigroup-manager-role -rules: -- apiGroups: - - apps - resources: - - deployments - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - apps - resources: - - deployments/finalizers - verbs: - - update -- apiGroups: - - apps - resources: - - deployments/status - verbs: - - get - - patch - - update -- apiGroups: - - crew.testproject.org - resources: - - captains - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - crew.testproject.org - resources: - - captains/finalizers - verbs: - - update -- apiGroups: - - crew.testproject.org - resources: - - captains/status - verbs: - - get - - patch - - update -- apiGroups: - - fiz.testproject.org - - foo.testproject.org - resources: - - bars - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - fiz.testproject.org - - foo.testproject.org - resources: - - bars/finalizers - verbs: - - update -- apiGroups: - - fiz.testproject.org - - foo.testproject.org - resources: - - bars/status - verbs: - - get - - patch - - update -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies/finalizers - verbs: - - update -- apiGroups: - - foo.policy.testproject.org - resources: - - healthcheckpolicies/status - verbs: - - get - - patch - - update -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens - - leviathans - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens/finalizers - - leviathans/finalizers - verbs: - - update -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens/status - - leviathans/status - verbs: - - get - - patch - - update -- apiGroups: - - ship.testproject.org - resources: - - cruisers - - destroyers - - frigates - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - ship.testproject.org - resources: - - cruisers/finalizers - - destroyers/finalizers - - frigates/finalizers - verbs: - - update -- apiGroups: - - ship.testproject.org - resources: - - cruisers/status - - destroyers/status - - frigates/status - verbs: - - get - - patch - - update -- apiGroups: - - testproject.org - resources: - - lakers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - testproject.org - resources: - - lakers/finalizers - verbs: - - update -- apiGroups: - - testproject.org - resources: - - lakers/status - verbs: - - get - - patch - - update ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: project-v4-multigroup-metrics-auth-role -rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: project-v4-multigroup-metrics-reader -rules: -- nonResourceURLs: - - /metrics - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-sea-creatures-kraken-editor-role -rules: -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-sea-creatures-kraken-viewer-role -rules: -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens - verbs: - - get - - list - - watch -- apiGroups: - - sea-creatures.testproject.org - resources: - - krakens/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-sea-creatures-leviathan-editor-role -rules: -- apiGroups: - - sea-creatures.testproject.org - resources: - - leviathans - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - sea-creatures.testproject.org - resources: - - leviathans/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-sea-creatures-leviathan-viewer-role -rules: -- apiGroups: - - sea-creatures.testproject.org - resources: - - leviathans - verbs: - - get - - list - - watch -- apiGroups: - - sea-creatures.testproject.org - resources: - - leviathans/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-ship-cruiser-editor-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - cruisers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - ship.testproject.org - resources: - - cruisers/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-ship-cruiser-viewer-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - cruisers - verbs: - - get - - list - - watch -- apiGroups: - - ship.testproject.org - resources: - - cruisers/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-ship-destroyer-editor-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - destroyers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - ship.testproject.org - resources: - - destroyers/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-ship-destroyer-viewer-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - destroyers - verbs: - - get - - list - - watch -- apiGroups: - - ship.testproject.org - resources: - - destroyers/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-ship-frigate-editor-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - frigates - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - ship.testproject.org - resources: - - frigates/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-ship-frigate-viewer-role -rules: -- apiGroups: - - ship.testproject.org - resources: - - frigates - verbs: - - get - - list - - watch -- apiGroups: - - ship.testproject.org - resources: - - frigates/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-leader-election-rolebinding - namespace: project-v4-multigroup-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: project-v4-multigroup-leader-election-role -subjects: -- kind: ServiceAccount - name: project-v4-multigroup-controller-manager - namespace: project-v4-multigroup-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: project-v4-multigroup-manager-role -subjects: -- kind: ServiceAccount - name: project-v4-multigroup-controller-manager - namespace: project-v4-multigroup-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: project-v4-multigroup-metrics-auth-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: project-v4-multigroup-metrics-auth-role -subjects: -- kind: ServiceAccount - name: project-v4-multigroup-controller-manager - namespace: project-v4-multigroup-system ---- -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: https - port: 8443 - protocol: TCP - targetPort: 8443 - selector: - control-plane: controller-manager ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-multigroup - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system -spec: - ports: - - port: 443 - protocol: TCP - targetPort: 9443 - selector: - control-plane: controller-manager ---- -apiVersion: apps/v1 -kind: Deployment -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 - namespace: project-v4-multigroup-system -spec: - replicas: 1 - selector: - matchLabels: - control-plane: controller-manager - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: manager - labels: - control-plane: controller-manager - spec: - containers: - - args: - - --metrics-bind-address=:8443 - - --leader-elect - - --health-probe-bind-address=:8081 - command: - - /manager - image: controller:latest - livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - name: manager - ports: - - containerPort: 9443 - name: webhook-server - protocol: TCP - readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - volumeMounts: - - mountPath: /tmp/k8s-webhook-server/serving-certs - name: cert - readOnly: true - securityContext: - runAsNonRoot: true - serviceAccountName: project-v4-multigroup-controller-manager - terminationGracePeriodSeconds: 10 - volumes: - - name: cert - secret: - defaultMode: 420 - secretName: webhook-server-cert ---- -apiVersion: admissionregistration.k8s.io/v1 -kind: MutatingWebhookConfiguration -metadata: - name: project-v4-multigroup-mutating-webhook-configuration -webhooks: -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system - path: /mutate-crew-testproject-org-v1-captain - failurePolicy: Fail - name: mcaptain.kb.io - rules: - - apiGroups: - - crew.testproject.org - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - captains - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system - path: /mutate-ship-testproject-org-v1-destroyer - failurePolicy: Fail - name: mdestroyer.kb.io - rules: - - apiGroups: - - ship.testproject.org - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - destroyers - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system - path: /mutate-testproject-org-v1-lakers - failurePolicy: Fail - name: mlakers.kb.io - rules: - - apiGroups: - - testproject.org - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - lakers - sideEffects: None ---- -apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - name: project-v4-multigroup-validating-webhook-configuration -webhooks: -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system - path: /validate-crew-testproject-org-v1-captain - failurePolicy: Fail - name: vcaptain.kb.io - rules: - - apiGroups: - - crew.testproject.org - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - captains - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system - path: /validate-ship-testproject-org-v2alpha1-cruiser - failurePolicy: Fail - name: vcruiser.kb.io - rules: - - apiGroups: - - ship.testproject.org - apiVersions: - - v2alpha1 - operations: - - CREATE - - UPDATE - resources: - - cruisers - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: project-v4-multigroup-webhook-service - namespace: project-v4-multigroup-system - path: /validate-testproject-org-v1-lakers - failurePolicy: Fail - name: vlakers.kb.io - rules: - - apiGroups: - - testproject.org - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - lakers - sideEffects: None diff --git a/testdata/project-v4-multigroup/go.mod b/testdata/project-v4-multigroup/go.mod deleted file mode 100644 index 03db01b03e8..00000000000 --- a/testdata/project-v4-multigroup/go.mod +++ /dev/null @@ -1,98 +0,0 @@ -module sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup - -go 1.22.0 - -require ( - github.com/onsi/ginkgo/v2 v2.19.0 - github.com/onsi/gomega v1.33.1 - k8s.io/api v0.31.0 - k8s.io/apimachinery v0.31.0 - k8s.io/client-go v0.31.0 - sigs.k8s.io/controller-runtime v0.19.0 -) - -require ( - github.com/antlr4-go/antlr/v4 v4.13.0 // indirect - github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect - github.com/beorn7/perks v1.0.1 // indirect - github.com/blang/semver/v4 v4.0.0 // indirect - github.com/cenkalti/backoff/v4 v4.3.0 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch/v5 v5.9.0 // indirect - github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/fxamacker/cbor/v2 v2.7.0 // indirect - github.com/go-logr/logr v1.4.2 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-logr/zapr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.4 // indirect - github.com/go-task/slim-sprig/v3 v3.0.0 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.4 // indirect - github.com/google/cel-go v0.20.1 // indirect - github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/go-cmp v0.6.0 // indirect - github.com/google/gofuzz v1.2.0 // indirect - github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect - github.com/imdario/mergo v0.3.6 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/mailru/easyjson v0.7.7 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect - github.com/prometheus/procfs v0.15.1 // indirect - github.com/spf13/cobra v1.8.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/stoewer/go-strcase v1.2.0 // indirect - github.com/x448/float16 v0.8.4 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect - go.opentelemetry.io/otel v1.28.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect - go.opentelemetry.io/otel/metric v1.28.0 // indirect - go.opentelemetry.io/otel/sdk v1.28.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect - go.opentelemetry.io/proto/otlp v1.3.1 // indirect - go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.26.0 // indirect - golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/grpc v1.65.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.31.0 // indirect - k8s.io/apiserver v0.31.0 // indirect - k8s.io/component-base v0.31.0 // indirect - k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect - k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect - sigs.k8s.io/yaml v1.4.0 // indirect -) diff --git a/testdata/project-v4-multigroup/hack/boilerplate.go.txt b/testdata/project-v4-multigroup/hack/boilerplate.go.txt deleted file mode 100644 index 0d32012672a..00000000000 --- a/testdata/project-v4-multigroup/hack/boilerplate.go.txt +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ \ No newline at end of file diff --git a/testdata/project-v4-multigroup/internal/controller/apps/deployment_controller.go b/testdata/project-v4-multigroup/internal/controller/apps/deployment_controller.go deleted file mode 100644 index 454ea50391f..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/apps/deployment_controller.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package apps - -import ( - "context" - - appsv1 "k8s.io/api/apps/v1" - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" -) - -// DeploymentReconciler reconciles a Deployment object -type DeploymentReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=apps,resources=deployments/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=apps,resources=deployments/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the Deployment object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *DeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *DeploymentReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - For(&appsv1.Deployment{}). - Complete(r) -} diff --git a/testdata/project-v4-multigroup/internal/controller/apps/deployment_controller_test.go b/testdata/project-v4-multigroup/internal/controller/apps/deployment_controller_test.go deleted file mode 100644 index 339a1532026..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/apps/deployment_controller_test.go +++ /dev/null @@ -1,32 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package apps - -import ( - . "github.com/onsi/ginkgo/v2" -) - -var _ = Describe("Deployment Controller", func() { - Context("When reconciling a resource", func() { - - It("should successfully reconcile the resource", func() { - - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/apps/suite_test.go b/testdata/project-v4-multigroup/internal/controller/apps/suite_test.go deleted file mode 100644 index 8d7a448f9e8..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/apps/suite_test.go +++ /dev/null @@ -1,95 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package apps - -import ( - "context" - "fmt" - "path/filepath" - "runtime" - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - appsv1 "k8s.io/api/apps/v1" - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - // +kubebuilder:scaffold:imports -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestControllers(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Controller Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: false, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - err = appsv1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/crew/captain_controller.go b/testdata/project-v4-multigroup/internal/controller/crew/captain_controller.go deleted file mode 100644 index 5ec22b30eef..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/crew/captain_controller.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package crew - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" - - crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/crew/v1" -) - -// CaptainReconciler reconciles a Captain object -type CaptainReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=crew.testproject.org,resources=captains,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=crew.testproject.org,resources=captains/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=crew.testproject.org,resources=captains/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the Captain object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *CaptainReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *CaptainReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - For(&crewv1.Captain{}). - Complete(r) -} diff --git a/testdata/project-v4-multigroup/internal/controller/crew/captain_controller_test.go b/testdata/project-v4-multigroup/internal/controller/crew/captain_controller_test.go deleted file mode 100644 index c2495aee47c..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/crew/captain_controller_test.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package crew - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/crew/v1" -) - -var _ = Describe("Captain Controller", func() { - Context("When reconciling a resource", func() { - const resourceName = "test-resource" - - ctx := context.Background() - - typeNamespacedName := types.NamespacedName{ - Name: resourceName, - Namespace: "default", // TODO(user):Modify as needed - } - captain := &crewv1.Captain{} - - BeforeEach(func() { - By("creating the custom resource for the Kind Captain") - err := k8sClient.Get(ctx, typeNamespacedName, captain) - if err != nil && errors.IsNotFound(err) { - resource := &crewv1.Captain{ - ObjectMeta: metav1.ObjectMeta{ - Name: resourceName, - Namespace: "default", - }, - // TODO(user): Specify other spec details if needed. - } - Expect(k8sClient.Create(ctx, resource)).To(Succeed()) - } - }) - - AfterEach(func() { - // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &crewv1.Captain{} - err := k8sClient.Get(ctx, typeNamespacedName, resource) - Expect(err).NotTo(HaveOccurred()) - - By("Cleanup the specific resource instance Captain") - Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) - }) - It("should successfully reconcile the resource", func() { - By("Reconciling the created resource") - controllerReconciler := &CaptainReconciler{ - Client: k8sClient, - Scheme: k8sClient.Scheme(), - } - - _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ - NamespacedName: typeNamespacedName, - }) - Expect(err).NotTo(HaveOccurred()) - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/crew/suite_test.go b/testdata/project-v4-multigroup/internal/controller/crew/suite_test.go deleted file mode 100644 index 840accd8f8a..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/crew/suite_test.go +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package crew - -import ( - "context" - "fmt" - "path/filepath" - "runtime" - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - - crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/crew/v1" - // +kubebuilder:scaffold:imports -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestControllers(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Controller Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: true, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - err = crewv1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/fiz/bar_controller.go b/testdata/project-v4-multigroup/internal/controller/fiz/bar_controller.go deleted file mode 100644 index 675cca0d946..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/fiz/bar_controller.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package fiz - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" - - fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/fiz/v1" -) - -// BarReconciler reconciles a Bar object -type BarReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=fiz.testproject.org,resources=bars,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=fiz.testproject.org,resources=bars/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=fiz.testproject.org,resources=bars/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the Bar object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *BarReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *BarReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - For(&fizv1.Bar{}). - Complete(r) -} diff --git a/testdata/project-v4-multigroup/internal/controller/fiz/bar_controller_test.go b/testdata/project-v4-multigroup/internal/controller/fiz/bar_controller_test.go deleted file mode 100644 index c9dca3f1172..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/fiz/bar_controller_test.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package fiz - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/fiz/v1" -) - -var _ = Describe("Bar Controller", func() { - Context("When reconciling a resource", func() { - const resourceName = "test-resource" - - ctx := context.Background() - - typeNamespacedName := types.NamespacedName{ - Name: resourceName, - Namespace: "default", // TODO(user):Modify as needed - } - bar := &fizv1.Bar{} - - BeforeEach(func() { - By("creating the custom resource for the Kind Bar") - err := k8sClient.Get(ctx, typeNamespacedName, bar) - if err != nil && errors.IsNotFound(err) { - resource := &fizv1.Bar{ - ObjectMeta: metav1.ObjectMeta{ - Name: resourceName, - Namespace: "default", - }, - // TODO(user): Specify other spec details if needed. - } - Expect(k8sClient.Create(ctx, resource)).To(Succeed()) - } - }) - - AfterEach(func() { - // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &fizv1.Bar{} - err := k8sClient.Get(ctx, typeNamespacedName, resource) - Expect(err).NotTo(HaveOccurred()) - - By("Cleanup the specific resource instance Bar") - Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) - }) - It("should successfully reconcile the resource", func() { - By("Reconciling the created resource") - controllerReconciler := &BarReconciler{ - Client: k8sClient, - Scheme: k8sClient.Scheme(), - } - - _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ - NamespacedName: typeNamespacedName, - }) - Expect(err).NotTo(HaveOccurred()) - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/fiz/suite_test.go b/testdata/project-v4-multigroup/internal/controller/fiz/suite_test.go deleted file mode 100644 index 1ef21f902da..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/fiz/suite_test.go +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package fiz - -import ( - "context" - "fmt" - "path/filepath" - "runtime" - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - - fizv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/fiz/v1" - // +kubebuilder:scaffold:imports -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestControllers(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Controller Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: true, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - err = fizv1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/foo.policy/healthcheckpolicy_controller.go b/testdata/project-v4-multigroup/internal/controller/foo.policy/healthcheckpolicy_controller.go deleted file mode 100644 index bcd1ed6021e..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/foo.policy/healthcheckpolicy_controller.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package foopolicy - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" - - foopolicyv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/foo.policy/v1" -) - -// HealthCheckPolicyReconciler reconciles a HealthCheckPolicy object -type HealthCheckPolicyReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=foo.policy.testproject.org,resources=healthcheckpolicies,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=foo.policy.testproject.org,resources=healthcheckpolicies/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=foo.policy.testproject.org,resources=healthcheckpolicies/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the HealthCheckPolicy object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *HealthCheckPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *HealthCheckPolicyReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - For(&foopolicyv1.HealthCheckPolicy{}). - Complete(r) -} diff --git a/testdata/project-v4-multigroup/internal/controller/foo/bar_controller.go b/testdata/project-v4-multigroup/internal/controller/foo/bar_controller.go deleted file mode 100644 index 7917e5dda78..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/foo/bar_controller.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package foo - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" - - foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/foo/v1" -) - -// BarReconciler reconciles a Bar object -type BarReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=foo.testproject.org,resources=bars,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=foo.testproject.org,resources=bars/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=foo.testproject.org,resources=bars/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the Bar object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *BarReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *BarReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - For(&foov1.Bar{}). - Complete(r) -} diff --git a/testdata/project-v4-multigroup/internal/controller/foo/bar_controller_test.go b/testdata/project-v4-multigroup/internal/controller/foo/bar_controller_test.go deleted file mode 100644 index 12193854c79..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/foo/bar_controller_test.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package foo - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/foo/v1" -) - -var _ = Describe("Bar Controller", func() { - Context("When reconciling a resource", func() { - const resourceName = "test-resource" - - ctx := context.Background() - - typeNamespacedName := types.NamespacedName{ - Name: resourceName, - Namespace: "default", // TODO(user):Modify as needed - } - bar := &foov1.Bar{} - - BeforeEach(func() { - By("creating the custom resource for the Kind Bar") - err := k8sClient.Get(ctx, typeNamespacedName, bar) - if err != nil && errors.IsNotFound(err) { - resource := &foov1.Bar{ - ObjectMeta: metav1.ObjectMeta{ - Name: resourceName, - Namespace: "default", - }, - // TODO(user): Specify other spec details if needed. - } - Expect(k8sClient.Create(ctx, resource)).To(Succeed()) - } - }) - - AfterEach(func() { - // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &foov1.Bar{} - err := k8sClient.Get(ctx, typeNamespacedName, resource) - Expect(err).NotTo(HaveOccurred()) - - By("Cleanup the specific resource instance Bar") - Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) - }) - It("should successfully reconcile the resource", func() { - By("Reconciling the created resource") - controllerReconciler := &BarReconciler{ - Client: k8sClient, - Scheme: k8sClient.Scheme(), - } - - _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ - NamespacedName: typeNamespacedName, - }) - Expect(err).NotTo(HaveOccurred()) - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/foo/suite_test.go b/testdata/project-v4-multigroup/internal/controller/foo/suite_test.go deleted file mode 100644 index a04113931ba..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/foo/suite_test.go +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package foo - -import ( - "context" - "fmt" - "path/filepath" - "runtime" - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - - foov1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/foo/v1" - // +kubebuilder:scaffold:imports -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestControllers(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Controller Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: true, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - err = foov1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/lakers_controller_test.go b/testdata/project-v4-multigroup/internal/controller/lakers_controller_test.go deleted file mode 100644 index 84ae3e086e0..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/lakers_controller_test.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - testprojectorgv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/v1" -) - -var _ = Describe("Lakers Controller", func() { - Context("When reconciling a resource", func() { - const resourceName = "test-resource" - - ctx := context.Background() - - typeNamespacedName := types.NamespacedName{ - Name: resourceName, - Namespace: "default", // TODO(user):Modify as needed - } - lakers := &testprojectorgv1.Lakers{} - - BeforeEach(func() { - By("creating the custom resource for the Kind Lakers") - err := k8sClient.Get(ctx, typeNamespacedName, lakers) - if err != nil && errors.IsNotFound(err) { - resource := &testprojectorgv1.Lakers{ - ObjectMeta: metav1.ObjectMeta{ - Name: resourceName, - Namespace: "default", - }, - // TODO(user): Specify other spec details if needed. - } - Expect(k8sClient.Create(ctx, resource)).To(Succeed()) - } - }) - - AfterEach(func() { - // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &testprojectorgv1.Lakers{} - err := k8sClient.Get(ctx, typeNamespacedName, resource) - Expect(err).NotTo(HaveOccurred()) - - By("Cleanup the specific resource instance Lakers") - Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) - }) - It("should successfully reconcile the resource", func() { - By("Reconciling the created resource") - controllerReconciler := &LakersReconciler{ - Client: k8sClient, - Scheme: k8sClient.Scheme(), - } - - _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ - NamespacedName: typeNamespacedName, - }) - Expect(err).NotTo(HaveOccurred()) - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/sea-creatures/kraken_controller.go b/testdata/project-v4-multigroup/internal/controller/sea-creatures/kraken_controller.go deleted file mode 100644 index 3ed11fd2f98..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/sea-creatures/kraken_controller.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package seacreatures - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" - - seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/sea-creatures/v1beta1" -) - -// KrakenReconciler reconciles a Kraken object -type KrakenReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=krakens,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=krakens/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=krakens/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the Kraken object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *KrakenReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *KrakenReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - For(&seacreaturesv1beta1.Kraken{}). - Complete(r) -} diff --git a/testdata/project-v4-multigroup/internal/controller/sea-creatures/kraken_controller_test.go b/testdata/project-v4-multigroup/internal/controller/sea-creatures/kraken_controller_test.go deleted file mode 100644 index b0eae061ff8..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/sea-creatures/kraken_controller_test.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package seacreatures - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/sea-creatures/v1beta1" -) - -var _ = Describe("Kraken Controller", func() { - Context("When reconciling a resource", func() { - const resourceName = "test-resource" - - ctx := context.Background() - - typeNamespacedName := types.NamespacedName{ - Name: resourceName, - Namespace: "default", // TODO(user):Modify as needed - } - kraken := &seacreaturesv1beta1.Kraken{} - - BeforeEach(func() { - By("creating the custom resource for the Kind Kraken") - err := k8sClient.Get(ctx, typeNamespacedName, kraken) - if err != nil && errors.IsNotFound(err) { - resource := &seacreaturesv1beta1.Kraken{ - ObjectMeta: metav1.ObjectMeta{ - Name: resourceName, - Namespace: "default", - }, - // TODO(user): Specify other spec details if needed. - } - Expect(k8sClient.Create(ctx, resource)).To(Succeed()) - } - }) - - AfterEach(func() { - // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &seacreaturesv1beta1.Kraken{} - err := k8sClient.Get(ctx, typeNamespacedName, resource) - Expect(err).NotTo(HaveOccurred()) - - By("Cleanup the specific resource instance Kraken") - Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) - }) - It("should successfully reconcile the resource", func() { - By("Reconciling the created resource") - controllerReconciler := &KrakenReconciler{ - Client: k8sClient, - Scheme: k8sClient.Scheme(), - } - - _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ - NamespacedName: typeNamespacedName, - }) - Expect(err).NotTo(HaveOccurred()) - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/sea-creatures/leviathan_controller.go b/testdata/project-v4-multigroup/internal/controller/sea-creatures/leviathan_controller.go deleted file mode 100644 index bf137eb0255..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/sea-creatures/leviathan_controller.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package seacreatures - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" - - seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/sea-creatures/v1beta2" -) - -// LeviathanReconciler reconciles a Leviathan object -type LeviathanReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=leviathans,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=leviathans/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=leviathans/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the Leviathan object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *LeviathanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *LeviathanReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - For(&seacreaturesv1beta2.Leviathan{}). - Complete(r) -} diff --git a/testdata/project-v4-multigroup/internal/controller/sea-creatures/leviathan_controller_test.go b/testdata/project-v4-multigroup/internal/controller/sea-creatures/leviathan_controller_test.go deleted file mode 100644 index 5b1e491aa89..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/sea-creatures/leviathan_controller_test.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package seacreatures - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/sea-creatures/v1beta2" -) - -var _ = Describe("Leviathan Controller", func() { - Context("When reconciling a resource", func() { - const resourceName = "test-resource" - - ctx := context.Background() - - typeNamespacedName := types.NamespacedName{ - Name: resourceName, - Namespace: "default", // TODO(user):Modify as needed - } - leviathan := &seacreaturesv1beta2.Leviathan{} - - BeforeEach(func() { - By("creating the custom resource for the Kind Leviathan") - err := k8sClient.Get(ctx, typeNamespacedName, leviathan) - if err != nil && errors.IsNotFound(err) { - resource := &seacreaturesv1beta2.Leviathan{ - ObjectMeta: metav1.ObjectMeta{ - Name: resourceName, - Namespace: "default", - }, - // TODO(user): Specify other spec details if needed. - } - Expect(k8sClient.Create(ctx, resource)).To(Succeed()) - } - }) - - AfterEach(func() { - // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &seacreaturesv1beta2.Leviathan{} - err := k8sClient.Get(ctx, typeNamespacedName, resource) - Expect(err).NotTo(HaveOccurred()) - - By("Cleanup the specific resource instance Leviathan") - Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) - }) - It("should successfully reconcile the resource", func() { - By("Reconciling the created resource") - controllerReconciler := &LeviathanReconciler{ - Client: k8sClient, - Scheme: k8sClient.Scheme(), - } - - _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ - NamespacedName: typeNamespacedName, - }) - Expect(err).NotTo(HaveOccurred()) - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/sea-creatures/suite_test.go b/testdata/project-v4-multigroup/internal/controller/sea-creatures/suite_test.go deleted file mode 100644 index d2f44fafbe2..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/sea-creatures/suite_test.go +++ /dev/null @@ -1,100 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package seacreatures - -import ( - "context" - "fmt" - "path/filepath" - "runtime" - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - - seacreaturesv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/sea-creatures/v1beta1" - seacreaturesv1beta2 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/sea-creatures/v1beta2" - // +kubebuilder:scaffold:imports -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestControllers(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Controller Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: true, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - err = seacreaturesv1beta1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - err = seacreaturesv1beta2.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/ship/cruiser_controller_test.go b/testdata/project-v4-multigroup/internal/controller/ship/cruiser_controller_test.go deleted file mode 100644 index 5d432ab735e..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/ship/cruiser_controller_test.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package ship - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v2alpha1" -) - -var _ = Describe("Cruiser Controller", func() { - Context("When reconciling a resource", func() { - const resourceName = "test-resource" - - ctx := context.Background() - - typeNamespacedName := types.NamespacedName{ - Name: resourceName, - Namespace: "default", // TODO(user):Modify as needed - } - cruiser := &shipv2alpha1.Cruiser{} - - BeforeEach(func() { - By("creating the custom resource for the Kind Cruiser") - err := k8sClient.Get(ctx, typeNamespacedName, cruiser) - if err != nil && errors.IsNotFound(err) { - resource := &shipv2alpha1.Cruiser{ - ObjectMeta: metav1.ObjectMeta{ - Name: resourceName, - Namespace: "default", - }, - // TODO(user): Specify other spec details if needed. - } - Expect(k8sClient.Create(ctx, resource)).To(Succeed()) - } - }) - - AfterEach(func() { - // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &shipv2alpha1.Cruiser{} - err := k8sClient.Get(ctx, typeNamespacedName, resource) - Expect(err).NotTo(HaveOccurred()) - - By("Cleanup the specific resource instance Cruiser") - Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) - }) - It("should successfully reconcile the resource", func() { - By("Reconciling the created resource") - controllerReconciler := &CruiserReconciler{ - Client: k8sClient, - Scheme: k8sClient.Scheme(), - } - - _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ - NamespacedName: typeNamespacedName, - }) - Expect(err).NotTo(HaveOccurred()) - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/ship/destroyer_controller.go b/testdata/project-v4-multigroup/internal/controller/ship/destroyer_controller.go deleted file mode 100644 index fb4333bd68e..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/ship/destroyer_controller.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package ship - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" - - shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v1" -) - -// DestroyerReconciler reconciles a Destroyer object -type DestroyerReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=ship.testproject.org,resources=destroyers,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=ship.testproject.org,resources=destroyers/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=ship.testproject.org,resources=destroyers/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the Destroyer object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *DestroyerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *DestroyerReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - For(&shipv1.Destroyer{}). - Complete(r) -} diff --git a/testdata/project-v4-multigroup/internal/controller/ship/destroyer_controller_test.go b/testdata/project-v4-multigroup/internal/controller/ship/destroyer_controller_test.go deleted file mode 100644 index c1de1afb8b6..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/ship/destroyer_controller_test.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package ship - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v1" -) - -var _ = Describe("Destroyer Controller", func() { - Context("When reconciling a resource", func() { - const resourceName = "test-resource" - - ctx := context.Background() - - typeNamespacedName := types.NamespacedName{ - Name: resourceName, - Namespace: "default", // TODO(user):Modify as needed - } - destroyer := &shipv1.Destroyer{} - - BeforeEach(func() { - By("creating the custom resource for the Kind Destroyer") - err := k8sClient.Get(ctx, typeNamespacedName, destroyer) - if err != nil && errors.IsNotFound(err) { - resource := &shipv1.Destroyer{ - ObjectMeta: metav1.ObjectMeta{ - Name: resourceName, - Namespace: "default", - }, - // TODO(user): Specify other spec details if needed. - } - Expect(k8sClient.Create(ctx, resource)).To(Succeed()) - } - }) - - AfterEach(func() { - // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &shipv1.Destroyer{} - err := k8sClient.Get(ctx, typeNamespacedName, resource) - Expect(err).NotTo(HaveOccurred()) - - By("Cleanup the specific resource instance Destroyer") - Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) - }) - It("should successfully reconcile the resource", func() { - By("Reconciling the created resource") - controllerReconciler := &DestroyerReconciler{ - Client: k8sClient, - Scheme: k8sClient.Scheme(), - } - - _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ - NamespacedName: typeNamespacedName, - }) - Expect(err).NotTo(HaveOccurred()) - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -}) diff --git a/testdata/project-v4-multigroup/internal/controller/ship/suite_test.go b/testdata/project-v4-multigroup/internal/controller/ship/suite_test.go deleted file mode 100644 index a38370a4f56..00000000000 --- a/testdata/project-v4-multigroup/internal/controller/ship/suite_test.go +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package ship - -import ( - "context" - "fmt" - "path/filepath" - "runtime" - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - - shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v1" - shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v1beta1" - shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/api/ship/v2alpha1" - // +kubebuilder:scaffold:imports -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var cfg *rest.Config -var k8sClient client.Client -var testEnv *envtest.Environment -var ctx context.Context -var cancel context.CancelFunc - -func TestControllers(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Controller Suite") -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - ctx, cancel = context.WithCancel(context.TODO()) - - By("bootstrapping test environment") - testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: true, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - err = shipv1beta1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - err = shipv1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - err = shipv2alpha1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - // +kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) - -}) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - cancel() - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/testdata/project-v4-multigroup/test/e2e/e2e_suite_test.go b/testdata/project-v4-multigroup/test/e2e/e2e_suite_test.go deleted file mode 100644 index b68ec10b389..00000000000 --- a/testdata/project-v4-multigroup/test/e2e/e2e_suite_test.go +++ /dev/null @@ -1,117 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package e2e - -import ( - "fmt" - "os" - "os/exec" - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/test/utils" -) - -var ( - // Optional Environment Variables: - // - PROMETHEUS_INSTALL_SKIP=true: Skips Prometheus Operator installation during test setup. - // - CERT_MANAGER_INSTALL_SKIP=true: Skips CertManager installation during test setup. - // These variables are useful if Prometheus or CertManager is already installed, avoiding - // re-installation and conflicts. - skipPrometheusInstall = os.Getenv("PROMETHEUS_INSTALL_SKIP") == "true" - skipCertManagerInstall = os.Getenv("CERT_MANAGER_INSTALL_SKIP") == "true" - // isPrometheusOperatorAlreadyInstalled will be set true when prometheus CRDs be found on the cluster - isPrometheusOperatorAlreadyInstalled = false - // isCertManagerAlreadyInstalled will be set true when CertManager CRDs be found on the cluster - isCertManagerAlreadyInstalled = false - - // projectImage is the name of the image which will be build and loaded - // with the code source changes to be tested. - projectImage = "example.com/project-v4-multigroup:v0.0.1" -) - -// TestE2E runs the end-to-end (e2e) test suite for the project. These tests execute in an isolated, -// temporary environment to validate project changes with the the purposed to be used in CI jobs. -// The default setup requires Kind, builds/loads the Manager Docker image locally, and installs -// CertManager and Prometheus. -func TestE2E(t *testing.T) { - RegisterFailHandler(Fail) - _, _ = fmt.Fprintf(GinkgoWriter, "Starting project-v4-multigroup integration test suite\n") - RunSpecs(t, "e2e suite") -} - -var _ = BeforeSuite(func() { - By("generating files") - cmd := exec.Command("make", "generate") - _, err := utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to run make generate") - - By("generating manifests") - cmd = exec.Command("make", "manifests") - _, err = utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to run make manifests") - - By("building the manager(Operator) image") - cmd = exec.Command("make", "docker-build", fmt.Sprintf("IMG=%s", projectImage)) - _, err = utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to build the manager(Operator) image") - - // TODO(user): If you want to change the e2e test vendor from Kind, ensure the image is - // built and available before running the tests. Also, remove the following block. - By("loading the manager(Operator) image on Kind") - err = utils.LoadImageToKindClusterWithName(projectImage) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to load the manager(Operator) image into Kind") - - // The tests-e2e are intended to run on a temporary cluster that is created and destroyed for testing. - // To prevent errors when tests run in environments with Prometheus or CertManager already installed, - // we check for their presence before execution. - // Setup Prometheus and CertManager before the suite if not skipped and if not already installed - if !skipPrometheusInstall { - By("checking if prometheus is installed already") - isPrometheusOperatorAlreadyInstalled = utils.IsPrometheusCRDsInstalled() - if !isPrometheusOperatorAlreadyInstalled { - _, _ = fmt.Fprintf(GinkgoWriter, "Installing Prometheus Operator...\n") - Expect(utils.InstallPrometheusOperator()).To(Succeed(), "Failed to install Prometheus Operator") - } else { - _, _ = fmt.Fprintf(GinkgoWriter, "WARNING: Prometheus Operator is already installed. Skipping installation...\n") - } - } - if !skipCertManagerInstall { - By("checking if cert manager is installed already") - isCertManagerAlreadyInstalled = utils.IsCertManagerCRDsInstalled() - if !isCertManagerAlreadyInstalled { - _, _ = fmt.Fprintf(GinkgoWriter, "Installing CertManager...\n") - Expect(utils.InstallCertManager()).To(Succeed(), "Failed to install CertManager") - } else { - _, _ = fmt.Fprintf(GinkgoWriter, "WARNING: CertManager is already installed. Skipping installation...\n") - } - } -}) - -var _ = AfterSuite(func() { - // Teardown Prometheus and CertManager after the suite if not skipped and if they were not already installed - if !skipPrometheusInstall && !isPrometheusOperatorAlreadyInstalled { - _, _ = fmt.Fprintf(GinkgoWriter, "Uninstalling Prometheus Operator...\n") - utils.UninstallPrometheusOperator() - } - if !skipCertManagerInstall && !isCertManagerAlreadyInstalled { - _, _ = fmt.Fprintf(GinkgoWriter, "Uninstalling CertManager...\n") - utils.UninstallCertManager() - } -}) diff --git a/testdata/project-v4-multigroup/test/e2e/e2e_test.go b/testdata/project-v4-multigroup/test/e2e/e2e_test.go deleted file mode 100644 index 580c8745b03..00000000000 --- a/testdata/project-v4-multigroup/test/e2e/e2e_test.go +++ /dev/null @@ -1,114 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package e2e - -import ( - "fmt" - "os/exec" - "time" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup/test/utils" -) - -const namespace = "project-v4-multigroup-system" - -// Define a set of end-to-end (e2e) tests to validate the behavior of the controller. -var _ = Describe("controller", Ordered, func() { - // Before running the tests, set up the environment by creating the namespace, - // installing CRDs, and deploying the controller. - BeforeAll(func() { - By("creating manager namespace") - cmd := exec.Command("kubectl", "create", "ns", namespace) - _, err := utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to create namespace") - - By("installing CRDs") - cmd = exec.Command("make", "install") - _, err = utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to install CRDs") - - By("deploying the controller-manager") - cmd = exec.Command("make", "deploy", fmt.Sprintf("IMG=%s", projectImage)) - _, err = utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to deploy the controller-manager") - }) - - // After all tests have been executed, clean up by undeploying the controller, uninstalling CRDs, - // and deleting the namespace. - AfterAll(func() { - By("undeploying the controller-manager") - cmd := exec.Command("make", "undeploy") - _, _ = utils.Run(cmd) - - By("uninstalling CRDs") - cmd = exec.Command("make", "uninstall") - _, _ = utils.Run(cmd) - - By("removing manager namespace") - cmd = exec.Command("kubectl", "delete", "ns", namespace) - _, _ = utils.Run(cmd) - }) - - // The Context block contains the actual tests that validate the operator's behavior. - Context("Operator", func() { - It("should run successfully", func() { - var controllerPodName string - - By("validating that the controller-manager pod is running as expected") - verifyControllerUp := func() error { - // Get the name of the controller-manager pod - cmd := exec.Command("kubectl", "get", - "pods", "-l", "control-plane=controller-manager", - "-o", "go-template={{ range .items }}"+ - "{{ if not .metadata.deletionTimestamp }}"+ - "{{ .metadata.name }}"+ - "{{ \"\\n\" }}{{ end }}{{ end }}", - "-n", namespace, - ) - - podOutput, err := utils.Run(cmd) - ExpectWithOffset(2, err).NotTo(HaveOccurred(), "Failed to retrieve controller-manager pod information") - podNames := utils.GetNonEmptyLines(string(podOutput)) - if len(podNames) != 1 { - return fmt.Errorf("expected 1 controller pod running, but got %d", len(podNames)) - } - controllerPodName = podNames[0] - ExpectWithOffset(2, controllerPodName).Should(ContainSubstring("controller-manager")) - - // Validate the pod's status - cmd = exec.Command("kubectl", "get", - "pods", controllerPodName, "-o", "jsonpath={.status.phase}", - "-n", namespace, - ) - status, err := utils.Run(cmd) - ExpectWithOffset(2, err).NotTo(HaveOccurred(), "Failed to retrieve controller-manager pod status") - if string(status) != "Running" { - return fmt.Errorf("controller pod in %s status", status) - } - return nil - } - // Repeatedly check if the controller-manager pod is running until it succeeds or times out. - EventuallyWithOffset(1, verifyControllerUp, time.Minute, time.Second).Should(Succeed()) - }) - - // TODO(user): Customize the e2e test suite to include - // additional scenarios specific to your project. - }) -}) diff --git a/testdata/project-v4-multigroup/test/utils/utils.go b/testdata/project-v4-multigroup/test/utils/utils.go deleted file mode 100644 index 777825397c5..00000000000 --- a/testdata/project-v4-multigroup/test/utils/utils.go +++ /dev/null @@ -1,200 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package utils - -import ( - "fmt" - "os" - "os/exec" - "strings" - - . "github.com/onsi/ginkgo/v2" //nolint:golint,revive -) - -const ( - prometheusOperatorVersion = "v0.72.0" - prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" + - "releases/download/%s/bundle.yaml" - - certmanagerVersion = "v1.14.4" - certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml" -) - -func warnError(err error) { - _, _ = fmt.Fprintf(GinkgoWriter, "warning: %v\n", err) -} - -// Run executes the provided command within this context -func Run(cmd *exec.Cmd) ([]byte, error) { - dir, _ := GetProjectDir() - cmd.Dir = dir - - if err := os.Chdir(cmd.Dir); err != nil { - _, _ = fmt.Fprintf(GinkgoWriter, "chdir dir: %s\n", err) - } - - cmd.Env = append(os.Environ(), "GO111MODULE=on") - command := strings.Join(cmd.Args, " ") - _, _ = fmt.Fprintf(GinkgoWriter, "running: %s\n", command) - output, err := cmd.CombinedOutput() - if err != nil { - return output, fmt.Errorf("%s failed with error: (%v) %s", command, err, string(output)) - } - - return output, nil -} - -// InstallPrometheusOperator installs the prometheus Operator to be used to export the enabled metrics. -func InstallPrometheusOperator() error { - url := fmt.Sprintf(prometheusOperatorURL, prometheusOperatorVersion) - cmd := exec.Command("kubectl", "create", "-f", url) - _, err := Run(cmd) - return err -} - -// UninstallPrometheusOperator uninstalls the prometheus -func UninstallPrometheusOperator() { - url := fmt.Sprintf(prometheusOperatorURL, prometheusOperatorVersion) - cmd := exec.Command("kubectl", "delete", "-f", url) - if _, err := Run(cmd); err != nil { - warnError(err) - } -} - -// IsPrometheusCRDsInstalled checks if any Prometheus CRDs are installed -// by verifying the existence of key CRDs related to Prometheus. -func IsPrometheusCRDsInstalled() bool { - // List of common Prometheus CRDs - prometheusCRDs := []string{ - "prometheuses.monitoring.coreos.com", - "prometheusrules.monitoring.coreos.com", - "prometheusagents.monitoring.coreos.com", - } - - cmd := exec.Command("kubectl", "get", "crds", "-o", "custom-columns=NAME:.metadata.name") - output, err := Run(cmd) - if err != nil { - return false - } - crdList := GetNonEmptyLines(string(output)) - for _, crd := range prometheusCRDs { - for _, line := range crdList { - if strings.Contains(line, crd) { - return true - } - } - } - - return false -} - -// UninstallCertManager uninstalls the cert manager -func UninstallCertManager() { - url := fmt.Sprintf(certmanagerURLTmpl, certmanagerVersion) - cmd := exec.Command("kubectl", "delete", "-f", url) - if _, err := Run(cmd); err != nil { - warnError(err) - } -} - -// InstallCertManager installs the cert manager bundle. -func InstallCertManager() error { - url := fmt.Sprintf(certmanagerURLTmpl, certmanagerVersion) - cmd := exec.Command("kubectl", "apply", "-f", url) - if _, err := Run(cmd); err != nil { - return err - } - // Wait for cert-manager-webhook to be ready, which can take time if cert-manager - // was re-installed after uninstalling on a cluster. - cmd = exec.Command("kubectl", "wait", "deployment.apps/cert-manager-webhook", - "--for", "condition=Available", - "--namespace", "cert-manager", - "--timeout", "5m", - ) - - _, err := Run(cmd) - return err -} - -// IsCertManagerCRDsInstalled checks if any Cert Manager CRDs are installed -// by verifying the existence of key CRDs related to Cert Manager. -func IsCertManagerCRDsInstalled() bool { - // List of common Cert Manager CRDs - certManagerCRDs := []string{ - "certificates.cert-manager.io", - "issuers.cert-manager.io", - "clusterissuers.cert-manager.io", - "certificaterequests.cert-manager.io", - "orders.acme.cert-manager.io", - "challenges.acme.cert-manager.io", - } - - // Execute the kubectl command to get all CRDs - cmd := exec.Command("kubectl", "get", "crds") - output, err := Run(cmd) - if err != nil { - return false - } - - // Check if any of the Cert Manager CRDs are present - crdList := GetNonEmptyLines(string(output)) - for _, crd := range certManagerCRDs { - for _, line := range crdList { - if strings.Contains(line, crd) { - return true - } - } - } - - return false -} - -// LoadImageToKindClusterWithName loads a local docker image to the kind cluster -func LoadImageToKindClusterWithName(name string) error { - cluster := "kind" - if v, ok := os.LookupEnv("KIND_CLUSTER"); ok { - cluster = v - } - kindOptions := []string{"load", "docker-image", name, "--name", cluster} - cmd := exec.Command("kind", kindOptions...) - _, err := Run(cmd) - return err -} - -// GetNonEmptyLines converts given command output string into individual objects -// according to line breakers, and ignores the empty elements in it. -func GetNonEmptyLines(output string) []string { - var res []string - elements := strings.Split(output, "\n") - for _, element := range elements { - if element != "" { - res = append(res, element) - } - } - - return res -} - -// GetProjectDir will return the directory where the project is -func GetProjectDir() (string, error) { - wd, err := os.Getwd() - if err != nil { - return wd, err - } - wd = strings.Replace(wd, "/test/e2e", "", -1) - return wd, nil -} diff --git a/testdata/project-v4-with-grafana/.devcontainer/devcontainer.json b/testdata/project-v4-with-grafana/.devcontainer/devcontainer.json deleted file mode 100644 index e2cdc09c96c..00000000000 --- a/testdata/project-v4-with-grafana/.devcontainer/devcontainer.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "Kubebuilder DevContainer", - "image": "golang:1.22", - "features": { - "ghcr.io/devcontainers/features/docker-in-docker:2": {}, - "ghcr.io/devcontainers/features/git:1": {} - }, - - "runArgs": ["--network=host"], - - "customizations": { - "vscode": { - "settings": { - "terminal.integrated.shell.linux": "/bin/bash" - }, - "extensions": [ - "ms-kubernetes-tools.vscode-kubernetes-tools", - "ms-azuretools.vscode-docker" - ] - } - }, - - "onCreateCommand": "bash .devcontainer/post-install.sh" -} - diff --git a/testdata/project-v4-with-grafana/.devcontainer/post-install.sh b/testdata/project-v4-with-grafana/.devcontainer/post-install.sh deleted file mode 100644 index 265c43ee8d3..00000000000 --- a/testdata/project-v4-with-grafana/.devcontainer/post-install.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -x - -curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 -chmod +x ./kind -mv ./kind /usr/local/bin/kind - -curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/linux/amd64 -chmod +x kubebuilder -mv kubebuilder /usr/local/bin/ - -KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt) -curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl" -chmod +x kubectl -mv kubectl /usr/local/bin/kubectl - -docker network create -d=bridge --subnet=172.19.0.0/24 kind - -kind version -kubebuilder version -docker --version -go version -kubectl version --client diff --git a/testdata/project-v4-with-grafana/.dockerignore b/testdata/project-v4-with-grafana/.dockerignore deleted file mode 100644 index a3aab7af70c..00000000000 --- a/testdata/project-v4-with-grafana/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file -# Ignore build and test binaries. -bin/ diff --git a/testdata/project-v4-with-grafana/.gitignore b/testdata/project-v4-with-grafana/.gitignore deleted file mode 100644 index ada68ff086c..00000000000 --- a/testdata/project-v4-with-grafana/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib -bin/* -Dockerfile.cross - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Go workspace file -go.work - -# Kubernetes Generated files - skip generated files, except for vendored files -!vendor/**/zz_generated.* - -# editor and IDE paraphernalia -.idea -.vscode -*.swp -*.swo -*~ diff --git a/testdata/project-v4-with-grafana/.golangci.yml b/testdata/project-v4-with-grafana/.golangci.yml deleted file mode 100644 index aac8a13f928..00000000000 --- a/testdata/project-v4-with-grafana/.golangci.yml +++ /dev/null @@ -1,47 +0,0 @@ -run: - timeout: 5m - allow-parallel-runners: true - -issues: - # don't skip warning about doc comments - # don't exclude the default set of lint - exclude-use-default: false - # restore some of the defaults - # (fill in the rest as needed) - exclude-rules: - - path: "api/*" - linters: - - lll - - path: "internal/*" - linters: - - dupl - - lll -linters: - disable-all: true - enable: - - dupl - - errcheck - - exportloopref - - ginkgolinter - - goconst - - gocyclo - - gofmt - - goimports - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - prealloc - - revive - - staticcheck - - typecheck - - unconvert - - unparam - - unused - -linters-settings: - revive: - rules: - - name: comment-spacings diff --git a/testdata/project-v4-with-grafana/Dockerfile b/testdata/project-v4-with-grafana/Dockerfile deleted file mode 100644 index a48973ee7f3..00000000000 --- a/testdata/project-v4-with-grafana/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# Build the manager binary -FROM golang:1.22 AS builder -ARG TARGETOS -ARG TARGETARCH - -WORKDIR /workspace -# Copy the Go Modules manifests -COPY go.mod go.mod -COPY go.sum go.sum -# cache deps before building and copying source so that we don't need to re-download as much -# and so that source changes don't invalidate our downloaded layer -RUN go mod download - -# Copy the go source -COPY cmd/main.go cmd/main.go -COPY api/ api/ -COPY internal/controller/ internal/controller/ - -# Build -# the GOARCH has not a default value to allow the binary be built according to the host where the command -# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO -# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, -# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. -RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go - -# Use distroless as minimal base image to package the manager binary -# Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot -WORKDIR / -COPY --from=builder /workspace/manager . -USER 65532:65532 - -ENTRYPOINT ["/manager"] diff --git a/testdata/project-v4-with-grafana/Makefile b/testdata/project-v4-with-grafana/Makefile deleted file mode 100644 index 30d74e0ca24..00000000000 --- a/testdata/project-v4-with-grafana/Makefile +++ /dev/null @@ -1,212 +0,0 @@ -# Image URL to use all building/pushing image targets -IMG ?= controller:latest -# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. -ENVTEST_K8S_VERSION = 1.31.0 - -# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) -ifeq (,$(shell go env GOBIN)) -GOBIN=$(shell go env GOPATH)/bin -else -GOBIN=$(shell go env GOBIN) -endif - -# CONTAINER_TOOL defines the container tool to be used for building images. -# Be aware that the target commands are only tested with Docker which is -# scaffolded by default. However, you might want to replace it to use other -# tools. (i.e. podman) -CONTAINER_TOOL ?= docker - -# Setting SHELL to bash allows bash commands to be executed by recipes. -# Options are set to exit when a recipe line exits non-zero or a piped command fails. -SHELL = /usr/bin/env bash -o pipefail -.SHELLFLAGS = -ec - -.PHONY: all -all: build - -##@ General - -# The help target prints out all targets with their descriptions organized -# beneath their categories. The categories are represented by '##@' and the -# target descriptions by '##'. The awk command is responsible for reading the -# entire set of makefiles included in this invocation, looking for lines of the -# file as xyz: ## something, and then pretty-format the target and help. Then, -# if there's a line with ##@ something, that gets pretty-printed as a category. -# More info on the usage of ANSI control characters for terminal formatting: -# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters -# More info on the awk command: -# http://linuxcommand.org/lc3_adv_awk.php - -.PHONY: help -help: ## Display this help. - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) - -##@ Development - -.PHONY: manifests -manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. - $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases - -.PHONY: generate -generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. - $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." - -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - -.PHONY: test -test: manifests generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out - -# TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'. -# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally. -# Prometheus and CertManager are installed by default; skip with: -# - PROMETHEUS_INSTALL_SKIP=true -# - CERT_MANAGER_INSTALL_SKIP=true -.PHONY: test-e2e -test-e2e: ## Run the e2e tests. Expected an isolated environment using Kind. - @command -v kind >/dev/null 2>&1 || { \ - echo "Kind is not installed. Please install Kind manually."; \ - exit 1; \ - } - @kind get clusters | grep -q 'kind' || { \ - echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \ - exit 1; \ - } - go test ./test/e2e/ -v -ginkgo.v - -.PHONY: lint -lint: golangci-lint ## Run golangci-lint linter - $(GOLANGCI_LINT) run - -.PHONY: lint-fix -lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes - $(GOLANGCI_LINT) run --fix - -##@ Build - -.PHONY: build -build: manifests generate fmt vet ## Build manager binary. - go build -o bin/manager cmd/main.go - -.PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. - go run ./cmd/main.go - -# If you wish to build the manager image targeting other platforms you can use the --platform flag. -# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it. -# More info: https://docs.docker.com/develop/develop-images/build_enhancements/ -.PHONY: docker-build -docker-build: ## Build docker image with the manager. - $(CONTAINER_TOOL) build -t ${IMG} . - -.PHONY: docker-push -docker-push: ## Push docker image with the manager. - $(CONTAINER_TOOL) push ${IMG} - -# PLATFORMS defines the target platforms for the manager image be built to provide support to multiple -# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to: -# - be able to use docker buildx. More info: https://docs.docker.com/build/buildx/ -# - have enabled BuildKit. More info: https://docs.docker.com/develop/develop-images/build_enhancements/ -# - be able to push the image to your registry (i.e. if you do not set a valid value via IMG=> then the export will fail) -# To adequately provide solutions that are compatible with multiple platforms, you should consider using this option. -PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le -.PHONY: docker-buildx -docker-buildx: ## Build and push docker image for the manager for cross-platform support - # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile - sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross - - $(CONTAINER_TOOL) buildx create --name project-v4-with-grafana-builder - $(CONTAINER_TOOL) buildx use project-v4-with-grafana-builder - - $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . - - $(CONTAINER_TOOL) buildx rm project-v4-with-grafana-builder - rm Dockerfile.cross - -.PHONY: build-installer -build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment. - mkdir -p dist - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/default > dist/install.yaml - -##@ Deployment - -ifndef ignore-not-found - ignore-not-found = false -endif - -.PHONY: install -install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. - $(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f - - -.PHONY: uninstall -uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f - - -.PHONY: deploy -deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/default | $(KUBECTL) apply -f - - -.PHONY: undeploy -undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f - - -##@ Dependencies - -## Location to install dependencies to -LOCALBIN ?= $(shell pwd)/bin -$(LOCALBIN): - mkdir -p $(LOCALBIN) - -## Tool Binaries -KUBECTL ?= kubectl -KUSTOMIZE ?= $(LOCALBIN)/kustomize -CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen -ENVTEST ?= $(LOCALBIN)/setup-envtest -GOLANGCI_LINT = $(LOCALBIN)/golangci-lint - -## Tool Versions -KUSTOMIZE_VERSION ?= v5.4.3 -CONTROLLER_TOOLS_VERSION ?= v0.16.1 -ENVTEST_VERSION ?= release-0.19 -GOLANGCI_LINT_VERSION ?= v1.59.1 - -.PHONY: kustomize -kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. -$(KUSTOMIZE): $(LOCALBIN) - $(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION)) - -.PHONY: controller-gen -controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. -$(CONTROLLER_GEN): $(LOCALBIN) - $(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION)) - -.PHONY: envtest -envtest: $(ENVTEST) ## Download setup-envtest locally if necessary. -$(ENVTEST): $(LOCALBIN) - $(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION)) - -.PHONY: golangci-lint -golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. -$(GOLANGCI_LINT): $(LOCALBIN) - $(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION)) - -# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist -# $1 - target path with name of binary -# $2 - package url which can be installed -# $3 - specific version of package -define go-install-tool -@[ -f "$(1)-$(3)" ] || { \ -set -e; \ -package=$(2)@$(3) ;\ -echo "Downloading $${package}" ;\ -rm -f $(1) || true ;\ -GOBIN=$(LOCALBIN) go install $${package} ;\ -mv $(1) $(1)-$(3) ;\ -} ;\ -ln -sf $(1)-$(3) $(1) -endef diff --git a/testdata/project-v4-with-grafana/PROJECT b/testdata/project-v4-with-grafana/PROJECT deleted file mode 100644 index 35d0977d50f..00000000000 --- a/testdata/project-v4-with-grafana/PROJECT +++ /dev/null @@ -1,12 +0,0 @@ -# Code generated by tool. DO NOT EDIT. -# This file is used to track the info used to scaffold your project -# and allow the plugins properly work. -# More info: https://book.kubebuilder.io/reference/project-config.html -domain: testproject.org -layout: -- go.kubebuilder.io/v4 -plugins: - grafana.kubebuilder.io/v1-alpha: {} -projectName: project-v4-with-grafana -repo: sigs.k8s.io/kubebuilder/testdata/project-v4-with-grafana -version: "3" diff --git a/testdata/project-v4-with-grafana/README.md b/testdata/project-v4-with-grafana/README.md deleted file mode 100644 index a208300c1e6..00000000000 --- a/testdata/project-v4-with-grafana/README.md +++ /dev/null @@ -1,114 +0,0 @@ -# project-v4-with-grafana -// TODO(user): Add simple overview of use/purpose - -## Description -// TODO(user): An in-depth paragraph about your project and overview of use - -## Getting Started - -### Prerequisites -- go version v1.22.0+ -- docker version 17.03+. -- kubectl version v1.11.3+. -- Access to a Kubernetes v1.11.3+ cluster. - -### To Deploy on the cluster -**Build and push your image to the location specified by `IMG`:** - -```sh -make docker-build docker-push IMG=/project-v4-with-grafana:tag -``` - -**NOTE:** This image ought to be published in the personal registry you specified. -And it is required to have access to pull the image from the working environment. -Make sure you have the proper permission to the registry if the above commands don’t work. - -**Install the CRDs into the cluster:** - -```sh -make install -``` - -**Deploy the Manager to the cluster with the image specified by `IMG`:** - -```sh -make deploy IMG=/project-v4-with-grafana:tag -``` - -> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin -privileges or be logged in as admin. - -**Create instances of your solution** -You can apply the samples (examples) from the config/sample: - -```sh -kubectl apply -k config/samples/ -``` - ->**NOTE**: Ensure that the samples has default values to test it out. - -### To Uninstall -**Delete the instances (CRs) from the cluster:** - -```sh -kubectl delete -k config/samples/ -``` - -**Delete the APIs(CRDs) from the cluster:** - -```sh -make uninstall -``` - -**UnDeploy the controller from the cluster:** - -```sh -make undeploy -``` - -## Project Distribution - -Following are the steps to build the installer and distribute this project to users. - -1. Build the installer for the image built and published in the registry: - -```sh -make build-installer IMG=/project-v4-with-grafana:tag -``` - -NOTE: The makefile target mentioned above generates an 'install.yaml' -file in the dist directory. This file contains all the resources built -with Kustomize, which are necessary to install this project without -its dependencies. - -2. Using the installer - -Users can just run kubectl apply -f to install the project, i.e.: - -```sh -kubectl apply -f https://raw.githubusercontent.com//project-v4-with-grafana//dist/install.yaml -``` - -## Contributing -// TODO(user): Add detailed information on how you would like others to contribute to this project - -**NOTE:** Run `make help` for more information on all potential `make` targets - -More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html) - -## License - -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - diff --git a/testdata/project-v4-with-grafana/cmd/main.go b/testdata/project-v4-with-grafana/cmd/main.go deleted file mode 100644 index 1ddef472307..00000000000 --- a/testdata/project-v4-with-grafana/cmd/main.go +++ /dev/null @@ -1,159 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "crypto/tls" - "flag" - "os" - - // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) - // to ensure that exec-entrypoint and run can make use of them. - _ "k8s.io/client-go/plugin/pkg/client/auth" - - "k8s.io/apimachinery/pkg/runtime" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - clientgoscheme "k8s.io/client-go/kubernetes/scheme" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/healthz" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - "sigs.k8s.io/controller-runtime/pkg/metrics/filters" - metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" - "sigs.k8s.io/controller-runtime/pkg/webhook" - // +kubebuilder:scaffold:imports -) - -var ( - scheme = runtime.NewScheme() - setupLog = ctrl.Log.WithName("setup") -) - -func init() { - utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - - // +kubebuilder:scaffold:scheme -} - -func main() { - var metricsAddr string - var enableLeaderElection bool - var probeAddr string - var secureMetrics bool - var enableHTTP2 bool - var tlsOpts []func(*tls.Config) - flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. "+ - "Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.") - flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") - flag.BoolVar(&enableLeaderElection, "leader-elect", false, - "Enable leader election for controller manager. "+ - "Enabling this will ensure there is only one active controller manager.") - flag.BoolVar(&secureMetrics, "metrics-secure", true, - "If set, the metrics endpoint is served securely via HTTPS. Use --metrics-secure=false to use HTTP instead.") - flag.BoolVar(&enableHTTP2, "enable-http2", false, - "If set, HTTP/2 will be enabled for the metrics and webhook servers") - opts := zap.Options{ - Development: true, - } - opts.BindFlags(flag.CommandLine) - flag.Parse() - - ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) - - // if the enable-http2 flag is false (the default), http/2 should be disabled - // due to its vulnerabilities. More specifically, disabling http/2 will - // prevent from being vulnerable to the HTTP/2 Stream Cancellation and - // Rapid Reset CVEs. For more information see: - // - https://github.com/advisories/GHSA-qppj-fm5r-hxr3 - // - https://github.com/advisories/GHSA-4374-p667-p6c8 - disableHTTP2 := func(c *tls.Config) { - setupLog.Info("disabling http/2") - c.NextProtos = []string{"http/1.1"} - } - - if !enableHTTP2 { - tlsOpts = append(tlsOpts, disableHTTP2) - } - - webhookServer := webhook.NewServer(webhook.Options{ - TLSOpts: tlsOpts, - }) - - // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server. - // More info: - // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/metrics/server - // - https://book.kubebuilder.io/reference/metrics.html - metricsServerOptions := metricsserver.Options{ - BindAddress: metricsAddr, - SecureServing: secureMetrics, - // TODO(user): TLSOpts is used to allow configuring the TLS config used for the server. If certificates are - // not provided, self-signed certificates will be generated by default. This option is not recommended for - // production environments as self-signed certificates do not offer the same level of trust and security - // as certificates issued by a trusted Certificate Authority (CA). The primary risk is potentially allowing - // unauthorized access to sensitive metrics data. Consider replacing with CertDir, CertName, and KeyName - // to provide certificates, ensuring the server communicates using trusted and secure certificates. - TLSOpts: tlsOpts, - } - - if secureMetrics { - // FilterProvider is used to protect the metrics endpoint with authn/authz. - // These configurations ensure that only authorized users and service accounts - // can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info: - // https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/metrics/filters#WithAuthenticationAndAuthorization - metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization - } - - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ - Scheme: scheme, - Metrics: metricsServerOptions, - WebhookServer: webhookServer, - HealthProbeBindAddress: probeAddr, - LeaderElection: enableLeaderElection, - 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 - // speeds up voluntary leader transitions as the new leader don't have to wait - // LeaseDuration time first. - // - // In the default scaffold provided, the program ends immediately after - // the manager stops, so would be fine to enable this option. However, - // if you are doing or is intended to do any operation such as perform cleanups - // after the manager stops then its usage might be unsafe. - // LeaderElectionReleaseOnCancel: true, - }) - if err != nil { - setupLog.Error(err, "unable to start manager") - os.Exit(1) - } - - // +kubebuilder:scaffold:builder - - if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up health check") - os.Exit(1) - } - if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up ready check") - os.Exit(1) - } - - setupLog.Info("starting manager") - if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil { - setupLog.Error(err, "problem running manager") - os.Exit(1) - } -} diff --git a/testdata/project-v4-with-grafana/config/default/kustomization.yaml b/testdata/project-v4-with-grafana/config/default/kustomization.yaml deleted file mode 100644 index 2f83888dec7..00000000000 --- a/testdata/project-v4-with-grafana/config/default/kustomization.yaml +++ /dev/null @@ -1,151 +0,0 @@ -# Adds namespace to all resources. -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-grafana- - -# Labels to add to all resources and selectors. -#labels: -#- includeSelectors: true -# pairs: -# someName: someValue - -resources: -#- ../crd -- ../rbac -- ../manager -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in -# crd/kustomization.yaml -#- ../webhook -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required. -#- ../certmanager -# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. -#- ../prometheus -# [METRICS] Expose the controller manager metrics service. -- metrics_service.yaml -# [NETWORK POLICY] Protect the /metrics endpoint and Webhook Server with NetworkPolicy. -# Only Pod(s) running a namespace labeled with 'metrics: enabled' will be able to gather the metrics. -# Only CR(s) which requires webhooks and are applied on namespaces labeled with 'webhooks: enabled' will -# be able to communicate with the Webhook Server. -#- ../network-policy - -# Uncomment the patches line if you enable Metrics, and/or are using webhooks and cert-manager -patches: -# [METRICS] The following patch will enable the metrics endpoint using HTTPS and the port :8443. -# More info: https://book.kubebuilder.io/reference/metrics -- path: manager_metrics_patch.yaml - target: - kind: Deployment - -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in -# crd/kustomization.yaml -#- path: manager_webhook_patch.yaml - -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. -# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks. -# 'CERTMANAGER' needs to be enabled to use ca injection -#- path: webhookcainjection_patch.yaml - -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. -# Uncomment the following replacements to add the cert-manager CA injection annotations -#replacements: -# - source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -# fieldPath: .metadata.namespace # namespace of the certificate CR -# targets: -# - select: -# kind: ValidatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - select: -# kind: MutatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - select: -# kind: CustomResourceDefinition -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - source: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -# fieldPath: .metadata.name -# targets: -# - select: -# kind: ValidatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - select: -# kind: MutatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - select: -# kind: CustomResourceDefinition -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - source: # Add cert-manager annotation to the webhook Service -# kind: Service -# version: v1 -# name: webhook-service -# fieldPath: .metadata.name # namespace of the service -# targets: -# - select: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# fieldPaths: -# - .spec.dnsNames.0 -# - .spec.dnsNames.1 -# options: -# delimiter: '.' -# index: 0 -# create: true -# - source: -# kind: Service -# version: v1 -# name: webhook-service -# fieldPath: .metadata.namespace # namespace of the service -# targets: -# - select: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# fieldPaths: -# - .spec.dnsNames.0 -# - .spec.dnsNames.1 -# options: -# delimiter: '.' -# index: 1 -# create: true diff --git a/testdata/project-v4-with-grafana/config/default/manager_metrics_patch.yaml b/testdata/project-v4-with-grafana/config/default/manager_metrics_patch.yaml deleted file mode 100644 index 2aaef6536f4..00000000000 --- a/testdata/project-v4-with-grafana/config/default/manager_metrics_patch.yaml +++ /dev/null @@ -1,4 +0,0 @@ -# This patch adds the args to allow exposing the metrics endpoint using HTTPS -- op: add - path: /spec/template/spec/containers/0/args/0 - value: --metrics-bind-address=:8443 diff --git a/testdata/project-v4-with-grafana/config/manager/kustomization.yaml b/testdata/project-v4-with-grafana/config/manager/kustomization.yaml deleted file mode 100644 index ad13e96b3fc..00000000000 --- a/testdata/project-v4-with-grafana/config/manager/kustomization.yaml +++ /dev/null @@ -1,8 +0,0 @@ -resources: -- manager.yaml -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -images: -- name: controller - newName: controller - newTag: latest diff --git a/testdata/project-v4-with-grafana/config/manager/manager.yaml b/testdata/project-v4-with-grafana/config/manager/manager.yaml deleted file mode 100644 index f64bc38baf0..00000000000 --- a/testdata/project-v4-with-grafana/config/manager/manager.yaml +++ /dev/null @@ -1,95 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - labels: - control-plane: controller-manager - app.kubernetes.io/name: project-v4-with-grafana - app.kubernetes.io/managed-by: kustomize - name: system ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: controller-manager - namespace: system - labels: - control-plane: controller-manager - app.kubernetes.io/name: project-v4-with-grafana - app.kubernetes.io/managed-by: kustomize -spec: - selector: - matchLabels: - control-plane: controller-manager - replicas: 1 - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: manager - labels: - control-plane: controller-manager - spec: - # TODO(user): Uncomment the following code to configure the nodeAffinity expression - # according to the platforms which are supported by your solution. - # It is considered best practice to support multiple architectures. You can - # build your manager image using the makefile target docker-buildx. - # affinity: - # nodeAffinity: - # requiredDuringSchedulingIgnoredDuringExecution: - # nodeSelectorTerms: - # - matchExpressions: - # - key: kubernetes.io/arch - # operator: In - # values: - # - amd64 - # - arm64 - # - ppc64le - # - s390x - # - key: kubernetes.io/os - # operator: In - # values: - # - linux - securityContext: - runAsNonRoot: true - # TODO(user): For common cases that do not require escalating privileges - # it is recommended to ensure that all your Pods/Containers are restrictive. - # More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted - # Please uncomment the following code if your project does NOT have to work on old Kubernetes - # versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ). - # seccompProfile: - # type: RuntimeDefault - containers: - - command: - - /manager - args: - - --leader-elect - - --health-probe-bind-address=:8081 - image: controller:latest - name: manager - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - "ALL" - livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - # TODO(user): Configure the resources accordingly based on the project requirements. - # More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - serviceAccountName: controller-manager - terminationGracePeriodSeconds: 10 diff --git a/testdata/project-v4-with-grafana/config/network-policy/allow-metrics-traffic.yaml b/testdata/project-v4-with-grafana/config/network-policy/allow-metrics-traffic.yaml deleted file mode 100644 index 87772311883..00000000000 --- a/testdata/project-v4-with-grafana/config/network-policy/allow-metrics-traffic.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# This NetworkPolicy allows ingress traffic -# with Pods running on namespaces labeled with 'metrics: enabled'. Only Pods on those -# namespaces are able to gathering data from the metrics endpoint. -apiVersion: networking.k8s.io/v1 -kind: NetworkPolicy -metadata: - labels: - app.kubernetes.io/name: project-v4-with-grafana - app.kubernetes.io/managed-by: kustomize - name: allow-metrics-traffic - namespace: system -spec: - podSelector: - matchLabels: - control-plane: controller-manager - policyTypes: - - Ingress - ingress: - # This allows ingress traffic from any namespace with the label metrics: enabled - - from: - - namespaceSelector: - matchLabels: - metrics: enabled # Only from namespaces with this label - ports: - - port: 8443 - protocol: TCP diff --git a/testdata/project-v4-with-grafana/config/network-policy/kustomization.yaml b/testdata/project-v4-with-grafana/config/network-policy/kustomization.yaml deleted file mode 100644 index ec0fb5e57df..00000000000 --- a/testdata/project-v4-with-grafana/config/network-policy/kustomization.yaml +++ /dev/null @@ -1,2 +0,0 @@ -resources: -- allow-metrics-traffic.yaml diff --git a/testdata/project-v4-with-grafana/config/prometheus/kustomization.yaml b/testdata/project-v4-with-grafana/config/prometheus/kustomization.yaml deleted file mode 100644 index ed137168a1d..00000000000 --- a/testdata/project-v4-with-grafana/config/prometheus/kustomization.yaml +++ /dev/null @@ -1,2 +0,0 @@ -resources: -- monitor.yaml diff --git a/testdata/project-v4-with-grafana/config/prometheus/monitor.yaml b/testdata/project-v4-with-grafana/config/prometheus/monitor.yaml deleted file mode 100644 index 4db5a1f1396..00000000000 --- a/testdata/project-v4-with-grafana/config/prometheus/monitor.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Prometheus Monitor Service (Metrics) -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - labels: - control-plane: controller-manager - app.kubernetes.io/name: project-v4-with-grafana - app.kubernetes.io/managed-by: kustomize - name: controller-manager-metrics-monitor - namespace: system -spec: - endpoints: - - path: /metrics - port: https # Ensure this is the name of the port that exposes HTTPS metrics - scheme: https - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token - tlsConfig: - # TODO(user): The option insecureSkipVerify: true is not recommended for production since it disables - # certificate verification. This poses a significant security risk by making the system vulnerable to - # man-in-the-middle attacks, where an attacker could intercept and manipulate the communication between - # Prometheus and the monitored services. This could lead to unauthorized access to sensitive metrics data, - # compromising the integrity and confidentiality of the information. - # Please use the following options for secure configurations: - # caFile: /etc/metrics-certs/ca.crt - # certFile: /etc/metrics-certs/tls.crt - # keyFile: /etc/metrics-certs/tls.key - insecureSkipVerify: true - selector: - matchLabels: - control-plane: controller-manager diff --git a/testdata/project-v4-with-grafana/config/rbac/kustomization.yaml b/testdata/project-v4-with-grafana/config/rbac/kustomization.yaml deleted file mode 100644 index 5619aa00943..00000000000 --- a/testdata/project-v4-with-grafana/config/rbac/kustomization.yaml +++ /dev/null @@ -1,20 +0,0 @@ -resources: -# All RBAC will be applied under this service account in -# the deployment namespace. You may comment out this resource -# if your manager will use a service account that exists at -# runtime. Be sure to update RoleBinding and ClusterRoleBinding -# subjects if changing service account names. -- service_account.yaml -- role.yaml -- role_binding.yaml -- leader_election_role.yaml -- leader_election_role_binding.yaml -# The following RBAC configurations are used to protect -# the metrics endpoint with authn/authz. These configurations -# ensure that only authorized users and service accounts -# can access the metrics endpoint. Comment the following -# permissions if you want to disable this protection. -# More info: https://book.kubebuilder.io/reference/metrics.html -- metrics_auth_role.yaml -- metrics_auth_role_binding.yaml -- metrics_reader_role.yaml diff --git a/testdata/project-v4-with-grafana/config/rbac/leader_election_role.yaml b/testdata/project-v4-with-grafana/config/rbac/leader_election_role.yaml deleted file mode 100644 index 67c3dc38640..00000000000 --- a/testdata/project-v4-with-grafana/config/rbac/leader_election_role.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# permissions to do leader election. -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - labels: - app.kubernetes.io/name: project-v4-with-grafana - app.kubernetes.io/managed-by: kustomize - name: leader-election-role -rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch diff --git a/testdata/project-v4-with-grafana/config/rbac/metrics_auth_role.yaml b/testdata/project-v4-with-grafana/config/rbac/metrics_auth_role.yaml deleted file mode 100644 index 32d2e4ec6b0..00000000000 --- a/testdata/project-v4-with-grafana/config/rbac/metrics_auth_role.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: metrics-auth-role -rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create diff --git a/testdata/project-v4-with-grafana/config/rbac/metrics_auth_role_binding.yaml b/testdata/project-v4-with-grafana/config/rbac/metrics_auth_role_binding.yaml deleted file mode 100644 index e775d67ff08..00000000000 --- a/testdata/project-v4-with-grafana/config/rbac/metrics_auth_role_binding.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: metrics-auth-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: metrics-auth-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/testdata/project-v4-with-grafana/config/rbac/metrics_reader_role.yaml b/testdata/project-v4-with-grafana/config/rbac/metrics_reader_role.yaml deleted file mode 100644 index 51a75db47a5..00000000000 --- a/testdata/project-v4-with-grafana/config/rbac/metrics_reader_role.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: metrics-reader -rules: -- nonResourceURLs: - - "/metrics" - verbs: - - get diff --git a/testdata/project-v4-with-grafana/config/rbac/role.yaml b/testdata/project-v4-with-grafana/config/rbac/role.yaml deleted file mode 100644 index cb2161ed361..00000000000 --- a/testdata/project-v4-with-grafana/config/rbac/role.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: project-v4-with-grafana - app.kubernetes.io/managed-by: kustomize - name: manager-role -rules: -- apiGroups: [""] - resources: ["pods"] - verbs: ["get", "list", "watch"] diff --git a/testdata/project-v4-with-grafana/config/rbac/role_binding.yaml b/testdata/project-v4-with-grafana/config/rbac/role_binding.yaml deleted file mode 100644 index ea0f0189035..00000000000 --- a/testdata/project-v4-with-grafana/config/rbac/role_binding.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/name: project-v4-with-grafana - app.kubernetes.io/managed-by: kustomize - name: manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: manager-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/testdata/project-v4-with-grafana/dist/install.yaml b/testdata/project-v4-with-grafana/dist/install.yaml deleted file mode 100644 index ac9427cd5ef..00000000000 --- a/testdata/project-v4-with-grafana/dist/install.yaml +++ /dev/null @@ -1,226 +0,0 @@ -apiVersion: v1 -kind: Namespace -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-system ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-with-grafana - name: project-v4-with-grafana-controller-manager - namespace: project-v4-with-grafana-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-with-grafana - name: project-v4-with-grafana-leader-election-role - namespace: project-v4-with-grafana-system -rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-with-grafana - name: project-v4-with-grafana-manager-role -rules: -- apiGroups: - - "" - resources: - - pods - verbs: - - get - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: project-v4-with-grafana-metrics-auth-role -rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: project-v4-with-grafana-metrics-reader -rules: -- nonResourceURLs: - - /metrics - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-with-grafana - name: project-v4-with-grafana-leader-election-rolebinding - namespace: project-v4-with-grafana-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: project-v4-with-grafana-leader-election-role -subjects: -- kind: ServiceAccount - name: project-v4-with-grafana-controller-manager - namespace: project-v4-with-grafana-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: project-v4-with-grafana - name: project-v4-with-grafana-manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: project-v4-with-grafana-manager-role -subjects: -- kind: ServiceAccount - name: project-v4-with-grafana-controller-manager - namespace: project-v4-with-grafana-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: project-v4-with-grafana-metrics-auth-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: project-v4-with-grafana-metrics-auth-role -subjects: -- kind: ServiceAccount - 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: https - port: 8443 - protocol: TCP - targetPort: 8443 - selector: - control-plane: controller-manager ---- -apiVersion: apps/v1 -kind: Deployment -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 - namespace: project-v4-with-grafana-system -spec: - replicas: 1 - selector: - matchLabels: - control-plane: controller-manager - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: manager - labels: - control-plane: controller-manager - spec: - containers: - - args: - - --metrics-bind-address=:8443 - - --leader-elect - - --health-probe-bind-address=:8081 - command: - - /manager - image: controller:latest - livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - name: manager - readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - securityContext: - runAsNonRoot: true - serviceAccountName: project-v4-with-grafana-controller-manager - terminationGracePeriodSeconds: 10 diff --git a/testdata/project-v4-with-grafana/go.mod b/testdata/project-v4-with-grafana/go.mod deleted file mode 100644 index 8fe09c6d773..00000000000 --- a/testdata/project-v4-with-grafana/go.mod +++ /dev/null @@ -1,98 +0,0 @@ -module sigs.k8s.io/kubebuilder/testdata/project-v4-with-grafana - -go 1.22.0 - -require ( - github.com/onsi/ginkgo/v2 v2.19.0 - github.com/onsi/gomega v1.33.1 - k8s.io/apimachinery v0.31.0 - k8s.io/client-go v0.31.0 - sigs.k8s.io/controller-runtime v0.19.0 -) - -require ( - github.com/antlr4-go/antlr/v4 v4.13.0 // indirect - github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect - github.com/beorn7/perks v1.0.1 // indirect - github.com/blang/semver/v4 v4.0.0 // indirect - github.com/cenkalti/backoff/v4 v4.3.0 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch/v5 v5.9.0 // indirect - github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/fxamacker/cbor/v2 v2.7.0 // indirect - github.com/go-logr/logr v1.4.2 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-logr/zapr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.4 // indirect - github.com/go-task/slim-sprig/v3 v3.0.0 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.4 // indirect - github.com/google/cel-go v0.20.1 // indirect - github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/go-cmp v0.6.0 // indirect - github.com/google/gofuzz v1.2.0 // indirect - github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect - github.com/imdario/mergo v0.3.6 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/mailru/easyjson v0.7.7 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect - github.com/prometheus/procfs v0.15.1 // indirect - github.com/spf13/cobra v1.8.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/stoewer/go-strcase v1.2.0 // indirect - github.com/x448/float16 v0.8.4 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect - go.opentelemetry.io/otel v1.28.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect - go.opentelemetry.io/otel/metric v1.28.0 // indirect - go.opentelemetry.io/otel/sdk v1.28.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect - go.opentelemetry.io/proto/otlp v1.3.1 // indirect - go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.26.0 // indirect - golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/grpc v1.65.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/api v0.31.0 // indirect - k8s.io/apiextensions-apiserver v0.31.0 // indirect - k8s.io/apiserver v0.31.0 // indirect - k8s.io/component-base v0.31.0 // indirect - k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect - k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect - sigs.k8s.io/yaml v1.4.0 // indirect -) diff --git a/testdata/project-v4-with-grafana/grafana/controller-resources-metrics.json b/testdata/project-v4-with-grafana/grafana/controller-resources-metrics.json deleted file mode 100644 index 629e0d3c9b1..00000000000 --- a/testdata/project-v4-with-grafana/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-grafana/grafana/controller-runtime-metrics.json b/testdata/project-v4-with-grafana/grafana/controller-runtime-metrics.json deleted file mode 100644 index c8eea4cb434..00000000000 --- a/testdata/project-v4-with-grafana/grafana/controller-runtime-metrics.json +++ /dev/null @@ -1,898 +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}", - "fieldConfig": { - "defaults": { - "mappings": [], - "thresholds": { - "mode": "percentage", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "orange", - "value": 70 - }, - { - "color": "red", - "value": 85 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 3, - "x": 0, - "y": 1 - }, - "id": 24, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": true - }, - "pluginVersion": "9.5.3", - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "controller_runtime_active_workers{job=\"$job\", namespace=\"$namespace\"}", - "interval": "", - "legendFormat": "{{controller}} {{instance}}", - "refId": "A" - } - ], - "title": "Number of workers in use", - "type": "gauge" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "Total number of reconciliations per controller", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "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": 8, - "w": 11, - "x": 3, - "y": 1 - }, - "id": 7, - "options": { - "legend": { - "calcs": [], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "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": { - "axisCenteredZero": false, - "axisColorMode": "text", - "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": 8, - "w": 10, - "x": 14, - "y": 1 - }, - "id": 6, - "options": { - "legend": { - "calcs": [], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "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": 9 - }, - "id": 11, - "panels": [], - "title": "Work Queue Metrics", - "type": "row" - }, - { - "datasource": "${DS_PROMETHEUS}", - "fieldConfig": { - "defaults": { - "mappings": [], - "thresholds": { - "mode": "percentage", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "orange", - "value": 70 - }, - { - "color": "red", - "value": 85 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 3, - "x": 0, - "y": 10 - }, - "id": 22, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": true - }, - "pluginVersion": "9.5.3", - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "workqueue_depth{job=\"$job\", namespace=\"$namespace\"}", - "interval": "", - "legendFormat": "", - "refId": "A" - } - ], - "title": "WorkQueue Depth", - "type": "gauge" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "How long in seconds an item stays in workqueue before being requested", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "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": 8, - "w": 11, - "x": 3, - "y": 10 - }, - "id": 13, - "options": { - "legend": { - "calcs": [ - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "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": { - "axisCenteredZero": false, - "axisColorMode": "text", - "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": 8, - "w": 10, - "x": 14, - "y": 10 - }, - "id": 15, - "options": { - "legend": { - "calcs": [], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "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 many seconds of work has done that is in progress and hasn't been observed by work_duration.\nLarge values indicate stuck threads.\nOne can deduce the number of stuck threads by observing the rate at which this increases.", - "fieldConfig": { - "defaults": { - "mappings": [], - "thresholds": { - "mode": "percentage", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "orange", - "value": 70 - }, - { - "color": "red", - "value": 85 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 9, - "w": 3, - "x": 0, - "y": 18 - }, - "id": 23, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": true - }, - "pluginVersion": "9.5.3", - "targets": [ - { - "datasource": "${DS_PROMETHEUS}", - "exemplar": true, - "expr": "rate(workqueue_unfinished_work_seconds{job=\"$job\", namespace=\"$namespace\"}[5m])", - "interval": "", - "legendFormat": "", - "refId": "A" - } - ], - "title": "Unfinished Seconds", - "type": "gauge" - }, - { - "datasource": "${DS_PROMETHEUS}", - "description": "How long in seconds processing an item from workqueue takes.", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "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": 9, - "w": 11, - "x": 3, - "y": 18 - }, - "id": 19, - "options": { - "legend": { - "calcs": [ - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "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": { - "axisCenteredZero": false, - "axisColorMode": "text", - "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": 9, - "w": 10, - "x": 14, - "y": 18 - }, - "id": 17, - "options": { - "legend": { - "calcs": [], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "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-grafana/grafana/custom-metrics/config.yaml b/testdata/project-v4-with-grafana/grafana/custom-metrics/config.yaml deleted file mode 100644 index 3ee1bebdf24..00000000000 --- a/testdata/project-v4-with-grafana/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-grafana/hack/boilerplate.go.txt b/testdata/project-v4-with-grafana/hack/boilerplate.go.txt deleted file mode 100644 index 0d32012672a..00000000000 --- a/testdata/project-v4-with-grafana/hack/boilerplate.go.txt +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ \ No newline at end of file diff --git a/testdata/project-v4-with-grafana/test/e2e/e2e_suite_test.go b/testdata/project-v4-with-grafana/test/e2e/e2e_suite_test.go deleted file mode 100644 index f006e422db7..00000000000 --- a/testdata/project-v4-with-grafana/test/e2e/e2e_suite_test.go +++ /dev/null @@ -1,117 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package e2e - -import ( - "fmt" - "os" - "os/exec" - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "sigs.k8s.io/kubebuilder/testdata/project-v4-with-grafana/test/utils" -) - -var ( - // Optional Environment Variables: - // - PROMETHEUS_INSTALL_SKIP=true: Skips Prometheus Operator installation during test setup. - // - CERT_MANAGER_INSTALL_SKIP=true: Skips CertManager installation during test setup. - // These variables are useful if Prometheus or CertManager is already installed, avoiding - // re-installation and conflicts. - skipPrometheusInstall = os.Getenv("PROMETHEUS_INSTALL_SKIP") == "true" - skipCertManagerInstall = os.Getenv("CERT_MANAGER_INSTALL_SKIP") == "true" - // isPrometheusOperatorAlreadyInstalled will be set true when prometheus CRDs be found on the cluster - isPrometheusOperatorAlreadyInstalled = false - // isCertManagerAlreadyInstalled will be set true when CertManager CRDs be found on the cluster - isCertManagerAlreadyInstalled = false - - // projectImage is the name of the image which will be build and loaded - // with the code source changes to be tested. - projectImage = "example.com/project-v4-with-grafana:v0.0.1" -) - -// TestE2E runs the end-to-end (e2e) test suite for the project. These tests execute in an isolated, -// temporary environment to validate project changes with the the purposed to be used in CI jobs. -// The default setup requires Kind, builds/loads the Manager Docker image locally, and installs -// CertManager and Prometheus. -func TestE2E(t *testing.T) { - RegisterFailHandler(Fail) - _, _ = fmt.Fprintf(GinkgoWriter, "Starting project-v4-with-grafana integration test suite\n") - RunSpecs(t, "e2e suite") -} - -var _ = BeforeSuite(func() { - By("generating files") - cmd := exec.Command("make", "generate") - _, err := utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to run make generate") - - By("generating manifests") - cmd = exec.Command("make", "manifests") - _, err = utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to run make manifests") - - By("building the manager(Operator) image") - cmd = exec.Command("make", "docker-build", fmt.Sprintf("IMG=%s", projectImage)) - _, err = utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to build the manager(Operator) image") - - // TODO(user): If you want to change the e2e test vendor from Kind, ensure the image is - // built and available before running the tests. Also, remove the following block. - By("loading the manager(Operator) image on Kind") - err = utils.LoadImageToKindClusterWithName(projectImage) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to load the manager(Operator) image into Kind") - - // The tests-e2e are intended to run on a temporary cluster that is created and destroyed for testing. - // To prevent errors when tests run in environments with Prometheus or CertManager already installed, - // we check for their presence before execution. - // Setup Prometheus and CertManager before the suite if not skipped and if not already installed - if !skipPrometheusInstall { - By("checking if prometheus is installed already") - isPrometheusOperatorAlreadyInstalled = utils.IsPrometheusCRDsInstalled() - if !isPrometheusOperatorAlreadyInstalled { - _, _ = fmt.Fprintf(GinkgoWriter, "Installing Prometheus Operator...\n") - Expect(utils.InstallPrometheusOperator()).To(Succeed(), "Failed to install Prometheus Operator") - } else { - _, _ = fmt.Fprintf(GinkgoWriter, "WARNING: Prometheus Operator is already installed. Skipping installation...\n") - } - } - if !skipCertManagerInstall { - By("checking if cert manager is installed already") - isCertManagerAlreadyInstalled = utils.IsCertManagerCRDsInstalled() - if !isCertManagerAlreadyInstalled { - _, _ = fmt.Fprintf(GinkgoWriter, "Installing CertManager...\n") - Expect(utils.InstallCertManager()).To(Succeed(), "Failed to install CertManager") - } else { - _, _ = fmt.Fprintf(GinkgoWriter, "WARNING: CertManager is already installed. Skipping installation...\n") - } - } -}) - -var _ = AfterSuite(func() { - // Teardown Prometheus and CertManager after the suite if not skipped and if they were not already installed - if !skipPrometheusInstall && !isPrometheusOperatorAlreadyInstalled { - _, _ = fmt.Fprintf(GinkgoWriter, "Uninstalling Prometheus Operator...\n") - utils.UninstallPrometheusOperator() - } - if !skipCertManagerInstall && !isCertManagerAlreadyInstalled { - _, _ = fmt.Fprintf(GinkgoWriter, "Uninstalling CertManager...\n") - utils.UninstallCertManager() - } -}) diff --git a/testdata/project-v4-with-grafana/test/e2e/e2e_test.go b/testdata/project-v4-with-grafana/test/e2e/e2e_test.go deleted file mode 100644 index a26e626abbe..00000000000 --- a/testdata/project-v4-with-grafana/test/e2e/e2e_test.go +++ /dev/null @@ -1,114 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package e2e - -import ( - "fmt" - "os/exec" - "time" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "sigs.k8s.io/kubebuilder/testdata/project-v4-with-grafana/test/utils" -) - -const namespace = "project-v4-with-grafana-system" - -// Define a set of end-to-end (e2e) tests to validate the behavior of the controller. -var _ = Describe("controller", Ordered, func() { - // Before running the tests, set up the environment by creating the namespace, - // installing CRDs, and deploying the controller. - BeforeAll(func() { - By("creating manager namespace") - cmd := exec.Command("kubectl", "create", "ns", namespace) - _, err := utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to create namespace") - - By("installing CRDs") - cmd = exec.Command("make", "install") - _, err = utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to install CRDs") - - By("deploying the controller-manager") - cmd = exec.Command("make", "deploy", fmt.Sprintf("IMG=%s", projectImage)) - _, err = utils.Run(cmd) - ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to deploy the controller-manager") - }) - - // After all tests have been executed, clean up by undeploying the controller, uninstalling CRDs, - // and deleting the namespace. - AfterAll(func() { - By("undeploying the controller-manager") - cmd := exec.Command("make", "undeploy") - _, _ = utils.Run(cmd) - - By("uninstalling CRDs") - cmd = exec.Command("make", "uninstall") - _, _ = utils.Run(cmd) - - By("removing manager namespace") - cmd = exec.Command("kubectl", "delete", "ns", namespace) - _, _ = utils.Run(cmd) - }) - - // The Context block contains the actual tests that validate the operator's behavior. - Context("Operator", func() { - It("should run successfully", func() { - var controllerPodName string - - By("validating that the controller-manager pod is running as expected") - verifyControllerUp := func() error { - // Get the name of the controller-manager pod - cmd := exec.Command("kubectl", "get", - "pods", "-l", "control-plane=controller-manager", - "-o", "go-template={{ range .items }}"+ - "{{ if not .metadata.deletionTimestamp }}"+ - "{{ .metadata.name }}"+ - "{{ \"\\n\" }}{{ end }}{{ end }}", - "-n", namespace, - ) - - podOutput, err := utils.Run(cmd) - ExpectWithOffset(2, err).NotTo(HaveOccurred(), "Failed to retrieve controller-manager pod information") - podNames := utils.GetNonEmptyLines(string(podOutput)) - if len(podNames) != 1 { - return fmt.Errorf("expected 1 controller pod running, but got %d", len(podNames)) - } - controllerPodName = podNames[0] - ExpectWithOffset(2, controllerPodName).Should(ContainSubstring("controller-manager")) - - // Validate the pod's status - cmd = exec.Command("kubectl", "get", - "pods", controllerPodName, "-o", "jsonpath={.status.phase}", - "-n", namespace, - ) - status, err := utils.Run(cmd) - ExpectWithOffset(2, err).NotTo(HaveOccurred(), "Failed to retrieve controller-manager pod status") - if string(status) != "Running" { - return fmt.Errorf("controller pod in %s status", status) - } - return nil - } - // Repeatedly check if the controller-manager pod is running until it succeeds or times out. - EventuallyWithOffset(1, verifyControllerUp, time.Minute, time.Second).Should(Succeed()) - }) - - // TODO(user): Customize the e2e test suite to include - // additional scenarios specific to your project. - }) -}) diff --git a/testdata/project-v4-with-grafana/test/utils/utils.go b/testdata/project-v4-with-grafana/test/utils/utils.go deleted file mode 100644 index 777825397c5..00000000000 --- a/testdata/project-v4-with-grafana/test/utils/utils.go +++ /dev/null @@ -1,200 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package utils - -import ( - "fmt" - "os" - "os/exec" - "strings" - - . "github.com/onsi/ginkgo/v2" //nolint:golint,revive -) - -const ( - prometheusOperatorVersion = "v0.72.0" - prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" + - "releases/download/%s/bundle.yaml" - - certmanagerVersion = "v1.14.4" - certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml" -) - -func warnError(err error) { - _, _ = fmt.Fprintf(GinkgoWriter, "warning: %v\n", err) -} - -// Run executes the provided command within this context -func Run(cmd *exec.Cmd) ([]byte, error) { - dir, _ := GetProjectDir() - cmd.Dir = dir - - if err := os.Chdir(cmd.Dir); err != nil { - _, _ = fmt.Fprintf(GinkgoWriter, "chdir dir: %s\n", err) - } - - cmd.Env = append(os.Environ(), "GO111MODULE=on") - command := strings.Join(cmd.Args, " ") - _, _ = fmt.Fprintf(GinkgoWriter, "running: %s\n", command) - output, err := cmd.CombinedOutput() - if err != nil { - return output, fmt.Errorf("%s failed with error: (%v) %s", command, err, string(output)) - } - - return output, nil -} - -// InstallPrometheusOperator installs the prometheus Operator to be used to export the enabled metrics. -func InstallPrometheusOperator() error { - url := fmt.Sprintf(prometheusOperatorURL, prometheusOperatorVersion) - cmd := exec.Command("kubectl", "create", "-f", url) - _, err := Run(cmd) - return err -} - -// UninstallPrometheusOperator uninstalls the prometheus -func UninstallPrometheusOperator() { - url := fmt.Sprintf(prometheusOperatorURL, prometheusOperatorVersion) - cmd := exec.Command("kubectl", "delete", "-f", url) - if _, err := Run(cmd); err != nil { - warnError(err) - } -} - -// IsPrometheusCRDsInstalled checks if any Prometheus CRDs are installed -// by verifying the existence of key CRDs related to Prometheus. -func IsPrometheusCRDsInstalled() bool { - // List of common Prometheus CRDs - prometheusCRDs := []string{ - "prometheuses.monitoring.coreos.com", - "prometheusrules.monitoring.coreos.com", - "prometheusagents.monitoring.coreos.com", - } - - cmd := exec.Command("kubectl", "get", "crds", "-o", "custom-columns=NAME:.metadata.name") - output, err := Run(cmd) - if err != nil { - return false - } - crdList := GetNonEmptyLines(string(output)) - for _, crd := range prometheusCRDs { - for _, line := range crdList { - if strings.Contains(line, crd) { - return true - } - } - } - - return false -} - -// UninstallCertManager uninstalls the cert manager -func UninstallCertManager() { - url := fmt.Sprintf(certmanagerURLTmpl, certmanagerVersion) - cmd := exec.Command("kubectl", "delete", "-f", url) - if _, err := Run(cmd); err != nil { - warnError(err) - } -} - -// InstallCertManager installs the cert manager bundle. -func InstallCertManager() error { - url := fmt.Sprintf(certmanagerURLTmpl, certmanagerVersion) - cmd := exec.Command("kubectl", "apply", "-f", url) - if _, err := Run(cmd); err != nil { - return err - } - // Wait for cert-manager-webhook to be ready, which can take time if cert-manager - // was re-installed after uninstalling on a cluster. - cmd = exec.Command("kubectl", "wait", "deployment.apps/cert-manager-webhook", - "--for", "condition=Available", - "--namespace", "cert-manager", - "--timeout", "5m", - ) - - _, err := Run(cmd) - return err -} - -// IsCertManagerCRDsInstalled checks if any Cert Manager CRDs are installed -// by verifying the existence of key CRDs related to Cert Manager. -func IsCertManagerCRDsInstalled() bool { - // List of common Cert Manager CRDs - certManagerCRDs := []string{ - "certificates.cert-manager.io", - "issuers.cert-manager.io", - "clusterissuers.cert-manager.io", - "certificaterequests.cert-manager.io", - "orders.acme.cert-manager.io", - "challenges.acme.cert-manager.io", - } - - // Execute the kubectl command to get all CRDs - cmd := exec.Command("kubectl", "get", "crds") - output, err := Run(cmd) - if err != nil { - return false - } - - // Check if any of the Cert Manager CRDs are present - crdList := GetNonEmptyLines(string(output)) - for _, crd := range certManagerCRDs { - for _, line := range crdList { - if strings.Contains(line, crd) { - return true - } - } - } - - return false -} - -// LoadImageToKindClusterWithName loads a local docker image to the kind cluster -func LoadImageToKindClusterWithName(name string) error { - cluster := "kind" - if v, ok := os.LookupEnv("KIND_CLUSTER"); ok { - cluster = v - } - kindOptions := []string{"load", "docker-image", name, "--name", cluster} - cmd := exec.Command("kind", kindOptions...) - _, err := Run(cmd) - return err -} - -// GetNonEmptyLines converts given command output string into individual objects -// according to line breakers, and ignores the empty elements in it. -func GetNonEmptyLines(output string) []string { - var res []string - elements := strings.Split(output, "\n") - for _, element := range elements { - if element != "" { - res = append(res, element) - } - } - - return res -} - -// GetProjectDir will return the directory where the project is -func GetProjectDir() (string, error) { - wd, err := os.Getwd() - if err != nil { - return wd, err - } - wd = strings.Replace(wd, "/test/e2e", "", -1) - return wd, nil -} diff --git a/testdata/project-v4/PROJECT b/testdata/project-v4/PROJECT index 34bad47aa95..91fdfce8a83 100644 --- a/testdata/project-v4/PROJECT +++ b/testdata/project-v4/PROJECT @@ -45,9 +45,4 @@ resources: webhooks: defaulting: true webhookVersion: v1 -- controller: true - domain: testproject.org - group: crew - kind: Laker - version: v1 version: "3" diff --git a/testdata/project-v4/cmd/main.go b/testdata/project-v4/cmd/main.go index a24d5e1bfd2..d2a65954c40 100644 --- a/testdata/project-v4/cmd/main.go +++ b/testdata/project-v4/cmd/main.go @@ -186,13 +186,6 @@ func main() { os.Exit(1) } } - if err = (&controller.LakerReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Laker") - os.Exit(1) - } // +kubebuilder:scaffold:builder if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { diff --git a/testdata/project-v4/config/rbac/role.yaml b/testdata/project-v4/config/rbac/role.yaml index 8072117768f..f9d77efa7db 100644 --- a/testdata/project-v4/config/rbac/role.yaml +++ b/testdata/project-v4/config/rbac/role.yaml @@ -10,7 +10,6 @@ rules: - admirales - captains - firstmates - - lakers verbs: - create - delete @@ -25,7 +24,6 @@ rules: - admirales/finalizers - captains/finalizers - firstmates/finalizers - - lakers/finalizers verbs: - update - apiGroups: @@ -34,7 +32,6 @@ rules: - admirales/status - captains/status - firstmates/status - - lakers/status verbs: - get - patch diff --git a/testdata/project-v4/dist/install.yaml b/testdata/project-v4/dist/install.yaml index bc38bce7813..823e2c8d6cc 100644 --- a/testdata/project-v4/dist/install.yaml +++ b/testdata/project-v4/dist/install.yaml @@ -410,7 +410,6 @@ rules: - admirales - captains - firstmates - - lakers verbs: - create - delete @@ -425,7 +424,6 @@ rules: - admirales/finalizers - captains/finalizers - firstmates/finalizers - - lakers/finalizers verbs: - update - apiGroups: @@ -434,7 +432,6 @@ rules: - admirales/status - captains/status - firstmates/status - - lakers/status verbs: - get - patch diff --git a/testdata/project-v4/internal/controller/laker_controller.go b/testdata/project-v4/internal/controller/laker_controller.go deleted file mode 100644 index fa42875a51c..00000000000 --- a/testdata/project-v4/internal/controller/laker_controller.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" -) - -// LakerReconciler reconciles a Laker object -type LakerReconciler struct { - client.Client - Scheme *runtime.Scheme -} - -// +kubebuilder:rbac:groups=crew.testproject.org,resources=lakers,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=crew.testproject.org,resources=lakers/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=crew.testproject.org,resources=lakers/finalizers,verbs=update - -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the Laker object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile -func (r *LakerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - _ = log.FromContext(ctx) - - // TODO(user): your logic here - - return ctrl.Result{}, nil -} - -// SetupWithManager sets up the controller with the Manager. -func (r *LakerReconciler) SetupWithManager(mgr ctrl.Manager) error { - return ctrl.NewControllerManagedBy(mgr). - // Uncomment the following line adding a pointer to an instance of the controlled resource as an argument - // For(). - Complete(r) -} diff --git a/testdata/project-v4/internal/controller/laker_controller_test.go b/testdata/project-v4/internal/controller/laker_controller_test.go deleted file mode 100644 index dad17ef9eb5..00000000000 --- a/testdata/project-v4/internal/controller/laker_controller_test.go +++ /dev/null @@ -1,32 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - . "github.com/onsi/ginkgo/v2" -) - -var _ = Describe("Laker Controller", func() { - Context("When reconciling a resource", func() { - - It("should successfully reconcile the resource", func() { - - // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. - // Example: If you expect a certain status condition after reconciliation, verify it here. - }) - }) -})