Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Test OwnerReferences and Finalizers for Supervisor #3059

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ generate-e2e-templates-main: $(KUSTOMIZE) ## Generate test templates for the mai
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_SUPERVISOR_TEMPLATE_DIR)/main/topology" > "$(E2E_SUPERVISOR_TEMPLATE_DIR)/main/cluster-template-topology-supervisor.yaml"
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_SUPERVISOR_TEMPLATE_DIR)/main/conformance" > "$(E2E_SUPERVISOR_TEMPLATE_DIR)/main/cluster-template-conformance-supervisor.yaml"
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_SUPERVISOR_TEMPLATE_DIR)/main/install-on-bootstrap" > "$(E2E_SUPERVISOR_TEMPLATE_DIR)/main/cluster-template-install-on-bootstrap-supervisor.yaml"
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build "$(E2E_SUPERVISOR_TEMPLATE_DIR)/main/ownerrefs-finalizers" > "$(E2E_SUPERVISOR_TEMPLATE_DIR)/main/cluster-template-ownerrefs-finalizers-supervisor.yaml"

.PHONY: generate-e2e-templates-v1.10
generate-e2e-templates-v1.10: $(KUSTOMIZE)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module sigs.k8s.io/cluster-api-provider-vsphere

go 1.22.0

replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.7.0-rc.0.0.20240617064349-5b6043e1b6ec
replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.7.0-rc.0.0.20240701062357-f57b8c8ef777

replace github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels => github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-20240404200847-de75746a9505

