Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selfLink is deprecated in newer versions of k8s #2

Open
fedreg-bn opened this issue Nov 8, 2022 · 0 comments
Open

selfLink is deprecated in newer versions of k8s #2

fedreg-bn opened this issue Nov 8, 2022 · 0 comments

Comments

@fedreg-bn
Copy link

fedreg-bn commented Nov 8, 2022

Thanks for this package! Was looking for something similar and stumbled across this.

Are you still maintaining it?

I hit an issue where I got a JSON readtable error when trying to get pods info.

It's because of metadata.selfLink being deprecated since k8s v1.20 so this line (selflink (kubectl--run (format "get deployment.apps %s -o jsonpath={.metadata.selfLink}" name))) returns something like "resource not found" that blows up the json read.

I can comment that out and set the selector to "" to get around it, but then of course it doesn't filter correctly and returns all the pods in the namespace.

(defun kubectl-open-deployment (name)
  (let* ((selflink (kubectl--run (format "get deployment.apps %s -o jsonpath={.metadata.selfLink}" name)))
         (json-object-type 'hash-table)
         (json-array-type 'list)
         (json-key-type 'string)
	 ;; (scale (json-read-from-string (kubectl--run (format "get --raw %s/scale" selflink))))
	 
	 (selector "") ;(gethash "selector" (gethash "status" scale)))
	 (ns kubectl--namespace)
	 (ctx kubectl--context))
    (switch-to-buffer "*kubernetes*")
    (tabulated-list-mode)
    (kubectl-pods-mode)
    (setq kubectl--pods-selector selector)
    (setq kubectl--namespace ns)
    (setq kubectl--context ctx)
    (kubectl-pods-refresh))) 

my kubectl knowledge is limited but I assume everything will work if the selector is set directly?

I can take a stab at a PR at some point but it might be a bit.. wanted to check in about it first.

thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant