uyuni-project / uyuni-tools

Tools to work with containerized Uyuni server
Apache License 2.0
14 stars 18 forks source link

Migrating from RPM to Kubernetes: Waiting for blank pod name to pull image #431

Open thothonegan opened 4 weeks ago

thothonegan commented 4 weeks ago

When running helm, the pod name was not available instantly after helm ran. This caused the migration to monitor the pod named ''.

Workaround was to suspend the process in the middle of Helm after it outputs the digest, giving it time to resolve before continuing - the pod name then gets picked up properly.

Debug output:

1:20PM DBG shared/utils/exec.go:50 > Running: helm upgrade -n uyuni --create-namespace uyuni oci://registry.opensuse.org/uyuni/server-helm --install --set ingress=nginx -f values.yaml --set images.server=registry.opensuse.org/uyuni/server:latest --set pullPolicy=Always --set fqdn=uyuni.i.hackerguild.com --set migration.ssh.agentSocket=/tmp/ssh-XXXXXXKrz1ro/agent.255003 --set migration.ssh.configPath= --set migration.ssh.knownHostsPath=/root/.ssh/known_hosts --set migration.dataPath=/tmp/mgradm-2307853567
Release "uyuni" does not exist. Installing it now.
Pulled: registry.opensuse.org/uyuni/server-helm:2024.7.0
Digest: sha256:901e88e997a109142de6f5b88966772570dd9ca0feb9ab1cc7d7b4781f98c174
W0818 13:20:59.982709  307290 warnings.go:70] unknown field "labels"
NAME: uyuni
LAST DEPLOYED: Sun Aug 18 13:20:57 2024
NAMESPACE: uyuni
STATUS: deployed
REVISION: 1
TEST SUITE: None
⠋ kubectl get pod -o jsonpath={.items[?(@.metadata.labels.app=="uyuni")].metadata.name} -n uyuni
1:21PM INF shared/kubernetes/utils.go:74 > Waiting for image of  pod in uyuni namespace to be pulled
1:21PM DBG shared/utils/exec.go:67 > Running: kubectl get event -o jsonpath={range .items[?(@.reason=="Failed")]}{.message}{"\n"}{end} --field-selector involvedObject.name= -n uyuni
⠋ kubectl get event -o jsonpath={range .items[?(@.reason=="Failed")]}{.message}{"\n"}{end} --field-selector involvedObject.name= -n uyuni

[repeats as the pod '' never exists]

Expected: If it gets a pod name of '', retry to get the pod name until you get a valid pod name - then continue.


Environment:

Migration command: mgradm migrate kubernetes uyuni.i.hackerguild.com --helm-uyuni-namespace uyuni --helm-uyuni-values values.yaml --logLevel debug

values.yaml

storageClass: "-"
matchPvByLabel: true
ingress: nginx
ingressSslAnnotations:
    cert-manager.io/cluster-issuer: letsencrypt-digitalocean
cbosdo commented 1 week ago

This looks like something I fixed before my vacation but is not merged in main yet.