Expand Down Expand Up @@ -40,7 +40,7 @@ require (
k8s.io/component-base v0.30.2
k8s.io/klog/v2 v2.120.1
k8s.io/utils v0.0.0-20231127182322-b307cd553661
sigs.k8s.io/cluster-api v1.7.0-rc.0.0.20240610140608-2e3860ac7408
sigs.k8s.io/cluster-api v1.7.0-rc.0.0.20240701062357-f57b8c8ef777
sigs.k8s.io/controller-runtime v0.18.4
sigs.k8s.io/kustomize/api v0.17.2
sigs.k8s.io/kustomize/kyaml v0.17.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1009,8 +1009,8 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.0 h1:Tc9rS7JJoZ9sl3OpL4842oIk6lH7gWBb0JOmJ0ute7M=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.0/go.mod h1:1ewhL9l1gkPcU/IU/6rFYfikf+7Y5imWv7ARVbBOzNs=
sigs.k8s.io/cluster-api v1.7.0-rc.0.0.20240617064349-5b6043e1b6ec h1:ikgHzieJg7LTJjvL/o4gcs8pcGBLwXyvuRvrC4Uj7kk=
sigs.k8s.io/cluster-api v1.7.0-rc.0.0.20240617064349-5b6043e1b6ec/go.mod h1:tDxEz5a0levoOzLKny7JMW5S7g2P4fKYHNOMsS9IH/c=
sigs.k8s.io/cluster-api v1.7.0-rc.0.0.20240701062357-f57b8c8ef777 h1:GBOytXqP37lSBbEo3O6NVK3KwJ4B2q0apxyNobkiBNA=
sigs.k8s.io/cluster-api v1.7.0-rc.0.0.20240701062357-f57b8c8ef777/go.mod h1:IzizeknMhBnwJrdEj5tDpheegvn5xZn8n2gLxKvv7/A=
sigs.k8s.io/controller-runtime v0.9.0/go.mod h1:TgkfvrhhEw3PlI0BRL/5xM+89y3/yc0ZDfdbTl84si8=
sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw=
sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg=
Expand Down
2 changes: 1 addition & 1 deletion packaging/flavorgen/cloudprovider/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func CSICloudConfigSecret(data string) *corev1.Secret {
APIVersion: corev1.SchemeGroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: "vsphere-config-secret",
Name: "vsphere-config-secret", // NOTE: this name is used in E2E tests.
Namespace: CSINamespace,
},
Type: corev1.SecretTypeOpaque,
Expand Down
2 changes: 1 addition & 1 deletion packaging/flavorgen/flavors/crs/cpi.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func cpiCredentials(credentials map[string]string) *corev1.Secret {
},
ObjectMeta: metav1.ObjectMeta{
Namespace: metav1.NamespaceSystem,
Name: "cloud-provider-vsphere-credentials",
Name: "cloud-provider-vsphere-credentials", // NOTE: this name is used in E2E tests.
},
Type: corev1.SecretTypeOpaque,
StringData: credentials,
Expand Down
2 changes: 1 addition & 1 deletion packaging/flavorgen/flavors/crs/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func appendConfigMapToCrsResource(crs *addonsv1.ClusterResourceSet, generatedCon
func newCPIConfig() ([]byte, error) {
config := map[string]interface{}{
"global": map[string]interface{}{
"secretName": "cloud-provider-vsphere-credentials",
"secretName": "cloud-provider-vsphere-credentials", // NOTE: this name is used in E2E tests.
"secretNamespace": metav1.NamespaceSystem,
"thumbprint": env.VSphereThumbprint,
"port": 443,
Expand Down
4 changes: 0 additions & 4 deletions packaging/flavorgen/flavors/flavors.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func ClusterTopologyTemplateSupervisor() ([]runtime.Object, error) {
if err != nil {
return nil, err
}
identitySecret := newIdentitySecret()
clusterResourceSet := newClusterResourceSet(cluster)
crsResourcesCSI, err := crs.CreateCrsResourceObjectsCSI(&clusterResourceSet)
if err != nil {
Expand All @@ -117,7 +116,6 @@ func ClusterTopologyTemplateSupervisor() ([]runtime.Object, error) {
crsResourcesCPI := crs.CreateCrsResourceObjectsCPI(&clusterResourceSet)
MultiNodeTemplate := []runtime.Object{
&cluster,
&identitySecret,
&clusterResourceSet,
}
MultiNodeTemplate = append(MultiNodeTemplate, crsResourcesCSI...)
Expand Down Expand Up @@ -179,7 +177,6 @@ func MultiNodeTemplateSupervisor() ([]runtime.Object, error) {
return nil, err
}
crsResourcesCPI := crs.CreateCrsResourceObjectsCPI(&clusterResourceSet)
identitySecret := newIdentitySecret()

MultiNodeTemplate := []runtime.Object{
&cluster,
Expand All @@ -190,7 +187,6 @@ func MultiNodeTemplateSupervisor() ([]runtime.Object, error) {
&kubeadmJoinTemplate,
&machineDeployment,
&clusterResourceSet,
&identitySecret,
}

MultiNodeTemplate = append(MultiNodeTemplate, crsResourcesCSI...)
Expand Down
9 changes: 0 additions & 9 deletions templates/cluster-template-supervisor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,6 @@ spec:
---
apiVersion: v1
kind: Secret
metadata:
name: '${CLUSTER_NAME}'
namespace: '${NAMESPACE}'
stringData:
password: "${VSPHERE_PASSWORD}"
username: "${VSPHERE_USERNAME}"
---
apiVersion: v1
kind: Secret
metadata:
name: vsphere-config-secret
namespace: '${NAMESPACE}'
Expand Down
9 changes: 0 additions & 9 deletions templates/cluster-template-topology-supervisor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,6 @@ spec:
name: md-0
replicas: ${WORKER_MACHINE_COUNT}
---
apiVersion: v1
kind: Secret
metadata:
name: '${CLUSTER_NAME}'
namespace: '${NAMESPACE}'
stringData:
password: "${VSPHERE_PASSWORD}"
username: "${VSPHERE_USERNAME}"
---
apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
Expand Down
19 changes: 4 additions & 15 deletions test/e2e/config/vsphere.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ providers:
type: CoreProvider
versions:
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/core-components.yaml"
value: "https://storage.googleapis.com/k8s-staging-cluster-api/components/nightly_main_20240701/core-components.yaml" # "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/core-components.yaml"
type: "url"
contract: v1beta1
files:
Expand All @@ -35,7 +34,6 @@ providers:
- old: "imagePullPolicy: Always"
new: "imagePullPolicy: IfNotPresent"
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/core-components.yaml"
type: "url"
contract: v1beta1
Expand All @@ -45,7 +43,6 @@ providers:
- old: "imagePullPolicy: Always"
new: "imagePullPolicy: IfNotPresent"
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/core-components.yaml"
type: "url"
contract: v1beta1
Expand All @@ -59,8 +56,7 @@ providers:
type: BootstrapProvider
versions:
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/bootstrap-components.yaml"
value: "https://storage.googleapis.com/k8s-staging-cluster-api/components/nightly_main_20240701/bootstrap-components.yaml" # "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/bootstrap-components.yaml"
type: "url"
contract: v1beta1
files:
Expand All @@ -69,7 +65,6 @@ providers:
- old: "imagePullPolicy: Always"
new: "imagePullPolicy: IfNotPresent"
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/bootstrap-components.yaml"
type: "url"
contract: v1beta1
Expand All @@ -79,7 +74,6 @@ providers:
- old: "imagePullPolicy: Always"
new: "imagePullPolicy: IfNotPresent"
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/bootstrap-components.yaml"
type: "url"
contract: v1beta1
Expand All @@ -93,8 +87,7 @@ providers:
type: ControlPlaneProvider
versions:
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/control-plane-components.yaml"
value: "https://storage.googleapis.com/k8s-staging-cluster-api/components/nightly_main_20240701/control-plane-components.yaml" # "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/control-plane-components.yaml"
type: "url"
contract: v1beta1
files:
Expand All @@ -103,7 +96,6 @@ providers:
- old: "imagePullPolicy: Always"
new: "imagePullPolicy: IfNotPresent"
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/control-plane-components.yaml"
type: "url"
contract: v1beta1
Expand All @@ -113,7 +105,6 @@ providers:
- old: "imagePullPolicy: Always"
new: "imagePullPolicy: IfNotPresent"
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/[email protected]}/control-plane-components.yaml"
type: "url"
contract: v1beta1
Expand All @@ -127,7 +118,6 @@ providers:
type: IPAMProvider
versions:
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1alpha2 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api-ipam-provider-in-cluster/releases/download/{go://sigs.k8s.io/[email protected]}/ipam-components.yaml"
type: "url"
contract: v1beta1
Expand Down Expand Up @@ -166,9 +156,9 @@ providers:
- sourcePath: "../../../test/e2e/data/infrastructure-vsphere-supervisor/main/clusterclass-quick-start-supervisor.yaml"
- sourcePath: "../../../test/e2e/data/infrastructure-vsphere-supervisor/main/cluster-template-install-on-bootstrap-supervisor.yaml"
- sourcePath: "../../../test/e2e/data/infrastructure-vsphere-supervisor/main/cluster-template-conformance-supervisor.yaml"
- sourcePath: "../../../test/e2e/data/infrastructure-vsphere-supervisor/main/cluster-template-ownerrefs-finalizers-supervisor.yaml"
- sourcePath: "../data/shared/capv/main/metadata.yaml"
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/download/{go://sigs.k8s.io/[email protected]}/infrastructure-components.yaml"
type: "url"
contract: v1beta1
Expand All @@ -178,7 +168,6 @@ providers:
- sourcePath: "../../../test/e2e/data/infrastructure-vsphere-govmomi/v1.10/clusterclass-quick-start.yaml"
- sourcePath: "../data/shared/capv/v1.10/metadata.yaml"
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1beta1 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/download/{go://sigs.k8s.io/[email protected]}/infrastructure-components.yaml"
type: "url"
contract: v1beta1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
# Note: we need a template named cluster-template-ownerrefs-finalizers-supervisor because the corresponding govimomi template
# is different from the govimomi base template. However, in case of supervisor, this template matches the base one.
- ../base
6 changes: 4 additions & 2 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"path/filepath"
"strings"
"testing"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -209,8 +210,9 @@ var _ = SynchronizedBeforeSuite(func() []byte {

if testTarget == VCSimTestTarget {
Byf("Creating a vcsim server")
err := vspherevcsim.Create(ctx, bootstrapClusterProxy.GetClient())
Expect(err).ToNot(HaveOccurred(), "Failed to create VCenterSimulator")
Eventually(func() error {
return vspherevcsim.Create(ctx, bootstrapClusterProxy.GetClient())
sbueringer marked this conversation as resolved.
Show resolved Hide resolved
}, 30*time.Second, 3*time.Second).ShouldNot(HaveOccurred(), "Failed to create VCenterSimulator")
}

By("Getting AddressClaim labels")
Expand Down
Loading
Loading