Skip to content

Development proxy ignores path in K8s API URL #4925

@rbq

Description

@rbq

Bug Report

What did you do?

  1. set ~/.kube/config to a Rancher-managed cluster's API
    (sth. like https://my-domain.tld/k8s/clusters/c-some-id)
  2. kubectl apply […] to deploy CRD
  3. operator-sdk run to run operator

What did you expect to see?

I expected both steps 2 and 3 to target the cluster configured in step 1.

What did you see instead? Under which circumstances?

  1. kubectl apply works as expected
  2. operator-sdk run ignores the path component when setting up the proxy and uses https://my-domain.tld instead

In my particular case this didn't actually surface as an error. Instead the modified API endpoint without a path happened to target the management cluster of my Rancher deployment instead of a development cluster. So it actually ran the operator against a different cluster without any warning at all.

Environment

Operator type:

/language ansible

Kubernetes cluster type:

Rancher, RKE

$ operator-sdk version

operator-sdk version: "v1.7.1-19-g3ce1eeef", […], kubernetes version: "v1.19.4", […]

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"21", […]}
Server Version: version.Info{Major:"1", Minor:"20", […]}

Possible Solution

  1. To prevent people from shooting themselves in the foot I'd suggest that operator-sdk run (and any other commands that might behave similarly) fail with an error message if they encounter an API endpoint with a path component.
  2. It would be nice if Operator SDK could be improved to work with clusters that have an API with a path component, such as the ones behind a Rancher instance or other proxies/multiplexers.

Additional context

Metadata

Metadata

Labels

language/ansibleIssue is related to an Ansible operator projectpriority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions