crossplane-contrib/provider-kubernetes

Panic

malins opened this issue · 2 comments

Hello,

does this provider work with latest Kubernetes version (v1.29.2) and latest Crossplane-Version (1.15.1)?

First, the provider pod is outputting only panic messages:

 18:19:42.865925       1 runtime.go:79] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
goroutine 155 [running]:
k8s.io/apimachinery/pkg/util/runtime.logPanic({0x1853aa0?, 0x2983950})
        k8s.io/apimachinery@v0.28.4/pkg/util/runtime/runtime.go:75 +0x99
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
        sigs.k8s.io/controller-runtime@v0.16.3/pkg/internal/controller/controller.go:108 +0xc5
panic({0x1853aa0, 0x2983950})
        runtime/panic.go:884 +0x213
github.com/crossplane-contrib/provider-kubernetes/internal/clients.restConfigFromAPIConfig(0xc00045e720)
        github.com/crossplane-contrib/provider-kubernetes/internal/clients/client.go:49 +0xcd
github.com/crossplane-contrib/provider-kubernetes/internal/clients.NewRESTConfig({0xc000561000?, 0xc0003bfb90?, 0xc000551750?})
        github.com/crossplane-contrib/provider-kubernetes/internal/clients/client.go:30 +0x53
github.com/crossplane-contrib/provider-kubernetes/internal/controller/object.(*connector).Connect(0xc0004de700, {0x1d14838, 0xc0003bfb90}, {0x1d28df8?, 0xc0001be800?})
        github.com/crossplane-contrib/provider-kubernetes/internal/controller/object/object.go:181 +0x21d
github.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*NopDisconnecter).Connect(0xc000145990?, {0x1d14838?, 0xc0003bfb90?}, {0x1d28df8?, 0xc0001be800?})
        github.com/crossplane/crossplane-runtime@v1.14.3/pkg/reconciler/managed/reconciler.go:246 +0x35
github.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile(0xc0000f6690, {0x1d14870, 0xc0003bfa70}, {{{0x0, 0x0}, {0xc00004a810, 0xd}}})
        github.com/crossplane/crossplane-runtime@v1.14.3/pkg/reconciler/managed/reconciler.go:881 +0x2573
github.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile(0xc000237860, {0x1d14870, 0xc0003bfa70}, {{{0x0?, 0x5?}, {0xc00004a810?, 0xc000973d48?}}})
        github.com/crossplane/crossplane-runtime@v1.14.3/pkg/ratelimiter/reconciler.go:54 +0x16b
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x1d17328?, {0x1d14870?, 0xc0003bfa70?}, {{{0x0?, 0xb?}, {0xc00004a810?, 0x0?}}})
        sigs.k8s.io/controller-runtime@v0.16.3/pkg/internal/controller/controller.go:119 +0xc8
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc000127860, {0x1d147c8, 0xc000264e60}, {0x18e1920?, 0xc0000b1560?})
        sigs.k8s.io/controller-runtime@v0.16.3/pkg/internal/controller/controller.go:316 +0x3ca
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc000127860, {0x1d147c8, 0xc000264e60})
        sigs.k8s.io/controller-runtime@v0.16.3/pkg/internal/controller/controller.go:266 +0x1d9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
        sigs.k8s.io/controller-runtime@v0.16.3/pkg/internal/controller/controller.go:227 +0x85
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2
        sigs.k8s.io/controller-runtime@v0.16.3/pkg/internal/controller/controller.go:223 +0x587

Second, when creating the namespace-object, the managed resource is created, but there is no status assigned:

NAME                                               KIND             PROVIDERCONFIG       SYNCED   READY   AGE
object.kubernetes.crossplane.io/sample-namespace   Namespace        k8s-crossplane                    4m22s
apiVersion: kubernetes.crossplane.io/v1alpha2
kind: Object
metadata:
  annotations:
    crossplane.io/external-name: sample-namespace
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"kubernetes.crossplane.io/v1alpha2","kind":"Object","metadata":{"annotations":{},"name":"sample-namespace"},"spec":{"forProvider":{"manifest":{"apiVersion":"v1","kind":"Namespace","metadata":{"labels":{"example":"true"}}}},"providerConfigRef":{"name":"k8s-crossplane"}}}
  creationTimestamp: "2024-04-04T18:15:59Z"
  generation: 2
  name: sample-namespace
  resourceVersion: "205334"
  uid: c976cd9e-6c56-43a2-9250-dfa08ba09b6e
spec:
  deletionPolicy: Delete
  forProvider:
    manifest:
      apiVersion: v1
      kind: Namespace
      metadata:
        labels:
          example: "true"
  managementPolicies:
  - '*'
  providerConfigRef:
    name: k8s-crossplane
  readiness:
    policy: SuccessfulCreate

Any hints on how to get this provider working are welcome.

Thank you,
Manuel

panic({0x1853aa0, 0x2983950})
runtime/panic.go:884 +0x213
github.com/crossplane-contrib/provider-kubernetes/internal/clients.restConfigFromAPIConfig(0xc00045e720)
github.com/crossplane-contrib/provider-kubernetes/internal/clients/client.go:49 +0xcd
github.com/crossplane-contrib/provider-kubernetes/internal/clients.NewRESTConfig({0xc000561000?, 0xc0003bfb90?, 0xc000551750?})
github.com/crossplane-contrib/provider-kubernetes/internal/clients/client.go:30 +0x53

This would seem to indicate a problem with the content of the ProviderConfig - have you tested with a known-good ProviderConfig?

Hi, the "current-context" in the kubeconfig was wrong.
Thanks.