uyuni-project / uyuni-tools

Tools to work with containerized Uyuni server
Apache License 2.0
16 stars 19 forks source link

Migrating from RPM to Kubernetes: Waiting for multi-user.target in wrong namespace #432

Closed thothonegan closed 3 hours ago

thothonegan commented 3 months ago

Once the pod is started up, it monitors the pod till systemd starts up. However, it doesn't set a namespace - causing it to not detect the pod is started if we install into the namespace 'uyuni'.

Debug output: previous commands use the namespace 'uyuni' properly

1:27PM DBG shared/utils/exec.go:67 > Running: kubectl get -o jsonpath={.items[?(@.metadata.name=="uyuni")].status.readyReplicas} deploy -n uyuni
⠋ kubectl get -o jsonpath={.items[?(@.metadata.name=="uyuni")].status.readyReplicas} deploy -n uyuni
⠋ kubectl get -o jsonpath={.items[?(@.metadata.name=="uyuni")].status.readyReplicas} deploy -n uyuni
1:27PM DBG shared/utils/exec.go:67 > Running: kubectl get -o jsonpath={.items[?(@.metadata.name=="uyuni")].status.readyReplicas} deploy -n uyuni
1:27PM DBG shared/utils/exec.go:67 > Running: kubectl get pod -lapp=uyuni -A -o=jsonpath={.items[0].metadata.name}
1:27PM DBG shared/utils/exec.go:41 > Running: kubectl exec uyuni-55976f4bcb-5bdm9 -- systemctl is-active -q multi-user.target
⠋ kubectl exec uyuni-55976f4bcb-5bdm9 -- systemctl is-active -q multi-user.target
⠋ kubectl exec uyuni-55976f4bcb-5bdm9 -- systemctl is-active -q multi-user.target

[repeats]

If running the command manually (first the one its sending, second if i fix the namespace manually)

❯ kubectl exec uyuni-55976f4bcb-5bdm9 -- systemctl is-active -q multi-user.target
Error from server (NotFound): pods "uyuni-55976f4bcb-5bdm9" not found

❯ kubectl -n uyuni exec uyuni-55976f4bcb-5bdm9 -- systemctl is-active -q multi-user.target
Defaulted container "uyuni" out of: uyuni, init-var-cobbler (init), init-var-salt (init), init-var-pgsql (init), init-var-cache (init), init-var-log (init), init-srv-salt (init), init-srv-www (init), init-srv-tftpboot (init), init-srv-formulametadata (init), init-srv-pillar (init), init-srv-susemanager (init), init-srv-spacewalk (init), init-root (init), init-etc-apache2 (init), init-etc-rhn (init), init-etc-systemd-multi (init), init-etc-systemd-sockets (init), init-etc-salt (init), init-etc-tomcat (init), init-etc-cobbler (init), init-etc-sysconfig (init), init-etc-postfix (init), init-etc-sssd (init)

Workaround: kubectl config set-context --current --namespace=uyuni prior to running the migration.


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 2 months ago

Hello. Thanks for trying it out and reporting issues. I know there are issues with migration to kubernetes and I am currently heavily refactoring it. This issue though may be addressed by PR https://github.com/uyuni-project/uyuni-tools/pull/420

cbosdo commented 2 months ago

@rjpmestre Could you take a look?

rjpmestre commented 2 months ago

@cbosdo , @thothonegan yes, i can confirm this migration scenario is covered on https://github.com/uyuni-project/uyuni-tools/pull/420

cbosdo commented 3 hours ago

PR merged