crossplane-contrib/provider-kubernetes

Warning when configuring a composition/ persistent volume

uover822 opened this issue · 2 comments

Hi,

I'm currently blocked on an issue when configuring a peristsent volume in a composition. I've configured my providerconfig/ secret as follows:

apiVersion: kubernetes.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
  name: kubernetes-provider
spec:
  credentials:
    source: Secret
    secretRef:
      namespace: default
      name: regcred
      key: auths

And my related composition configuration looks like so:

  - name: volume
    base:
      apiVersion: kubernetes.crossplane.io/v1alpha1
      kind: Object
      spec:
        forProvider:
          manifest:
            apiVersion: v1
            kind: PersistentVolume
            metadata:
              name: msr-volume
              labels:
                type: local
            spec:
              capacity:
                storage: 3Gi
              accessModes:
                - ReadWriteMany
              persistentVolumeReclaimPolicy: Retain
              storageClassName: msr-sc
              hostPath:
                path: /opt/data
        providerConfigRef:
          name: kubernetes-provider
    patches:
    - fromFieldPath: spec.id
      toFieldPath: metadata.name
      transforms:
        - type: string
          string:
            fmt: "%s-volume"
    - fromFieldPath: spec.parameters.volume
      toFieldPath: spec.forProvider.manifest.metadata.name
    - fromFieldPath: spec.parameters.capacity
      toFieldPath: spec.forProvider.manifest.spec.capacity.storage
    - fromFieldPath: spec.parameters.storageClass
      toFieldPath: spec.forProvider.manifest.spec.storageClassName
    - fromFieldPath: spec.parameters.hostPath
      toFieldPath: spec.forProvider.manifest.spec.hostPath.path
    connectionDetails:
    - fromConnectionSecretKey: kubeconfig
    readinessChecks:
      - type: None

I'm getting events logged like the following:

3s          Warning   CannotConnectToProvider          object/volume-zpq8w-lsbd5                           cannot create new REST config using provider secret: currentContext not set in kubeconfig

Even though my current-context reports:

$ k config current-context
k3d-mycluster

Has anyone experienced this/ have ideas what I might be doing wrong?

Thanks

I've tested the envars KUBERNETES_SERVICE_HOST, KUBERNETES_SERVICE_PORT w/o success.

I was able to resolve this problem by reworking my providerconfig(s) and compositions, adding a separate providerconfig for managing secrets.