Skip to content

Infrastructure provider not added to the clusterctl providers list when fetchconfiguration provided by configmap #204

@souheilbenslama

Description

@souheilbenslama

What steps did you take and what happened:
[A clear and concise description on how to REPRODUCE the bug.]

i want to install my local ovh infrastructure provider using the cluster api operator. The provider is not in a github repo so i created the following infrastructure provider ressource.


apiVersion: operator.cluster.x-k8s.io/v1alpha1
kind: InfrastructureProvider
metadata:
  name:  infrastructure-capovh
  namespace: capi-system
spec:
  version: v0.1.0
  secretName: ovh-variables
  secretNamespace: capi-system
  fetchConfig:
    selector:
      matchLabels:
         cluster.x-k8s.io/provider: infrastructure-capovh

and created the config map containing the metadata and components .yaml


apiVersion: v1
kind: ConfigMap
metadata:
  name: v0.1.0
  namespace: capi-system
  labels:
    cluster.x-k8s.io/provider: infrastructure-capovh
    provider.cluster.x-k8s.io/version: v0.1.0  
data:
  metadata: |
    apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
    releaseSeries:
    - major: 0
      minor: 1
      contract: v1beta1
  components: |
    apiVersion: v1
    kind: Namespace

i expected the operator to be able to fetch the infrastructure-components.yaml and install the provider. but it returned this error .

msg"="Reconciler error" "error"="failed to get configuration for the InfrastructureProvider with name infrastructure-capov │
│ h. Please check the provider name and/or add configuration for new providers using the .clusterctl config file" "InfrastructureProvider"={"name":"infrastructure-capovh","namespace": │
│ "capi-system"} "controller"="infrastructureprovider" "controllerGroup"="[operator.cluster.x-k8s.io](http://operator.cluster.x-k8s.io/)" "controllerKind"="InfrastructureProvider" "name"="infrastructure-capovh" "namespac │
│ e"="capi-system" "reconcileID"="9fea4b23-53c0-42a5-baa0-613f86c67dac"

the reason of this error is that the provider name is not added to the clusterctl list in case when not url is provided to fetch config but slector is provided . the current implementation only handle the url case.

https://github.com/kubernetes-sigs/cluster-api-operator/blob/main/internal/controller/phases.go#L220-L224

Environment:

  • Cluster-api-operator version: 0.4.0
  • Cluster-api version:
  • Minikube/KIND version:
  • Kubernetes version: (use kubectl version):
  • OS (e.g. from /etc/os-release):

/kind bug
[One or more /area label. See https://github.com/kubernetes-sigs/cluster-api-operator/labels?q=area for the list of labels]

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions