Skip to content

Commit

Permalink
Remove shortnames from Tap API resources
Browse files Browse the repository at this point in the history
The Tap API resource shortnames were colliding with existing Kubernetes
resources (e.g. `po`, `deploy`, etc), causing warnings from kubectl
v1.29.0+.

Remove the shortnames from the Tap APIService handlers.

To validate:
```bash
bin/k3d cluster create

curl https://run.linkerd.io/install-edge | sh
linkerd install --crds | kubectl apply -f -
linkerd install        | kubectl apply -f -
linkerd check
linkerd viz install    | kubectl apply -f -
linkerd check

kubectl api-resources --api-group=tap.linkerd.io

kubectl get po

TAP_IMAGE=$(bin/docker-build-tap)
bin/k3d image load $TAP_IMAGE
kubectl -n linkerd-viz set image deploy/tap tap=$TAP_IMAGE

kubectl api-resources --api-group=tap.linkerd.io

kubectl get po
```

Fixes #11784

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
  • Loading branch information
siggy committed Dec 22, 2023
1 parent eec914a commit cd8af6c
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions viz/tap/api/handlers.go
Expand Up @@ -55,19 +55,18 @@ var (

resources = []struct {
name string
shortname string
namespaced bool
}{
{"namespaces", "ns", false},
{"pods", "po", true},
{"replicationcontrollers", "rc", true},
{"services", "svc", true},
{"daemonsets", "ds", true},
{"deployments", "deploy", true},
{"replicasets", "rs", true},
{"statefulsets", "sts", true},
{"jobs", "", true},
{"cronjobs", "cj", true},
{"namespaces", false},
{"pods", true},
{"replicationcontrollers", true},
{"services", true},
{"daemonsets", true},
{"deployments", true},
{"replicasets", true},
{"statefulsets", true},
{"jobs", true},
{"cronjobs", true},
}
)

Expand Down Expand Up @@ -257,7 +256,6 @@ func handleAPIResourceList(w http.ResponseWriter, _ *http.Request, _ httprouter.
resList.APIResources = append(resList.APIResources,
metav1.APIResource{
Name: res.name,
ShortNames: []string{res.shortname},
Namespaced: res.namespaced,
Kind: gvk.Kind,
Verbs: metav1.Verbs{"watch"},
Expand Down

0 comments on commit cd8af6c

Please sign in to comment.