kubernetes-sigs / cluster-api-operator

Home for Cluster API Operator, a subproject of sig-cluster-lifecycle
https://cluster-api-operator.sigs.k8s.io
Apache License 2.0
175 stars 79 forks source link

InfrastructureProvider do not pass configSecret #592

Open k0da opened 2 months ago

k0da commented 2 months ago

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

apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: InfrastructureProvider
metadata:
 name: vsphere
 namespace: capi-system
spec:
 version: v1.10.0
 configSecret:
   name: vsphere-secret
apiVersion: v1
data:
  VSPHERE_PASSWORD: XXXXXX
  VSPHERE_USERNAME: XXXX
kind: Secret

Once provider is installed, resulting bootstrap-secret do not contain provided credentials

apiVersion: v1
data:
  credentials.yaml: dXNlcm5hbWU6ICcnCnBhc3N3b3JkOiAnJw==
kind: Secret
metadata:
  labels:
    cluster.x-k8s.io/provider: infrastructure-vsphere
    clusterctl.cluster.x-k8s.io: ""
  name: capv-manager-bootstrap-credentials
  namespace: capi-system
  ownerReferences:
  - apiVersion: operator.cluster.x-k8s.io/v1alpha2
    kind: InfrastructureProvider
    name: vsphere
    uid: f94a5b43-e7e6-4def-9540-c3d8c178083f
type: Opaque

Which is equal to:

username: ''
password: ''%

What did you expect to happen: bootstrap-credentials to contain secret data from spec.configSecret

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]

Environment:

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

k8s-ci-robot commented 2 months ago

This issue is currently awaiting triage.

If CAPI Operator contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
k0da commented 2 months ago

I did run clusterctl generate and see secret is created properly

apiVersion: v1
kind: Secret
metadata:
  labels:
    cluster.x-k8s.io/provider: infrastructure-vsphere
    clusterctl.cluster.x-k8s.io: ""
  name: capv-manager-bootstrap-credentials
  namespace: capv-system
stringData:
  credentials.yaml: |-
    username: 'foo'
    password: 'bar'
type: Opaque
antonblr commented 1 month ago

@k0da can you check the secret namespace. The empty one is in capi-system:

  name: capv-manager-bootstrap-credentials
  namespace: capi-system

And generated with clusterctl generate is from capv-system:

name: capv-manager-bootstrap-credentials
namespace: capv-system