Skip to content

Commit

Permalink
vcsim: create tags for failuredomain tests for govmomi
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Aug 27, 2024
1 parent f16bfd2 commit 4283cbd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/infrastructure/vcsim/controllers/vcsim_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4283cbd

Please sign in to comment.