Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-38358

hostedcontrolplane controller crashes when hcp.Spec.Platform.AWS.CloudProviderConfig.Subnet.ID is undefined

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 4.16.z
    • HyperShift
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Rejected
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

          hostedcontrolplane controller crashes when hcp.Spec.Platform.AWS.CloudProviderConfig.Subnet.ID is undefined, relevant code is at https://github.com/openshift/hypershift/blob/main/control-plane-operator/controllers/hostedcontrolplane/cloud/aws/params.go#L32, the Subnet.ID variable is not initialized by any struct as the types definitions only include the Subnet variable (as per https://github.com/openshift/hypershift/blob/main/api/hypershift/v1alpha1/hostedcluster_types.go#L1029), that causes a panic in the reconciler loop.

      Version-Release number of selected component (if applicable):

          OCP 4.16 with MCE 2.6

      How reproducible:

          100% of the times

      Steps to Reproduce:

          1. Create a HostedCluster object without specifying hcp.Spec.Platform.AWS.CloudProviderConfig.Subnet
          2. See the control-plane-operator reconcile crash with """{"level":"info","ts":"2024-08-12T10:46:43Z","msg":"Reconciling cloud provider config","controller":"hostedcontrolplane","controllerGroup":"hypershift.openshift.io","controllerKind":"HostedControlPlane","HostedControlPlane":{"name":"lab-spoke1","namespace":"lab-scale-spoke1-aws-us-east-1-lab-spoke1"},"namespace":"lab-scale-spoke1-aws-us-east-1-lab-spoke1","name":"lab-spoke1","reconcileID":"7ff831e3-6dfd-4b69-b468-566c6ec82873"}{"level":"info","ts":"2024-08-12T10:46:43Z","msg":"Observed a panic in reconciler: runtime error: invalid memory address or nil pointer dereference","controller":"hostedcontrolplane","controllerGroup":"hypershift.openshift.io","controllerKind":"HostedControlPlane","HostedControlPlane":{"name":"lab-spoke1","namespace":"lab-scale-spoke1-aws-us-east-1-lab-spoke1"},"namespace":"lab-scale-spoke1-aws-us-east-1-lab-spoke1","name":"lab-spoke1","reconcileID":"7ff831e3-6dfd-4b69-b468-566c6ec82873"}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=0x0 pc=0x4ee0841]
      goroutine 554 [running]:sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()	/hypershift/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:116 +0x30apanic({0x5bd2340?, 0x86ffbf0?})	/usr/lib/golang/src/runtime/panic.go:920 +0x290github.com/openshift/hypershift/control-plane-operator/controllers/hostedcontrolplane/cloud/aws.NewAWSParams(0xc000652000)	/hypershift/control-plane-operator/controllers/hostedcontrolplane/cloud/aws/params.go:32 +0x1e1github.com/openshift/hypershift/control-plane-operator/controllers/hostedcontrolplane.(*HostedControlPlaneReconciler).reconcileCloudProviderConfig(0xc000a2b0a0, {0x6ac8378, 0xc000f29980}, 0xc000652000, 0xc000a8a330)	/hypershift/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go:2544 +0xeagithub.com/openshift/hypershift/control-plane-operator/controllers/hostedcontrolplane.(*HostedControlPlaneReconciler).reconcile(0xc000a2b0a0, {0x6ac8378, 0xc000f29980}, 0xc000652000, 0xc000a8a330, 0xc000c6b4a0, 0xc000c6b440, {{0xc000e2da80, 0x32}, 0x1bb, ...})	/hypershift/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go:989 +0xdc5github.com/openshift/hypershift/control-plane-operator/controllers/hostedcontrolplane.(*HostedControlPlaneReconciler).update(0xc000a2b0a0, {0x6ac8378, 0xc000f29980}, 0xc000652000, 0xc0019e5b90)	/hypershift/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go:893 +0x9dfgithub.com/openshift/hypershift/control-plane-operator/controllers/hostedcontrolplane.(*HostedControlPlaneReconciler).Reconcile(0xc000a2b0a0, {0x6ac8378, 0xc000f29980}, {{{0xc0009ffa10, 0x29}, {0xc000711220, 0xa}}})	/hypershift/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go:744 +0x63c5sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0xc0008c43c0, {0x6ac8378, 0xc000f29980}, {{{0xc0009ffa10, 0x29}, {0xc000711220, 0xa}}})	/hypershift/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:119 +0x1besigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0008c43c0, {0x6ac8378, 0xc000f29980}, {0x5dfdd40, 0xc000c442e0})	/hypershift/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:316 +0x4b9sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0008c43c0, {0x6ac83b0, 0xc0002bdd60})	/hypershift/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:266 +0x3fcsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()	/hypershift/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227 +0xdfcreated by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 in goroutine 267	/hypershift/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:223 +0x98a"""     

      Actual results:

          Missing Subnet key makes the control-plane-operator enter a crash loop

      Expected results:

          Missing Subnet key to throw a more graceful error

      Additional info:

          

              Unassigned Unassigned
              rhit_averi Andrea Veri
              None
              None
              Jie Zhao Jie Zhao
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: