diff --git a/test/infrastructure/vcsim/controllers/vcsim_controller.go b/test/infrastructure/vcsim/controllers/vcsim_controller.go index 34d80b95c6..af53e4bf5a 100644 --- a/test/infrastructure/vcsim/controllers/vcsim_controller.go +++ b/test/infrastructure/vcsim/controllers/vcsim_controller.go @@ -166,11 +166,28 @@ func (r *VCenterSimulatorReconciler) reconcileNormal(ctx context.Context, vCente return errors.Wrapf(err, "failed to parse vcsim server url") } + operations := []string{} + + if !r.SupervisorMode { + // Add operations to create and attach tags for failure domains + datacenterName := vcsimhelpers.DatacenterName(0) + computeClusterName := vcsimhelpers.ClusterName(0, 0) + operations = append(operations, + "tags.category.create -d \"Kubernetes region\" -t Datacenter k8s-region", + "tags.category.create -d \"Kubernetes zone\" k8s-zone", + fmt.Sprintf("tags.create -c k8s-region %q", datacenterName), + fmt.Sprintf("tags.create -c k8s-zone %q", computeClusterName), + fmt.Sprintf("tags.attach -c k8s-region %[1]q /%[1]q", datacenterName), + fmt.Sprintf("tags.attach -c k8s-zone %[1]q /%[2]q/host/%[1]q", computeClusterName, datacenterName), + ) + } + // Start the vcsim instance vcsimInstance, err := vcsimhelpers.NewBuilder(). WithModel(model). SkipModelCreate(). WithURL(vcsimURL). + WithOperations(operations...). Build() if err != nil {