diff --git a/tests/e2e/golden/object/_apikeyskeybasic.yaml b/tests/e2e/golden/object/_apikeyskeybasic.yaml new file mode 100644 index 0000000000..45bc0737de --- /dev/null +++ b/tests/e2e/golden/object/_apikeyskeybasic.yaml @@ -0,0 +1,48 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: apikeys.cnrm.cloud.google.com/v1alpha1 +kind: APIKeysKey +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: apikeyskey-${uniqueId} + namespace: ${uniqueId} +spec: + displayName: Example Display Name - Updated + projectRef: + external: ${projectId} + resourceID: apikeyskey${uniqueId} + restrictions: + apiTargets: + - methods: + - GET + - DELETE + service: translate.googleapis.com +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + keyString: dummy-encrypted-value + observedGeneration: 2 diff --git a/tests/e2e/golden/object/_billingaccountiampolicy.yaml b/tests/e2e/golden/object/_billingaccountiampolicy.yaml new file mode 100644 index 0000000000..2d55719a67 --- /dev/null +++ b/tests/e2e/golden/object/_billingaccountiampolicy.yaml @@ -0,0 +1,47 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: iam.cnrm.cloud.google.com/v1beta1 +kind: IAMPolicy +metadata: + annotations: + cnrm.cloud.google.com/deletion-policy: abandon + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 1 + labels: + cnrm-test: "true" + name: iamexternalonlyref-${uniqueId} + namespace: ${uniqueId} +spec: + bindings: + - members: + - group:kcc-eng@google.com + - serviceAccount:cnrm-eap-prow@cnrm-eap.iam.gserviceaccount.com + - user:john@configconnector.joonix.net + role: roles/billing.admin + resourceRef: + apiVersion: billing.cnrm.cloud.google.com/v1beta1 + external: 123456-777777-000002 + kind: BillingAccount +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 1 diff --git a/tests/e2e/golden/object/_billingaccountiampolicymember.yaml b/tests/e2e/golden/object/_billingaccountiampolicymember.yaml new file mode 100644 index 0000000000..9f80cfd988 --- /dev/null +++ b/tests/e2e/golden/object/_billingaccountiampolicymember.yaml @@ -0,0 +1,42 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: iam.cnrm.cloud.google.com/v1beta1 +kind: IAMPolicyMember +metadata: + annotations: + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 1 + labels: + cnrm-test: "true" + name: iamexternalonlyref-${uniqueId} + namespace: ${uniqueId} +spec: + member: serviceAccount:extonly-${uniqueId}@${projectId}.iam.gserviceaccount.com + resourceRef: + apiVersion: billing.cnrm.cloud.google.com/v1beta1 + external: 123456-777777-000001 + kind: BillingAccount + role: roles/billing.viewer +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 1 diff --git a/tests/e2e/golden/object/_certificatemanagercertificatemanageddns.yaml b/tests/e2e/golden/object/_certificatemanagercertificatemanageddns.yaml new file mode 100644 index 0000000000..d238fb3508 --- /dev/null +++ b/tests/e2e/golden/object/_certificatemanagercertificatemanageddns.yaml @@ -0,0 +1,53 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: certificatemanager.cnrm.cloud.google.com/v1beta1 +kind: CertificateManagerCertificate +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/observed-secret-versions: (removed) + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + label-one: value-two + name: certificatemanagercertificate-${uniqueId} + namespace: ${uniqueId} +spec: + description: updated description of a managed cert for kcc + location: global + managed: + dnsAuthorizationsRefs: + - name: certificatemanagerdnsauthorization-1-${uniqueId} + - name: certificatemanagerdnsauthorization-2-${uniqueId} + domains: + - ${uniqueId}1.hashicorptest.com + - ${uniqueId}2.hashicorptest.com + state: STATE_UNSPECIFIED + projectRef: + external: ${projectId} + resourceID: certificatemanagercertificate${uniqueId} + scope: EDGE_CACHE +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 3 diff --git a/tests/e2e/golden/object/_certificatemanagercertificatemap.yaml b/tests/e2e/golden/object/_certificatemanagercertificatemap.yaml new file mode 100644 index 0000000000..a1864de993 --- /dev/null +++ b/tests/e2e/golden/object/_certificatemanagercertificatemap.yaml @@ -0,0 +1,42 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: certificatemanager.cnrm.cloud.google.com/v1beta1 +kind: CertificateManagerCertificateMap +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + value: cert-map-2 + name: certificatemanagercertificatemap-${uniqueId} + namespace: ${uniqueId} +spec: + description: updated sample certificate map + projectRef: + external: ${projectId} + resourceID: certificatemanagercertificatemap${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 2 diff --git a/tests/e2e/golden/object/_certificatemanagercertificatemapentry.yaml b/tests/e2e/golden/object/_certificatemanagercertificatemapentry.yaml new file mode 100644 index 0000000000..2234606b08 --- /dev/null +++ b/tests/e2e/golden/object/_certificatemanagercertificatemapentry.yaml @@ -0,0 +1,47 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: certificatemanager.cnrm.cloud.google.com/v1beta1 +kind: CertificateManagerCertificateMapEntry +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: certificatemanagercertificatemapentry-${uniqueId} + namespace: ${uniqueId} +spec: + certificatesRefs: + - name: certificatemanagercertificate-${uniqueId} + description: updated certificate map entry + mapRef: + name: certificatemanagercertificatemap-${uniqueId} + matcher: PRIMARY + projectRef: + external: ${projectId} + resourceID: certificatemanagercertificatemapentry${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 2 + state: SERVING_STATE_UNSPECIFIED diff --git a/tests/e2e/golden/object/_certificatemanagercertificateselfmanaged.yaml b/tests/e2e/golden/object/_certificatemanagercertificateselfmanaged.yaml new file mode 100644 index 0000000000..bac03d399c --- /dev/null +++ b/tests/e2e/golden/object/_certificatemanagercertificateselfmanaged.yaml @@ -0,0 +1,71 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: certificatemanager.cnrm.cloud.google.com/v1beta1 +kind: CertificateManagerCertificate +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/observed-secret-versions: (removed) + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + label-one: value-two + name: certificatemanagercertificate-${uniqueId} + namespace: ${uniqueId} +spec: + description: updated regional self-managed certificate + location: europe-west1 + projectRef: + external: ${projectId} + resourceID: certificatemanagercertificate${uniqueId} + scope: DEFAULT + selfManaged: + pemCertificate: |- + -----BEGIN CERTIFICATE----- + MIIDDzCCAfegAwIBAgIUDOiCLH9QNMMYnjPZVf4VwO9blsEwDQYJKoZIhvcNAQEL + BQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wIBcNMjIwODI0MDg0MDUxWhgPMzAy + MTEyMjUwODQwNTFaMBYxFDASBgNVBAMMC2V4YW1wbGUuY29tMIIBIjANBgkqhkiG + 9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvOT925GG4lKV9HvAHsbecMhGPAqjhVRC26iZ + UJC8oSWOu95lWJSX5ZhbiF6Nz192wDGV/VAh3Lxj8RYtcn75eDxQKTcKouDld+To + CGIStPFWbR6rbysLuZqFVEXVOTvp2QIegInfrvnGC4j7Qpic7zrFB9HzJx+0HpeE + yO4gkdzJfEK/gMmolUgJrKX59o+0+Rj+Jq3EtcQxL1fVBVJSx0NvpoR1eYpnHMr/ + rJKZkUUZ2xE86hrtpiP6OEYQTi00rmf4GnZF5QfGGD0xuoQXtR7Tu+XhKibXIhxc + D4RzPLX1QS040PXvmMPLDb4YlUQ6V3Rs42JDvkkDwIMXZvn8awIDAQABo1MwUTAd + BgNVHQ4EFgQURuo1CCZZAUv7xi02f2nC5tRbf18wHwYDVR0jBBgwFoAURuo1CCZZ + AUv7xi02f2nC5tRbf18wDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC + AQEAqx3tDxurnYr9EUPhF5/LlDPYM+VI7EgrKdRnuIqUlZI0tm3vOGME0te6dBTC + YLNaHLW3m/4Tm4M2eg0Kpz6CxJfn3109G31dCi0xwzSDHf5TPUWvqIVhq5WRgMIf + n8KYBlQSmqdJBRztUIQH/UPFnSbxymlS4s5qwDgTH5ag9EEBcnWsQ2LZjKi0eqve + MaqAvvB+j8RGZzYY4re94bSJI42zIZ6nMWPtXwRuDc30xl/u+E0jWIgWbPwSd6Km + 3wnJnGiU2ezPGq3zEU+Rc39VVIFKQpciNeYuF3neHPJvYOf58qW2Z8s0VH0MR1x3 + 3DoO/e30FIr9j+PRD+s5BPKF2A== + -----END CERTIFICATE----- + pemPrivateKey: + valueFrom: + secretKeyRef: + key: privateKey + name: secret-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 3 diff --git a/tests/e2e/golden/object/_certificatemanagerdnsauthorization.yaml b/tests/e2e/golden/object/_certificatemanagerdnsauthorization.yaml new file mode 100644 index 0000000000..ee232d733e --- /dev/null +++ b/tests/e2e/golden/object/_certificatemanagerdnsauthorization.yaml @@ -0,0 +1,44 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: certificatemanager.cnrm.cloud.google.com/v1beta1 +kind: CertificateManagerDNSAuthorization +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + label-one: value-one-updated + label-two: value-two + name: certificatemanagerdnsauthorization-${uniqueId} + namespace: ${uniqueId} +spec: + description: updated dns authorization + domain: ${uniqueId}.hashicorptest.com + projectRef: + external: ${projectId} + resourceID: certificatemanagerdnsauthorization${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 2 diff --git a/tests/e2e/golden/object/_computediskfromsourcedisk.yaml b/tests/e2e/golden/object/_computediskfromsourcedisk.yaml new file mode 100644 index 0000000000..de8e14e424 --- /dev/null +++ b/tests/e2e/golden/object/_computediskfromsourcedisk.yaml @@ -0,0 +1,49 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeDisk +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/observed-secret-versions: (removed) + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: computedisk-1-${uniqueId} + namespace: ${uniqueId} +spec: + description: an example disk from source disk + location: us-central1-a + physicalBlockSizeBytes: 4096 + projectRef: + external: ${projectId} + resourceID: computedisk-1-${uniqueId} + sourceDiskRef: + name: computedisk-2-${uniqueId} + type: pd-standard +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + creationTimestamp: "1970-01-01T00:00:00Z" + observedGeneration: 2 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-central1-a/disks/computedisk-1-${uniqueId} diff --git a/tests/e2e/golden/object/_computenetwork.yaml b/tests/e2e/golden/object/_computenetwork.yaml new file mode 100644 index 0000000000..b0ecdf9d1d --- /dev/null +++ b/tests/e2e/golden/object/_computenetwork.yaml @@ -0,0 +1,44 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeNetwork +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + label-one: value-one + name: computenetwork-${uniqueId} + namespace: ${uniqueId} +spec: + autoCreateSubnetworks: false + networkFirewallPolicyEnforcementOrder: AFTER_CLASSIC_FIREWALL + resourceID: computenetwork-${uniqueId} + routingMode: GLOBAL +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 3 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/global/networks/computenetwork-${uniqueId} diff --git a/tests/e2e/golden/object/_computenodegroup.yaml b/tests/e2e/golden/object/_computenodegroup.yaml new file mode 100644 index 0000000000..9b69e135de --- /dev/null +++ b/tests/e2e/golden/object/_computenodegroup.yaml @@ -0,0 +1,47 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeNodeGroup +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: computenodegroup-${uniqueId} + namespace: ${uniqueId} +spec: + description: A single sole-tenant node in the us-central1-b zone. + maintenancePolicy: DEFAULT + nodeTemplateRef: + name: computenodetemplate-${uniqueId} + resourceID: computenodegroup-${uniqueId} + size: 1 + zone: us-central1-b +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + creationTimestamp: "1970-01-01T00:00:00Z" + observedGeneration: 2 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-central1-b/nodeGroups/computenodegroup-${uniqueId} diff --git a/tests/e2e/golden/object/_computenodetemplate.yaml b/tests/e2e/golden/object/_computenodetemplate.yaml new file mode 100644 index 0000000000..c10ef20ba7 --- /dev/null +++ b/tests/e2e/golden/object/_computenodetemplate.yaml @@ -0,0 +1,49 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeNodeTemplate +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + memory_guarantee: "false" + name: computenodetemplate-${uniqueId} + namespace: ${uniqueId} +spec: + cpuOvercommitType: NONE + description: Node template for sole tenant nodes running in us-central1, with 96vCPUs + and any amount of memory on any machine type. + nodeTypeFlexibility: + cpus: "96" + memory: any + region: us-central1 + resourceID: computenodetemplate-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + creationTimestamp: "1970-01-01T00:00:00Z" + observedGeneration: 2 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/nodeTemplates/computenodetemplate-${uniqueId} diff --git a/tests/e2e/golden/object/_computesubnetwork.yaml b/tests/e2e/golden/object/_computesubnetwork.yaml new file mode 100644 index 0000000000..8d84a90f7f --- /dev/null +++ b/tests/e2e/golden/object/_computesubnetwork.yaml @@ -0,0 +1,47 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeSubnetwork +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + label-one: value-one + name: computesubnetwork-${uniqueId} + namespace: ${uniqueId} +spec: + ipCidrRange: 10.2.0.0/16 + networkRef: + name: computenetwork-${uniqueId} + privateIpGoogleAccess: true + region: us-central1 + resourceID: computesubnetwork-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + creationTimestamp: "1970-01-01T00:00:00Z" + observedGeneration: 3 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/subnetworks/computesubnetwork-${uniqueId} diff --git a/tests/e2e/golden/object/_containerattachedcluster.yaml b/tests/e2e/golden/object/_containerattachedcluster.yaml new file mode 100644 index 0000000000..11c15931ab --- /dev/null +++ b/tests/e2e/golden/object/_containerattachedcluster.yaml @@ -0,0 +1,52 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: containerattached.cnrm.cloud.google.com/v1beta1 +kind: ContainerAttachedCluster +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/mutable-but-unreadable-fields: '{"spec":{"deletionPolicy":"DELETE_IGNORE_ERRORS"}}' + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: containerattachedcluster-${uniqueId} + namespace: ${uniqueId} +spec: + deletionPolicy: DELETE_IGNORE_ERRORS + description: Test attached cluster update + distribution: eks + fleet: + projectRef: + name: project-${uniqueId} + location: us-west1 + oidcConfig: + issuerUrl: https://oidc.eks.us-west-2.amazonaws.com/id/A115FE1C770C2452C75219524036FC0F + platformVersion: 1.27.0-gke.2 + projectRef: + external: ${projectId} + resourceID: kcc-attached-cluster-127 +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 2 + state: STATE_UNSPECIFIED diff --git a/tests/e2e/golden/object/_edgecontainercluster.yaml b/tests/e2e/golden/object/_edgecontainercluster.yaml new file mode 100644 index 0000000000..79475e2f33 --- /dev/null +++ b/tests/e2e/golden/object/_edgecontainercluster.yaml @@ -0,0 +1,55 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: edgecontainer.cnrm.cloud.google.com/v1beta1 +kind: EdgeContainerCluster +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + label-one: value-one + label-two: value-two + name: edgecontainercluster-${uniqueId} + namespace: ${uniqueId} +spec: + authorization: + adminUsers: + usernameRef: + name: gsa-${uniqueId} + fleet: + projectRef: + name: project-${uniqueId} + location: us-central1 + networking: + clusterIpv4CidrBlocks: + - 10.0.0.0/16 + servicesIpv4CidrBlocks: + - 10.1.0.0/16 + projectRef: + external: ${projectId} + resourceID: edgecontainercluster-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 2 diff --git a/tests/e2e/golden/object/_edgecontainernodepool.yaml b/tests/e2e/golden/object/_edgecontainernodepool.yaml new file mode 100644 index 0000000000..896ada2aed --- /dev/null +++ b/tests/e2e/golden/object/_edgecontainernodepool.yaml @@ -0,0 +1,46 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: edgecontainer.cnrm.cloud.google.com/v1beta1 +kind: EdgeContainerNodePool +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + label-one: value-one + name: edgecontainernodepools-${uniqueId} + namespace: ${uniqueId} +spec: + clusterRef: + name: edgecontainercluster-${uniqueId} + location: us-central1 + nodeCount: 1 + nodeLocation: edge-site-node-123 + projectRef: + external: ${projectId} + resourceID: edgecontainernodepools-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 2 diff --git a/tests/e2e/golden/object/_edgenetworknetwork.yaml b/tests/e2e/golden/object/_edgenetworknetwork.yaml new file mode 100644 index 0000000000..e130bdbaa1 --- /dev/null +++ b/tests/e2e/golden/object/_edgenetworknetwork.yaml @@ -0,0 +1,46 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: edgenetwork.cnrm.cloud.google.com/v1beta1 +kind: EdgeNetworkNetwork +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + label-one: value-one + name: edgenetworknetwork-${uniqueId} + namespace: ${uniqueId} +spec: + description: Basic Network + location: us-central1 + mtu: 9000 + projectRef: + external: ${projectId} + resourceID: edgenetworknetwork-${uniqueId} + zone: us-central1-test-zone +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + name: projects/${projectId}/locations/us-central1/zones/us-central1-test-zone/networks/edgenetworknetwork-${uniqueId} + observedGeneration: 2 diff --git a/tests/e2e/golden/object/_edgenetworksubnet.yaml b/tests/e2e/golden/object/_edgenetworksubnet.yaml new file mode 100644 index 0000000000..3e98f25681 --- /dev/null +++ b/tests/e2e/golden/object/_edgenetworksubnet.yaml @@ -0,0 +1,51 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: edgenetwork.cnrm.cloud.google.com/v1beta1 +kind: EdgeNetworkSubnet +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + label-one: value-one + name: edgenetworksubnet-${uniqueId} + namespace: ${uniqueId} +spec: + description: Basic Subnet + ipv4Cidr: + - 1.1.1.1/24 + - 2.2.2.2/32 + location: us-central1 + networkRef: + name: edgenetworknetwork-${uniqueId} + projectRef: + external: ${projectId} + resourceID: edgenetworksubnet-${uniqueId} + zone: us-central1-test-zone +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + name: projects/${projectId}/locations/us-central1/zones/us-central1-test-zone/subnets/edgenetworksubnet-${uniqueId} + observedGeneration: 2 + state: STATE_UNKNOWN diff --git a/tests/e2e/golden/object/_folderid.yaml b/tests/e2e/golden/object/_folderid.yaml new file mode 100644 index 0000000000..20a1bc9eeb --- /dev/null +++ b/tests/e2e/golden/object/_folderid.yaml @@ -0,0 +1,43 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1 +kind: Project +metadata: + annotations: + cnrm.cloud.google.com/folder-id: "123451001" + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + name: project-${uniqueId} + namespace: ${uniqueId} +spec: + folderRef: + external: "123451001" + name: KCC-2 ${uniqueId} + resourceID: project-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + number: "2663254680" + observedGeneration: 3 diff --git a/tests/e2e/golden/object/_forcedestroy.yaml b/tests/e2e/golden/object/_forcedestroy.yaml new file mode 100644 index 0000000000..cdb550c232 --- /dev/null +++ b/tests/e2e/golden/object/_forcedestroy.yaml @@ -0,0 +1,45 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: storage.cnrm.cloud.google.com/v1beta1 +kind: StorageBucket +metadata: + annotations: + cnrm.cloud.google.com/force-destroy: "true" + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 4 + labels: + cnrm-test: "true" + label-one: value-one + newkey: newval + name: storagebucket-sample-${uniqueId} + namespace: ${uniqueId} +spec: + location: US + resourceID: storagebucket-sample-${uniqueId} + versioning: + enabled: true +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 4 diff --git a/tests/e2e/golden/object/_globalcomputeaddress.yaml b/tests/e2e/golden/object/_globalcomputeaddress.yaml new file mode 100644 index 0000000000..a793e90d40 --- /dev/null +++ b/tests/e2e/golden/object/_globalcomputeaddress.yaml @@ -0,0 +1,52 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeAddress +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: computeaddress-${uniqueId} + namespace: ${uniqueId} +spec: + address: 8.8.8.8 + addressType: INTERNAL + description: a test global address + ipVersion: IPV4 + location: global + networkRef: + name: default + prefixLength: 16 + purpose: VPC_PEERING + resourceID: computeaddress-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + creationTimestamp: "1970-01-01T00:00:00Z" + observedGeneration: 2 + observedState: + address: 8.8.8.8 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/global/networks/computeaddress-${uniqueId} diff --git a/tests/e2e/golden/object/_httpsfunction.yaml b/tests/e2e/golden/object/_httpsfunction.yaml new file mode 100644 index 0000000000..4e63a26479 --- /dev/null +++ b/tests/e2e/golden/object/_httpsfunction.yaml @@ -0,0 +1,52 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: cloudfunctions.cnrm.cloud.google.com/v1beta1 +kind: CloudFunctionsFunction +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + name: cloudfunctionsfunction-${uniqueId} + namespace: ${uniqueId} +spec: + entryPoint: helloGET + httpsTrigger: + securityLevel: SECURE_OPTIONAL + ingressSettings: INGRESS_SETTINGS_UNSPECIFIED + projectRef: + external: projects/${projectId} + region: us-west2 + resourceID: cloudfunctionsfunction-${uniqueId} + runtime: nodejs10 + sourceArchiveUrl: gs://config-connector-samples/cloudfunctionsfunction/http_trigger.zip + timeout: 120s + vpcConnectorEgressSettings: VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + httpsTrigger: + url: "" + observedGeneration: 3 + status: CLOUD_FUNCTION_STATUS_UNSPECIFIED diff --git a/tests/e2e/golden/object/_iamserviceaccount.yaml b/tests/e2e/golden/object/_iamserviceaccount.yaml new file mode 100644 index 0000000000..8e7ea44937 --- /dev/null +++ b/tests/e2e/golden/object/_iamserviceaccount.yaml @@ -0,0 +1,45 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: iam.cnrm.cloud.google.com/v1beta1 +kind: IAMServiceAccount +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + label-one: value-one + name: gsa-${uniqueId} + namespace: ${uniqueId} +spec: + displayName: ExampleGSA2 + resourceID: gsa-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + email: gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com + member: serviceAccount:gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com + name: projects/${projectId}/serviceAccounts/gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com + observedGeneration: 3 + uniqueId: "12345678" diff --git a/tests/e2e/golden/object/_networkservicesmesh.yaml b/tests/e2e/golden/object/_networkservicesmesh.yaml new file mode 100644 index 0000000000..b486036e03 --- /dev/null +++ b/tests/e2e/golden/object/_networkservicesmesh.yaml @@ -0,0 +1,45 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: networkservices.cnrm.cloud.google.com/v1beta1 +kind: NetworkServicesMesh +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + foo: bar + foo1: bar1 + name: networkservicesmesh-${uniqueId} + namespace: ${uniqueId} +spec: + description: Updated description + interceptionPort: 81 + location: global + projectRef: + external: projects/${projectId} + resourceID: networkservicesmesh-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 3 diff --git a/tests/e2e/golden/object/_organizationiampolicy.yaml b/tests/e2e/golden/object/_organizationiampolicy.yaml new file mode 100644 index 0000000000..df263ffac5 --- /dev/null +++ b/tests/e2e/golden/object/_organizationiampolicy.yaml @@ -0,0 +1,54 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: iam.cnrm.cloud.google.com/v1beta1 +kind: IAMPolicy +metadata: + annotations: + cnrm.cloud.google.com/deletion-policy: abandon + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 1 + labels: + cnrm-test: "true" + name: iamexternalonlyref-${uniqueId} + namespace: ${uniqueId} +spec: + bindings: + - members: + - domain:configconnector.joonix.net + - group:kcc-eng@google.com + role: roles/billing.creator + - members: + - group:kcc-eng@google.com + - serviceAccount:cnrm-eap-prow@cnrm-eap.iam.gserviceaccount.com + - user:john@configconnector.joonix.net + role: roles/resourcemanager.organizationAdmin + - members: + - domain:configconnector.joonix.net + role: roles/resourcemanager.projectCreator + resourceRef: + apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1 + external: "123450002" + kind: Organization +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 1 diff --git a/tests/e2e/golden/object/_organizationiampolicymember.yaml b/tests/e2e/golden/object/_organizationiampolicymember.yaml new file mode 100644 index 0000000000..b3850fda03 --- /dev/null +++ b/tests/e2e/golden/object/_organizationiampolicymember.yaml @@ -0,0 +1,42 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: iam.cnrm.cloud.google.com/v1beta1 +kind: IAMPolicyMember +metadata: + annotations: + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 1 + labels: + cnrm-test: "true" + name: iamexternalonlyref-${uniqueId} + namespace: ${uniqueId} +spec: + member: serviceAccount:extonly-${uniqueId}@${projectId}.iam.gserviceaccount.com + resourceRef: + apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1 + external: "123450001" + kind: Organization + role: roles/pubsub.admin +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 1 diff --git a/tests/e2e/golden/object/_privatecacapool.yaml b/tests/e2e/golden/object/_privatecacapool.yaml new file mode 100644 index 0000000000..d81c3f4af0 --- /dev/null +++ b/tests/e2e/golden/object/_privatecacapool.yaml @@ -0,0 +1,112 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: privateca.cnrm.cloud.google.com/v1beta1 +kind: PrivateCACAPool +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + label-one: value-one + label-two: value-two + name: privatecacapool-${uniqueId} + namespace: ${uniqueId} +spec: + issuancePolicy: + allowedIssuanceModes: + allowConfigBasedIssuance: true + allowCsrBasedIssuance: false + allowedKeyTypes: + - rsa: + maxModulusSize: 256 + minModulusSize: 128 + - ellipticCurve: + signatureAlgorithm: ECDSA_P256 + baselineValues: + additionalExtensions: + - critical: true + objectId: + objectIdPath: + - 1 + - 6 + value: bmV3LXN0cmluZwo= + aiaOcspServers: + - new-string + caOptions: + isCa: true + maxIssuerPathLength: 6 + keyUsage: + baseKeyUsage: + certSign: true + contentCommitment: true + crlSign: true + dataEncipherment: true + decipherOnly: true + digitalSignature: true + encipherOnly: true + keyAgreement: true + keyEncipherment: true + extendedKeyUsage: + clientAuth: true + codeSigning: true + emailProtection: true + ocspSigning: true + serverAuth: true + timeStamping: true + unknownExtendedKeyUsages: + - objectIdPath: + - 1 + - 6 + policyIds: + - objectIdPath: + - 1 + - 6 + identityConstraints: + allowSubjectAltNamesPassthrough: true + allowSubjectPassthrough: true + celExpression: + description: Always true + expression: "true" + location: update_devops.ca_pool.json + title: Updated expression + maximumLifetime: 86400s + passthroughExtensions: + additionalExtensions: + - objectIdPath: + - 1 + - 6 + knownExtensions: + - EXTENDED_KEY_USAGE + location: us-central1 + projectRef: + external: projects/${projectId} + publishingOptions: + publishCaCert: true + publishCrl: true + resourceID: privatecacapool-${uniqueId} + tier: ENTERPRISE +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 3 diff --git a/tests/e2e/golden/object/_projectinfolder.yaml b/tests/e2e/golden/object/_projectinfolder.yaml new file mode 100644 index 0000000000..a928e1d685 --- /dev/null +++ b/tests/e2e/golden/object/_projectinfolder.yaml @@ -0,0 +1,43 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1 +kind: Project +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + label-one: value-one + name: project-${uniqueId} + namespace: ${uniqueId} +spec: + folderRef: + external: "123451001" + name: KCC-2 ${uniqueId} + resourceID: project-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + number: "2699168562" + observedGeneration: 3 diff --git a/tests/e2e/golden/object/_projectinorg.yaml b/tests/e2e/golden/object/_projectinorg.yaml new file mode 100644 index 0000000000..60a34b7a30 --- /dev/null +++ b/tests/e2e/golden/object/_projectinorg.yaml @@ -0,0 +1,43 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1 +kind: Project +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + label-one: value-one + name: project-${uniqueId} + namespace: ${uniqueId} +spec: + name: KCC-2 ${uniqueId} + organizationRef: + external: "123450001" + resourceID: project-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + number: "2575108777" + observedGeneration: 3 diff --git a/tests/e2e/golden/object/_projectmovedfoldertofolder.yaml b/tests/e2e/golden/object/_projectmovedfoldertofolder.yaml new file mode 100644 index 0000000000..306fbec105 --- /dev/null +++ b/tests/e2e/golden/object/_projectmovedfoldertofolder.yaml @@ -0,0 +1,42 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1 +kind: Project +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + name: project-${uniqueId} + namespace: ${uniqueId} +spec: + folderRef: + external: "123451002" + name: KCC ${uniqueId} + resourceID: project-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + number: "2613119570" + observedGeneration: 3 diff --git a/tests/e2e/golden/object/_regionalcomputeaddress.yaml b/tests/e2e/golden/object/_regionalcomputeaddress.yaml new file mode 100644 index 0000000000..44285b58b9 --- /dev/null +++ b/tests/e2e/golden/object/_regionalcomputeaddress.yaml @@ -0,0 +1,46 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeAddress +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: computeaddress-${uniqueId} + namespace: ${uniqueId} +spec: + addressType: INTERNAL + description: a test address + location: us-central1 + resourceID: computeaddress-${uniqueId} + subnetworkRef: + name: default +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + creationTimestamp: "1970-01-01T00:00:00Z" + observedGeneration: 2 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/networks/computeaddress-${uniqueId} diff --git a/tests/e2e/golden/object/_regionalcomputedisk.yaml b/tests/e2e/golden/object/_regionalcomputedisk.yaml new file mode 100644 index 0000000000..b97da34fd6 --- /dev/null +++ b/tests/e2e/golden/object/_regionalcomputedisk.yaml @@ -0,0 +1,51 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeDisk +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/observed-secret-versions: (removed) + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + label-one: value-one + name: computedisk-${uniqueId} + namespace: ${uniqueId} +spec: + description: a sample regional disk + location: us-central1 + physicalBlockSizeBytes: 4096 + projectRef: + external: ${projectId} + replicaZones: + - projects/${projectId}/global/zones/us-central1-a + - projects/${projectId}/global/zones/us-central1-f + resourceID: computedisk-${uniqueId} + type: pd-standard +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + creationTimestamp: "1970-01-01T00:00:00Z" + observedGeneration: 2 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/disks/computedisk-${uniqueId} diff --git a/tests/e2e/golden/object/_secretmanagersecretversion.yaml b/tests/e2e/golden/object/_secretmanagersecretversion.yaml new file mode 100644 index 0000000000..42be976044 --- /dev/null +++ b/tests/e2e/golden/object/_secretmanagersecretversion.yaml @@ -0,0 +1,52 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: secretmanager.cnrm.cloud.google.com/v1beta1 +kind: SecretManagerSecretVersion +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/observed-secret-versions: (removed) + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + name: secretmanagersecretversion-${uniqueId} + namespace: ${uniqueId} +spec: + deletionPolicy: DELETE + enabled: false + resourceID: "1" + secretData: + valueFrom: + secretKeyRef: + key: secretData + name: secretmanagersecretversion-dep-${uniqueId} + secretRef: + name: secretmanagersecretversion-dep-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + createTime: "1970-01-01T00:00:00Z" + name: projects/${projectNumber}/secrets/secretmanagersecretversion-dep-${uniqueId}/versions/1 + observedGeneration: 3 + version: "1" diff --git a/tests/e2e/golden/object/_service.yaml b/tests/e2e/golden/object/_service.yaml new file mode 100644 index 0000000000..e459b79626 --- /dev/null +++ b/tests/e2e/golden/object/_service.yaml @@ -0,0 +1,41 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1 +kind: Service +metadata: + annotations: + cnrm.cloud.google.com/disable-dependent-services: "false" + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: runtimeconfig.googleapis.com + namespace: ${uniqueId} +spec: + projectRef: + external: ${projectId} + resourceID: runtimeconfig.googleapis.com +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 2 diff --git a/tests/e2e/golden/object/_serviceidentity.yaml b/tests/e2e/golden/object/_serviceidentity.yaml new file mode 100644 index 0000000000..e070190e14 --- /dev/null +++ b/tests/e2e/golden/object/_serviceidentity.yaml @@ -0,0 +1,41 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1 +kind: ServiceIdentity +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: pubsub.googleapis.com + namespace: ${uniqueId} +spec: + projectRef: + external: ${projectId} + resourceID: pubsub.googleapis.com +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + email: service-${projectNumber}@gcp-sa-pubsub.iam.gserviceaccount.com + observedGeneration: 2 diff --git a/tests/e2e/golden/object/_storagebucket#01.yaml b/tests/e2e/golden/object/_storagebucket#01.yaml new file mode 100644 index 0000000000..144f8146f4 --- /dev/null +++ b/tests/e2e/golden/object/_storagebucket#01.yaml @@ -0,0 +1,44 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: storage.cnrm.cloud.google.com/v1beta1 +kind: StorageBucket +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/reconcile-interval-in-seconds: "10" + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 4 + labels: + cnrm-test: "true" + name: storagebucket-sample-${uniqueId} + namespace: ${uniqueId} +spec: + lifecycleRule: [] + location: US + resourceID: storagebucket-sample-${uniqueId} + versioning: + enabled: true +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 4 diff --git a/tests/e2e/golden/object/_storagebucket.yaml b/tests/e2e/golden/object/_storagebucket.yaml new file mode 100644 index 0000000000..bb172f7bff --- /dev/null +++ b/tests/e2e/golden/object/_storagebucket.yaml @@ -0,0 +1,45 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: storage.cnrm.cloud.google.com/v1beta1 +kind: StorageBucket +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 4 + labels: + cnrm-test: "true" + label-one: value-one + newkey: newval + name: storagebucket-sample-${uniqueId} + namespace: ${uniqueId} +spec: + lifecycleRule: [] + location: US + resourceID: storagebucket-sample-${uniqueId} + versioning: + enabled: true +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 4 diff --git a/tests/e2e/golden/object/_tagkeyorgbasic.yaml b/tests/e2e/golden/object/_tagkeyorgbasic.yaml new file mode 100644 index 0000000000..83aac9e4f4 --- /dev/null +++ b/tests/e2e/golden/object/_tagkeyorgbasic.yaml @@ -0,0 +1,45 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: tags.cnrm.cloud.google.com/v1beta1 +kind: TagsTagKey +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: tagstagkey-${uniqueId} + namespace: ${uniqueId} +spec: + description: For keyname resources. + parent: organizations/123450001 + resourceID: "1711560500385836892" + shortName: keyname${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + createTime: "1970-01-01T00:00:00Z" + name: "1711560500385836892" + namespacedName: 123450001/keyname${uniqueId} + observedGeneration: 2 + updateTime: "1970-01-01T00:00:00Z" diff --git a/tests/e2e/golden/object/_tagkeyprojectbasic.yaml b/tests/e2e/golden/object/_tagkeyprojectbasic.yaml new file mode 100644 index 0000000000..08c433cfb6 --- /dev/null +++ b/tests/e2e/golden/object/_tagkeyprojectbasic.yaml @@ -0,0 +1,45 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: tags.cnrm.cloud.google.com/v1beta1 +kind: TagsTagKey +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: tagstagkey-${uniqueId} + namespace: ${uniqueId} +spec: + description: For keyname resources. + parent: projects/${projectId} + resourceID: "1711560520243359049" + shortName: keyname${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + createTime: "1970-01-01T00:00:00Z" + name: "1711560520243359049" + namespacedName: ${projectId}/keyname${uniqueId} + observedGeneration: 2 + updateTime: "1970-01-01T00:00:00Z" diff --git a/tests/e2e/golden/object/_userspecifiedresourceidandservergeneratedid.yaml b/tests/e2e/golden/object/_userspecifiedresourceidandservergeneratedid.yaml new file mode 100644 index 0000000000..56027c72d8 --- /dev/null +++ b/tests/e2e/golden/object/_userspecifiedresourceidandservergeneratedid.yaml @@ -0,0 +1,43 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1 +kind: Project +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + label-one: value-one + name: project-name-${uniqueId} + namespace: ${uniqueId} +spec: + name: KCC-2 ${uniqueId} + organizationRef: + external: "123450001" + resourceID: project-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + number: "2664106610" + observedGeneration: 2 diff --git a/tests/e2e/golden/object/_vertexaitensorboard.yaml b/tests/e2e/golden/object/_vertexaitensorboard.yaml new file mode 100644 index 0000000000..87fabef82e --- /dev/null +++ b/tests/e2e/golden/object/_vertexaitensorboard.yaml @@ -0,0 +1,47 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: vertexai.cnrm.cloud.google.com/v1alpha1 +kind: VertexAITensorboard +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + labels: + cnrm-test: "true" + name: vertexaitensorboard${uniqueId} + namespace: ${uniqueId} +spec: + description: Dashboard version 2 + displayName: config-connector v2 + projectRef: + external: ${projectId} + region: us-central1 + resourceID: projects/${projectNumber}/locations/us-central1/tensorboards/1711560538502315374 +status: + blobStoragePathPrefix: cloud-ai-platform-d5dd8890-08c5-4dbd-ac97-f151ecd27419 + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + createTime: "1970-01-01T00:00:00Z" + name: projects/${projectNumber}/locations/us-central1/tensorboards/1711560538502315374 + observedGeneration: 3 + updateTime: "1970-01-01T00:00:00Z" diff --git a/tests/e2e/golden/object/_zonalcomputedisk.yaml b/tests/e2e/golden/object/_zonalcomputedisk.yaml new file mode 100644 index 0000000000..f91241f356 --- /dev/null +++ b/tests/e2e/golden/object/_zonalcomputedisk.yaml @@ -0,0 +1,48 @@ +# Copyright 2024 Google LLC +# +# 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. + +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeDisk +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/observed-secret-versions: (removed) + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + label-one: value-one + name: computedisk-${uniqueId} + namespace: ${uniqueId} +spec: + description: an example disk without reference + location: us-central1-a + physicalBlockSizeBytes: 4096 + projectRef: + external: ${projectId} + resourceID: computedisk-${uniqueId} + type: pd-standard +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + creationTimestamp: "1970-01-01T00:00:00Z" + observedGeneration: 2 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-central1-a/disks/computedisk-${uniqueId} diff --git a/tests/e2e/normalize.go b/tests/e2e/normalize.go index 01c490bd27..0e3552333c 100644 --- a/tests/e2e/normalize.go +++ b/tests/e2e/normalize.go @@ -44,6 +44,7 @@ func normalizeObject(u *unstructured.Unstructured, project testgcp.GCPProject, u visitor.replacePaths = map[string]any{} visitor.replacePaths[".metadata.deletionTimestamp"] = "1970-01-01T00:00:00Z" + visitor.replacePaths[".status.creationTimestamp"] = "1970-01-01T00:00:00Z" visitor.replacePaths[".status.conditions[].lastTransitionTime"] = "1970-01-01T00:00:00Z" visitor.replacePaths[".status.uniqueId"] = "12345678" visitor.replacePaths[".status.creationTime"] = "1970-01-01T00:00:00Z" diff --git a/tests/e2e/object_test.go b/tests/e2e/object_test.go new file mode 100644 index 0000000000..e3d4431da5 --- /dev/null +++ b/tests/e2e/object_test.go @@ -0,0 +1,184 @@ +// Copyright 2022 Google LLC +// +// 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 ( + "context" + "fmt" + "k8s.io/apimachinery/pkg/types" + "os" + "path/filepath" + "sigs.k8s.io/yaml" + "strings" + "testing" + + "github.com/GoogleCloudPlatform/k8s-config-connector/config/tests/samples/create" + testgcp "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/gcp" + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/resourcefixture" + testvariable "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/resourcefixture/variable" + testyaml "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/yaml" + + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" +) + +func TestKubeObject(t *testing.T) { + if os.Getenv("RUN_E2E") == "" { + t.Skip("RUN_E2E not set; skipping") + } + + ctx := context.Background() + ctx, cancel := context.WithCancel(ctx) + t.Cleanup(func() { + cancel() + }) + + t.Run("fixtures", func(t *testing.T) { + fixtures := resourcefixture.Load(t) + for _, fixture := range fixtures { + fixture := fixture + t.Run(fixture.Name, func(t *testing.T) { + uniqueID := testvariable.NewUniqueID() + loadFixture := func(project testgcp.GCPProject) (*unstructured.Unstructured, create.CreateDeleteTestOptions) { + primaryResource := bytesToUnstructured(t, fixture.Create, uniqueID, project) + + opt := create.CreateDeleteTestOptions{CleanupResources: true} + opt.Create = append(opt.Create, primaryResource) + + if fixture.Dependencies != nil { + dependencyYamls := testyaml.SplitYAML(t, fixture.Dependencies) + for _, dependBytes := range dependencyYamls { + depUnstruct := bytesToUnstructured(t, dependBytes, uniqueID, project) + opt.Create = append(opt.Create, depUnstruct) + } + } + + if fixture.Update != nil { + u := bytesToUnstructured(t, fixture.Update, uniqueID, project) + opt.Updates = append(opt.Updates, u) + } + return primaryResource, opt + } + + // Quickly load the fixture with a dummy project, just to see if we should skip it + { + _, opt := loadFixture(testgcp.GCPProject{ProjectID: "test-skip", ProjectNumber: 123456789}) + create.MaybeSkip(t, fixture.Name, opt.Create) + } + + h := create.NewHarness(ctx, t) + project := h.Project + + primaryResource, opt := loadFixture(project) + + exportResources := []*unstructured.Unstructured{primaryResource} + + create.SetupNamespacesAndApplyDefaults(h, opt.Create, project) + + opt.CleanupResources = false // We delete explicitly below + + create.RunCreateDeleteTest(h, opt) + + for _, obj := range exportResources { + u := &unstructured.Unstructured{} + u.SetGroupVersionKind(obj.GroupVersionKind()) + id := types.NamespacedName{Namespace: obj.GetNamespace(), Name: obj.GetName()} + if err := h.GetClient().Get(ctx, id, u); err != nil { + t.Errorf("failed to get kube object: %v", err) + } else { + if err := normalizeObject(u, project, uniqueID); err != nil { + t.Fatalf("error from normalizeObject: %v", err) + } + got, err := yaml.Marshal(u) + if err != nil { + t.Errorf("failed to convert kube object to yaml: %v", err) + } + dir := "golden/object/" + pieces := strings.Split(t.Name(), "/") + var testName string + if len(pieces) > 0 { + testName = pieces[len(pieces)-1] + } else { + t.Errorf("failed to get test name: %v", err) + } + // File name looks like _testname.yaml + expectedPath := filepath.Join(dir, fmt.Sprintf("_%v.yaml", testName)) + err = compareGoldenObject(expectedPath, got) + if err != nil { + t.Fatalf("unexpected diff in %s: %s", expectedPath, err) + } + } + } + create.DeleteResources(h, opt) + }) + } + }) + // Do a cleanup while we can still handle the error. + t.Logf("shutting down manager") + cancel() +} + +func compareGoldenObject(path string, got []byte) error { + writeGoldenOutput := os.Getenv("WRITE_GOLDEN_OUTPUT") != "" + want, err := os.ReadFile(path) + if err != nil { + if writeGoldenOutput && os.IsNotExist(err) { + // Expected when creating output for the first time + if err := os.WriteFile(path, got, 0644); err != nil { + return fmt.Errorf("failed to write golden output %s: %v", path, err) + } + fmt.Printf("wrote updated golden output to %s", path) + return nil + } else { + return fmt.Errorf("failed to read golden file %q: %v", path, err) + } + } + var wantMap, gotMap map[string]interface{} + yaml.Unmarshal(want, &wantMap) + yaml.Unmarshal(got, &gotMap) + if ok, err := compareNestedFields(wantMap, gotMap); !ok { + return err + } + return nil +} + +func compareNestedFields(wantMap, gotMap map[string]interface{}) (bool, error) { + for wantKey := range wantMap { + if _, exists := gotMap[wantKey]; !exists { + err := fmt.Errorf("field %s in the golden file is missing", wantKey) + return false, err + } + } + + for gotKey := range gotMap { + if _, exists := wantMap[gotKey]; !exists { + err := fmt.Errorf("field %s does not exist in golden file", gotKey) + return false, err + } + } + + // Check nested structures recursively + for wantKey, wantVal := range wantMap { + if gotVal, exists := gotMap[wantKey]; exists { + if wantNestedMap, ok1 := wantVal.(map[string]interface{}); ok1 { + if gotNestedMap, ok2 := gotVal.(map[string]interface{}); ok2 { + if ok, err := compareNestedFields(wantNestedMap, gotNestedMap); !ok { + return false, err + } + } + } + } + } + return true, nil +}