Skip to content

Commit

Permalink
Test OwnerReferences and Finalizers for Supervisor
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Jun 12, 2024
1 parent f25d8d4 commit 3c389f4
Show file tree
Hide file tree
Showing 17 changed files with 213 additions and 114 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,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
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
1 change: 1 addition & 0 deletions test/e2e/config/vsphere.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ 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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../base
patchesStrategicMerge:
- ../commons/cluster-resource-set-label.yaml
- ../commons/cluster-network-CIDR.yaml
- ../commons/cluster-resource-set-csi-insecure.yaml
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 @@ -210,8 +211,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())
}, 30*time.Second, 3*time.Second).ShouldNot(HaveOccurred(), "Failed to create VCenterSimulator")
}

By("Getting AddressClaim labels")
Expand Down
Loading

0 comments on commit 3c389f4

Please sign in to comment.