Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions cmd/cluster-capi-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ func main() {
managedNamespace := flag.String(
"namespace",
controllers.DefaultManagedNamespace,
"The namespace where CAPI components will run.",
"The namespace where Cluster API components will run.",
)
imagesFile := flag.String(
"images-json",
defaultImagesLocation,
"The location of images file to use by operator for managed CAPI binaries.",
"The location of images file to use by operator for managed Cluster API binaries.",
)
webhookPort := flag.Int(
"webhook-port",
Expand Down
4 changes: 2 additions & 2 deletions cmd/machine-api-migration/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ func main() {
capiManagedNamespace := flag.String(
"capi-namespace",
controllers.DefaultManagedNamespace,
"The namespace where CAPI components will run.",
"The namespace where Cluster API components will run.",
)
mapiManagedNamespace := flag.String(
"mapi-namespace",
controllers.DefaultMAPIManagedNamespace,
"The namespace to watch for MAPI resources.",
"The namespace to watch for Machine API resources.",
)

logToStderr := flag.Bool(
Expand Down
4 changes: 2 additions & 2 deletions e2e/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func getCAPICreatedInstance(awsClient *ec2.EC2, msName string) ec2.Instance {
}

func compareInstances(awsClient *ec2.EC2, mapiMsName, capiMsName string) {
By("Comparing instances created by MAPI and CAPI")
By("Comparing instances created by Machine API and Cluster API")
mapiEC2Instance := getMAPICreatedInstance(awsClient, mapiMsName)
capiEC2Instance := getCAPICreatedInstance(awsClient, capiMsName)

Expand Down Expand Up @@ -287,6 +287,6 @@ func compareInstances(awsClient *ec2.EC2, mapiMsName, capiMsName string) {
}

if !cmp.Equal(mapiEC2Instance, capiEC2Instance, cmpOpts...) {
GinkgoWriter.Print("Instances created by MAPI and CAPI are not equal\n" + cmp.Diff(mapiEC2Instance, capiEC2Instance, cmpOpts...))
GinkgoWriter.Print("Instances created by Machine API and Cluster API are not equal\n" + cmp.Diff(mapiEC2Instance, capiEC2Instance, cmpOpts...))
}
}
18 changes: 9 additions & 9 deletions pkg/controllers/capiinstaller/capi_installer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (r *CapiInstallerController) reconcile(ctx context.Context, log logr.Logger

// Process each one of the desired providers.
for providerConfigMapLabelTypeVal, providerConfigMapLabelNameVal := range providerConfigMapLabels {
log.Info("reconciling CAPI provider", "name", providerConfigMapLabelNameVal)
log.Info("reconciling Cluster API provider", "name", providerConfigMapLabelNameVal)

// Get a List all the ConfigMaps matching the desired provider labels.
configMapList := &corev1.ConfigMapList{}
Expand All @@ -137,14 +137,14 @@ func (r *CapiInstallerController) reconcile(ctx context.Context, log logr.Logger
return ctrl.Result{}, fmt.Errorf("failed to set conditions for CAPI Installer controller: %w", err)
}

return ctrl.Result{}, fmt.Errorf("unable to list CAPI provider %q ConfigMaps: %w", providerConfigMapLabelNameVal, err)
return ctrl.Result{}, fmt.Errorf("unable to list Cluster API provider %q ConfigMaps: %w", providerConfigMapLabelNameVal, err)
}

// Extract the provider manifests stored each of the matching ConfigMaps.
var providerComponents []string

for _, cm := range configMapList.Items {
log.Info("processing CAPI provider ConfigMap", "configmapName", cm.Name, "providerType", cm.Labels[providerConfigMapLabelTypeKey],
log.Info("processing Cluster API provider ConfigMap", "configmapName", cm.Name, "providerType", cm.Labels[providerConfigMapLabelTypeKey],
"providerName", cm.Labels[providerConfigMapLabelNameKey], "providerVersion", cm.Labels[providerConfigMapLabelVersionKey])

partialComponents, err := r.extractProviderComponents(cm)
Expand All @@ -153,7 +153,7 @@ func (r *CapiInstallerController) reconcile(ctx context.Context, log logr.Logger
return ctrl.Result{}, fmt.Errorf("failed to set conditions for CAPI Installer controller: %w", err)
}

return ctrl.Result{}, fmt.Errorf("error extracting CAPI provider components from ConfigMap %q/%q: %w", cm.Namespace, cm.Name, err)
return ctrl.Result{}, fmt.Errorf("error extracting Cluster API provider components from ConfigMap %q/%q: %w", cm.Namespace, cm.Name, err)
}

providerComponents = append(providerComponents, partialComponents...)
Expand All @@ -165,10 +165,10 @@ func (r *CapiInstallerController) reconcile(ctx context.Context, log logr.Logger
return ctrl.Result{}, fmt.Errorf("failed to set conditions for CAPI Installer controller: %w", err)
}

return ctrl.Result{}, fmt.Errorf("error applying CAPI provider %q components: %w", providerConfigMapLabelNameVal, err)
return ctrl.Result{}, fmt.Errorf("error applying Cluster API provider %q components: %w", providerConfigMapLabelNameVal, err)
}

log.Info("finished reconciling CAPI provider", "name", providerConfigMapLabelNameVal)
log.Info("finished reconciling Cluster API provider", "name", providerConfigMapLabelNameVal)
}

return ctrl.Result{}, nil
Expand Down Expand Up @@ -201,7 +201,7 @@ func (r *CapiInstallerController) applyProviderComponents(ctx context.Context, c

obj, err := yamlToRuntimeObject(r.Scheme, deploymentManifest)
if err != nil {
return fmt.Errorf("error parsing CAPI provider deployment manifets %q: %w", d, err)
return fmt.Errorf("error parsing Cluster API provider deployment manifets %q: %w", d, err)
}

// TODO: Deployments State/Conditions should influence the overall ClusterOperator Status.
Expand All @@ -217,15 +217,15 @@ func (r *CapiInstallerController) applyProviderComponents(ctx context.Context, c
deployment,
resourcemerge.ExpectedDeploymentGeneration(deployment, nil),
); err != nil {
return fmt.Errorf("error applying CAPI provider deployment %q: %w", deployment.Name, err)
return fmt.Errorf("error applying Cluster API provider deployment %q: %w", deployment.Name, err)
}
}

var errs error

for i, r := range res {
if r.Error != nil {
errs = errors.Join(errs, fmt.Errorf("error applying CAPI provider component %q at position %d: %w", r.File, i, r.Error))
errs = errors.Join(errs, fmt.Errorf("error applying Cluster API provider component %q at position %d: %w", r.File, i, r.Error))
}
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/controllers/infracluster/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
)

var (
errUnableToGetAzureMAPIProviderSpec = errors.New("unable to get Azure MAPI ProviderSpec")
errUnableToGetAzureMAPIProviderSpec = errors.New("unable to get Azure Machine API ProviderSpec")
errUnableToGetAzureClientID = errors.New("unable to get Azure Client ID")
errUnableToGetAzureTenantID = errors.New("unable to get Azure Tenant ID")
errPlatformStatusNil = errors.New("platform status should not be nil")
Expand Down Expand Up @@ -79,12 +79,12 @@ func (r *InfraClusterController) ensureAzureCluster(ctx context.Context, log log
func getAzureMAPIProviderSpec(ctx context.Context, cl client.Client) (*mapiv1beta1.AzureMachineProviderSpec, error) {
rawProviderSpec, err := getRawMAPIProviderSpec(ctx, cl)
if err != nil {
return nil, fmt.Errorf("unable to obtain MAPI ProviderSpec: %w", err)
return nil, fmt.Errorf("unable to obtain Machine API ProviderSpec: %w", err)
}

providerSpec := &mapiv1beta1.AzureMachineProviderSpec{}
if err := yaml.Unmarshal(rawProviderSpec, providerSpec); err != nil {
return nil, fmt.Errorf("unable to unmarshal MAPI ProviderSpec: %w", err)
return nil, fmt.Errorf("unable to unmarshal Machine API ProviderSpec: %w", err)
}

return providerSpec, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/controllers/infracluster/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ func (r *InfraClusterController) ensureGCPCluster(ctx context.Context, log logr.
func getGCPMAPIProviderSpec(ctx context.Context, cl client.Client) (*mapiv1beta1.GCPMachineProviderSpec, error) {
rawProviderSpec, err := getRawMAPIProviderSpec(ctx, cl)
if err != nil {
return nil, fmt.Errorf("unable to obtain MAPI ProviderSpec: %w", err)
return nil, fmt.Errorf("unable to obtain Machine API ProviderSpec: %w", err)
}

providerSpec := &mapiv1beta1.GCPMachineProviderSpec{}
if err := yaml.Unmarshal(rawProviderSpec, providerSpec); err != nil {
return nil, fmt.Errorf("unable to unmarshal MAPI ProviderSpec: %w", err)
return nil, fmt.Errorf("unable to unmarshal Machine API ProviderSpec: %w", err)
}

return providerSpec, nil
Expand All @@ -126,7 +126,7 @@ func (r *InfraClusterController) getGCPProjectID(ctx context.Context) (string, e
// Devise GCP Project ID via MAPI providerSpec.
machineSpec, err := getGCPMAPIProviderSpec(ctx, r.Client)
if err != nil || machineSpec == nil {
return "", fmt.Errorf("unable to get GCP MAPI ProviderSpec: %w", err)
return "", fmt.Errorf("unable to get GCP Machine API ProviderSpec: %w", err)
}

return machineSpec.ProjectID, nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/infracluster/infracluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var (
errPlatformNotSupported = errors.New("infrastructure platform is not supported")
errCouldNotDeepCopyInfraObject = errors.New("unable to create a deep copy of InfraCluster object")
errUnableToListMachineSets = errors.New("unable to list MachineSets")
errUnableToFindMachineSets = errors.New("unable to find any MachineSets to extract a MAPI ProviderSpec from")
errUnableToFindMachineSets = errors.New("unable to find any MachineSets to extract a Machine API ProviderSpec from")
)

// InfraClusterController is a controller that manages infrastructure cluster objects.
Expand Down Expand Up @@ -123,7 +123,7 @@ func (r *InfraClusterController) reconcileInfraCluster(ctx context.Context, log
// This means, by definition, that the object is directly managed by CAPI infrastructure providers.
// No action should be taken by this controller.
log.Info(fmt.Sprintf("InfraCluster '%s/%s' does not have the externally managed-by annotation"+
" - skipping as this is managed directly by the CAPI infrastructure provider",
" - skipping as this is managed directly by the Cluster API infrastructure provider",
infraCluster.GetNamespace(), infraCluster.GetName()))

return ctrl.Result{}, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/controllers/infracluster/powervs.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (r *InfraClusterController) ensureIBMPowerVSCluster(ctx context.Context, lo

machineSpec, err := getPowerVSMAPIProviderSpec(ctx, r.Client)
if err != nil {
return nil, fmt.Errorf("unable to get PowerVS MAPI ProviderSpec: %w", err)
return nil, fmt.Errorf("unable to get PowerVS Machine API ProviderSpec: %w", err)
}

serviceInstance, err := getPowerVSServiceInstance(machineSpec.ServiceInstance)
Expand Down Expand Up @@ -125,12 +125,12 @@ func (r *InfraClusterController) ensureIBMPowerVSCluster(ctx context.Context, lo
func getPowerVSMAPIProviderSpec(ctx context.Context, cl client.Client) (*mapiv1.PowerVSMachineProviderConfig, error) {
rawProviderSpec, err := getRawMAPIProviderSpec(ctx, cl)
if err != nil {
return nil, fmt.Errorf("unable to obtain MAPI ProviderSpec: %w", err)
return nil, fmt.Errorf("unable to obtain Machine API ProviderSpec: %w", err)
}

providerSpec := &mapiv1.PowerVSMachineProviderConfig{}
if err := yaml.Unmarshal(rawProviderSpec, providerSpec); err != nil {
return nil, fmt.Errorf("unable to unmarshal MAPI ProviderSpec: %w", err)
return nil, fmt.Errorf("unable to unmarshal Machine API ProviderSpec: %w", err)
}

return providerSpec, nil
Expand Down
12 changes: 6 additions & 6 deletions pkg/controllers/infracluster/vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (r *InfraClusterController) ensureVSphereCluster(ctx context.Context, log l

// First make sure the CAPI VSphere credentials secret exists.
if err := r.ensureVSphereSecret(ctx, vsphereServerAddr); err != nil {
return nil, fmt.Errorf("unable to ensure CAPI VSphere credentials secret: %w", err)
return nil, fmt.Errorf("unable to ensure Cluster API VSphere credentials secret: %w", err)
}

target := &vspherev1.VSphereCluster{ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -117,12 +117,12 @@ func (r *InfraClusterController) ensureVSphereCluster(ctx context.Context, log l
func getVSphereMAPIProviderSpec(ctx context.Context, cl client.Client) (*mapiv1beta1.VSphereMachineProviderSpec, error) {
rawProviderSpec, err := getRawMAPIProviderSpec(ctx, cl)
if err != nil {
return nil, fmt.Errorf("unable to obtain MAPI ProviderSpec: %w", err)
return nil, fmt.Errorf("unable to obtain Machine API ProviderSpec: %w", err)
}

providerSpec := &mapiv1beta1.VSphereMachineProviderSpec{}
if err := yaml.Unmarshal(rawProviderSpec, providerSpec); err != nil {
return nil, fmt.Errorf("unable to unmarshal MAPI ProviderSpec: %w", err)
return nil, fmt.Errorf("unable to unmarshal Machine API ProviderSpec: %w", err)
}

return providerSpec, nil
Expand All @@ -138,7 +138,7 @@ func (r *InfraClusterController) ensureVSphereSecret(ctx context.Context, vspher
}

if err := r.Client.Get(ctx, client.ObjectKeyFromObject(vSphereSecret), vSphereSecret); err != nil && !cerrors.IsNotFound(err) {
return fmt.Errorf("failed to get CAPI VSphere credentials secret: %w", err)
return fmt.Errorf("failed to get Cluster API VSphere credentials secret: %w", err)
} else if err == nil {
// The secret already exists.
return nil
Expand All @@ -155,7 +155,7 @@ func (r *InfraClusterController) ensureVSphereSecret(ctx context.Context, vspher
}

if err := r.Client.Create(ctx, vSphereSecret); err != nil && !cerrors.IsAlreadyExists(err) {
return fmt.Errorf("unable to create CAPI VSphere credentials secret: %w", err)
return fmt.Errorf("unable to create Cluster API VSphere credentials secret: %w", err)
}

return nil
Expand Down Expand Up @@ -190,7 +190,7 @@ func (r *InfraClusterController) getVSphereServerAddr(ctx context.Context) (stri
// Devise VSphere server addr via MAPI providerSpec.
machineSpec, err := getVSphereMAPIProviderSpec(ctx, r.Client)
if err != nil {
return "", fmt.Errorf("unable to get VSphere MAPI ProviderSpec: %w", err)
return "", fmt.Errorf("unable to get VSphere Machine API ProviderSpec: %w", err)
}

return machineSpec.Workspace.Server, nil
Expand Down
Loading