Skip to content

Control plane operator image lookup fails when trying to launch a custom hypershift-operator image interactively #5502

Open
@maxcao13

Description

OpenShift: 4.17.10
HyperShift binary: latest

Following the steps here: https://hypershift-docs.netlify.app/contribute/develop_in_cluster/#launch-a-custom-hypershift-operator-image-interactively runs in to an issue where if you don't specify a control plane operator image, the hypershift-operator will try and retrieve the image from it's own pod spec, and fail.

$ oc debug --namespace hypershift deployments/operator --image $(hack/publish-ocp.sh ./hypershift-operator) -- \
  /ko-app/hypershift-operator run \
  --oidc-storage-provider-s3-region $BUCKET_REGION \
  --oidc-storage-provider-s3-bucket-name $BUCKET_NAME \
  --oidc-storage-provider-s3-credentials /etc/oidc-storage-provider-s3-creds/credentials \
  --namespace hypershift \
  --pod-name operator-debug
{"level":"info","ts":"2025-01-29T18:44:32Z","logger":"setup","msg":"Starting hypershift-operator-manager","version":"openshift/hypershift: 6889612230b4caedddd1feb28fc783b72f03d99f. Latest supported OCP: 4.19.0"}
{"level":"info","ts":"2025-01-29T18:44:37Z","logger":"setup","msg":"objectkey","objectkey":{"name":"operator-debug","namespace":"hypershift"}}
failed to find operator image: failed to get operator pod hypershift/operator-debug: pods "operator-debug" not found

I'm not exactly sure why this doesn't fail regularly, but I assume this is because of the way the debug pod is named vs. the way a regular deployment pod is name:

deployment pod: operator-7bbf5b77c8-hk7t9
debug pod: operator-debug-84rjg

The debug pod does not have a pod template hash suffix, and I guess that makes this lookup fail?

me := &corev1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: opts.Namespace, Name: opts.PodName}}
if err := mgr.GetAPIReader().Get(ctx, crclient.ObjectKeyFromObject(me), me); err != nil {

A way to fix this is to just pass in the full pod name using downward API, but I wasn't sure if that would create other bugs:

operatorPodName := os.Getenv("MY_NAME")

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions