Skip to content

API version conversion panic #786

@jashandeep-sohi

Description

@jashandeep-sohi

While trying out a simple setup, I'm running into panics:

apiVersion: redis.redis.opstreelabs.in/v1beta2
kind: RedisReplication
metadata:
  name: redis
  labels:
    app.kubernetes.io/component: redis-replication
spec:
  clusterSize: 3
  podSecurityContext:
    runAsUser: 1000
    fsGroup: 1000
  kubernetesConfig:
    image: quay.io/opstree/redis:v7.0.12
    imagePullPolicy: IfNotPresent
    resources:
      requests:
        cpu: 100m
        memory: 128Mi
      limits:
        cpu: 100m
        memory: 128Mi
    updateStrategy:
      type: RollingUpdate
  redisExporter:
    enabled: false
    image: quay.io/opstree/redis-exporter:v1.44.0
    imagePullPolicy: Always
  storage:
    volumeClaimTemplate:
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi
  affinity:
    podAntiAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        - labelSelector:
            matchLabels:
              app.kubernetes.io/component: redis-replication
          topologyKey: "kubernetes.io/hostname"

Controller panic:

2024/02/24 01:10:41 http: panic serving 10.100.0.73:54262: runtime error: invalid memory address or nil pointer dereference

goroutine 858 [running]:

net/http.(*conn).serve.func1()

/usr/local/go/src/net/http/server.go:1802 +0xb9

panic({0x15a64a0, 0x25b9ba0})

/usr/local/go/src/runtime/panic.go:1047 +0x266

github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta1.(*RedisReplication).ConvertFrom(0xc000ace200, {0x1989430, 0xc000438fc0})

/workspace/api/v1beta1/redisreplication_conversion.go:147 +0x600

sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*Webhook).convertObject(0xc00076e3e0, {0x1983e28, 0xc000438fc0}, {0x1983ce8, 0xc000ace200})

/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/webhook/conversion/conversion.go:142 +0x488

sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*Webhook).handleConvertRequest(0xc00076e3e0, 0xc000155ac0)

/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/webhook/conversion/conversion.go:107 +0x24b

sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*Webhook).ServeHTTP(0x196f500, {0x7f43a0d8c6e0, 0xc0002fecd0}, 0xc000247500)

/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/webhook/conversion/conversion.go:74 +0xeb

github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1({0x7f43a0d8c6e0, 0xc0002fecd0}, 0xc0002fecd0)

/go/pkg/mod/github.com/prometheus/client_golang@v1.11.1/prometheus/promhttp/instrument_server.go:40 +0xd4

net/http.HandlerFunc.ServeHTTP(0x19945c0, {0x7f43a0d8c6e0, 0xc0002fecd0}, 0xc000011a60)

/usr/local/go/src/net/http/server.go:2047 +0x2f

github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x19945c0, 0xc000a11500}, 0xc000247500)

/go/pkg/mod/github.com/prometheus/client_golang@v1.11.1/prometheus/promhttp/instrument_server.go:117 +0xa8

net/http.HandlerFunc.ServeHTTP(0x1, {0x19945c0, 0xc000a11500}, 0x25dafe0)

/usr/local/go/src/net/http/server.go:2047 +0x2f

github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2({0x19945c0, 0xc000a11500}, 0xc000247500)

/go/pkg/mod/github.com/prometheus/client_golang@v1.11.1/prometheus/promhttp/instrument_server.go:84 +0xbf

net/http.HandlerFunc.ServeHTTP(0xc16e6e647a560b47, {0x19945c0, 0xc000a11500}, 0xc000a11500)

/usr/local/go/src/net/http/server.go:2047 +0x2f

net/http.(*ServeMux).ServeHTTP(0xc0008ad4ae, {0x19945c0, 0xc000a11500}, 0xc000247500)

/usr/local/go/src/net/http/server.go:2425 +0x149

net/http.serverHandler.ServeHTTP({0x1988040}, {0x19945c0, 0xc000a11500}, 0xc000247500)

/usr/local/go/src/net/http/server.go:2879 +0x43b

net/http.(*conn).serve(0xc000c9d0e0, {0x1998df8, 0xc000776d80})

/usr/local/go/src/net/http/server.go:1930 +0xb08

created by net/http.(*Server).Serve

/usr/local/go/src/net/http/server.go:3034 +0x4e8

Is this the bug?

dst.Spec.ReadinessProbe = &Probe{}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions