Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observed a panic in reconciler: runtime error: invalid memory address or nil pointer dereference #62

Open
amimof opened this issue Nov 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@amimof
Copy link

amimof commented Nov 20, 2024

Description

provider-minio Pod enters a crash loop state when creating a User. See my configuration attached to the Issue.
The User, Policy and Buckets are greated in Minio but the user hangs in Creating state with the Pod stuck in crashing state.

NAME                                       SYNCED   READY   STATUS
MinioBucket/my-super-bucket (default)      True     False   Waiting: Claim is waiting for composite resource to become Ready
└─ xMinioBucket/my-super-bucket-csrwz   False    False   ReconcileError: ...imeout=10s": no endpoints available for service "provider-minio"
   ├─ Bucket/default-my-super-bucket       True     True    Available
   ├─ Policy/default-my-super-bucket       True     True    Available
   └─ User/default-my-super-bucket         True     False   Creating


Additional Context

Definition

apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
  name: xminiobuckets.mygroup.se
spec:
  group: mygroup.se
  names:
    kind: xMinioBucket
    plural: xminiobuckets
  claimNames:
    kind: MinioBucket
    plural: miniobuckets
  versions:
    - name: v1alpha1
      served: true
      referenceable: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                name:
                  type: string

Composition

apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
  name: miniobucket
spec:
  compositeTypeRef:
    apiVersion: mygroup.se/v1alpha1
    kind: xMinioBucket
  mode: Pipeline
  pipeline:
    # Create the policy
    - step: create-policy
      functionRef:
        name: function-patch-and-transform
      input:
        apiVersion: pt.fn.crossplane.io/v1
        kind: Resources
        resources:
          - name: policy
            base:
              apiVersion: minio.crossplane.io/v1
              kind: Policy
              metadata:
                name: ""
              spec:
                forProvider:
                  allowBucket: ""
                providerConfigRef:
                  name: provider-config
            patches:
              - type: CombineFromComposite
                combine:
                  variables:
                    - fromFieldPath: spec.claimRef.namespace
                    - fromFieldPath: spec.claimRef.name
                  strategy: string
                  string:
                    fmt: "%s-%s"
                toFieldPath: metadata.name
              - type: CombineFromComposite
                combine:
                  variables:
                    - fromFieldPath: spec.claimRef.namespace
                    - fromFieldPath: spec.claimRef.name
                  strategy: string
                  string:
                    fmt: "%s-%s"
                toFieldPath: spec.forProvider.allowBucket

    # Create user
    - step: create-user
      functionRef:
        name: function-patch-and-transform
      input:
        apiVersion: pt.fn.crossplane.io/v1
        kind: Resources
        resources:
          - name: user
            base:
              apiVersion: minio.crossplane.io/v1
              kind: User
              metadata:
                name: ""
              spec:
                forProvider:
                  policies:
                    - ""
                providerConfigRef:
                  name: provider-config
            patches:
              - type: CombineFromComposite
                combine:
                  variables:
                    - fromFieldPath: spec.claimRef.namespace
                    - fromFieldPath: spec.claimRef.name
                  strategy: string
                  string:
                    fmt: "%s-%s"
                toFieldPath: metadata.name
              - type: CombineFromComposite
                combine:
                  variables:
                    - fromFieldPath: spec.claimRef.namespace
                    - fromFieldPath: spec.claimRef.name
                  strategy: string
                  string:
                    fmt: "%s-%s"
                toFieldPath: spec.forProvider.policies[0]

    # Create the bucket
    - step: create-bucket
      functionRef:
        name: function-patch-and-transform
      input:
        apiVersion: pt.fn.crossplane.io/v1
        kind: Resources
        resources:
          - name: bucket
            base:
              apiVersion: minio.crossplane.io/v1
              kind: Bucket
              metadata:
                name: ""
              spec:
                forProvider: {}
                writeConnectionSecretToRef:
                  name: ""
                providerConfigRef:
                  name: provider-config
            patches:
              - type: CombineFromComposite
                combine:
                  variables:
                    - fromFieldPath: spec.claimRef.namespace
                    - fromFieldPath: spec.claimRef.name
                  strategy: string
                  string:
                    fmt: "%s-%s"
                toFieldPath: metadata.name
              - type: FromCompositeFieldPath
                fromFieldPath: spec.claimRef.name
                toFieldPath: spec.writeConnectionSecretToRef.name
              - type: FromCompositeFieldPath
                fromFieldPath: spec.claimRef.namespace
                toFieldPath: spec.writeConnectionSecretToRef.namespace

Claim

apiVersion: mygroup.se/v1alpha1
kind: MinioBucket
metadata:
  name: my-super-bucket
  namespace: default
spec:
  name: my-super-bucket

Logs

2024-11-20T13:25:57.569Z | INFO | provider-minio.operator | controller/controller.go:115 | Observed a panic in reconciler: runtime error: invalid memory address or nil pointer dereference | {"controller": "bucket.minio.crossplane.io", "controllerGroup": "minio.crossplane.io", "controllerKind": "User", "User": {"name":"default-my-super-bucket"}, "namespace": "", "name": "default-my-super-bucket", "reconcileID": "803247e1-52a2-4f09-ad96-6fc6840e40c8"}
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x173c039]

goroutine 170 [running]:
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
        /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:116 +0x1e5
panic({0x18cdec0?, 0x2b0ba20?})
        /opt/hostedtoolcache/go/1.22.6/x64/src/runtime/panic.go:770 +0x132
github.com/vshn/provider-minio/operator/user.(*userClient).Observe(0xc00041a980, {0x1de48d0, 0xc0001ee1c0}, {0x1dfc480, 0xc0005f7a40})
        /home/runner/work/provider-minio/provider-minio/operator/user/observe.go:73 +0x639
github.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile(0xc0003de0f0, {0x1de4828, 0xc000286630}, {{{0x0, 0x0}, {0xc0004d0648, 0x17}}})
        /home/runner/go/pkg/mod/github.com/crossplane/crossplane-runtime@v1.15.1/pkg/reconciler/managed/reconciler.go:903 +0x2110
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x1de8be8?, {0x1de4828?, 0xc000286630?}, {{{0x0?, 0xb?}, {0xc0004d0648?, 0x0?}}})
        /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:119 +0xb7
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0002366e0, {0x1de4860, 0xc00035b400}, {0x1957060, 0xc000400440})
        /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:316 +0x3bc
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0002366e0, {0x1de4860, 0xc00035b400})
        /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:266 +0x1be
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
        /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:227 +0x79
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 in goroutine 54
        /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:223 +0x50c

Expected Behavior

Expect that provider-minio Pod not to crash, but rather provide an error message indicating what is wrong

Steps To Reproduce

No response

Versions

Kubernetes: v1.29.8+f10c92d
Crossplane: v1.18.0
provider-minio: v0.4.3

@amimof amimof added the bug Something isn't working label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant