crossplane-contrib / provider-jet-azure

Apache License 2.0
17 stars 20 forks source link

KubernetesCluster connection secret is not properly populated with data #206

Open Levovar opened 2 years ago

Levovar commented 2 years ago

What happened?

When I create a new AKS cluster via the KubernetesCluster provider I expect the resulting connection secret to be populated with data (most importantly the kubeconfig I can use with Object/Helm providers to populate the cluster). This behaviour seems to be the correct one based on https://github.com/crossplane-contrib/provider-jet-azure/issues/112 In my case the secret is being created however only with metadata fields, and without any data.

Any insight as to whether this is a bug, or the expected result has changed since last year? as far as I can tell from the code only dependency bumps have happened since the implementation of 112, so for me it looks like a bug

How can we reproduce it?

Provider is installed with following config:

apiVersion: v1
items:
- apiVersion: azure.jet.crossplane.io/v1alpha1
  kind: ProviderConfig
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"azure.jet.crossplane.io/v1alpha1","kind":"ProviderConfig","metadata":{"annotations":{},"name":"azure"},"spec":{"clientID":"<>","credentials":{"source":"InjectedIdentity"},"subscriptionID":"<>","tenantID":"<>"}}
    creationTimestamp: "2022-08-30T20:09:02Z"
    finalizers:
    - in-use.crossplane.io
    generation: 1
    name: azure
    resourceVersion: "13230"
    uid: <>
  spec:
    clientID: <>
    credentials:
      source: InjectedIdentity
    subscriptionID: <>
    tenantID: <>
  status:
    users: 3

Used following manifest to provision the cluster:

apiVersion: containerservice.azure.jet.crossplane.io/v1alpha2
kind: KubernetesCluster
metadata:
  name: cnstestaks2
spec:
  forProvider:
    defaultNodePool:
    - name: default
      nodeCount: 1
      vmSize: Standard_D2_v2
      vnetSubnetId : <>
    dnsPrefix: cnstestaks2
    identity:
    - type: SystemAssigned
    location: Central US
    resourceGroupNameRef:
      name: rg-cns-04
    tags:
      Environment: test
  providerConfigRef:
    name: azure
  writeConnectionSecretToRef:
    namespace: crossplane-system
    name: cnstestaks1

Provisioning finished successfully:

Events:
  Type    Reason                   Age   From                                                                               Message
  ----    ------                   ----  ----                                                                               -------
  Normal  CreatedExternalResource  23m   managed/containerservice.azure.jet.crossplane.io/v1alpha2, kind=kubernetescluster  Successfully requested creation of external resource

Data is missing from the resulting secret:

]# kubectl get secret cnstestaks1 -n crossplane-system -o yaml
apiVersion: v1
kind: Secret
metadata:
  creationTimestamp: "2022-08-30T20:26:30Z"
  name: cnstestaks1
  namespace: crossplane-system
  ownerReferences:
  - apiVersion: containerservice.azure.jet.crossplane.io/v1alpha2
    controller: true
    kind: KubernetesCluster
    name: cnstestaks2
    uid: 2c3f96f0-fb25-444d-9c3c-89e06aec6f81
  resourceVersion: "13339"
  uid: e3e95a01-2f2b-4cc4-93a9-25079cf918d3
type: connection.crossplane.io/v1alpha1

What environment did it happen in?

Crossplane version: 0.12.0 Cloud environment: Azure Public / AKS K8s details:

# kubectl version --short
Server Version: v1.23.8