clusterpedia icon indicating copy to clipboard operation
clusterpedia copied to clipboard

Apiserver address is null when pediacluster is applied by kubeconfig

Open wuyingjun-lucky opened this issue 2 years ago • 8 comments

What would you like to be added?

Apiserver always be the real address.

Why is this needed?

1、apiserver set to “” image

2、apiserver set to “dddd” image

wuyingjun-lucky avatar Aug 10 '22 06:08 wuyingjun-lucky

Hi @wuyingjun-lucky, Thanks for opening an issue! We will look into it as soon as possible.

Details

Instructions for interacting with me using comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the gh-ci-bot repository.

github-actions[bot] avatar Aug 10 '22 06:08 github-actions[bot]

@Iceber

wuyingjun-lucky avatar Aug 10 '22 06:08 wuyingjun-lucky

Did you change the apiserver from the correct one to the wrong one?

apiserver set to “dddd”

The conditoins and printer column were changed in v0.4.1, it will make the output look better, you can update the image version and crd yaml.

Also the string may be a domain name, maybe it doesn't work now, but it may work in the future, so we will allow the user to set any value, but if there is an exception, we will tell the user via conditons

apiserver set to “”

The apiserver is allowed to be empty because the user can just provide kubeconfig. since we don't provide a multation webhook to parse the kubeconfig, the apiserver will be empty.

Here are some discussions in https://github.com/clusterpedia-io/clusterpedia/pull/115#discussion_r828847480

Iceber avatar Aug 10 '22 07:08 Iceber

#115 (comment)

What I am confused about is why don`t we set the apiserver to the real address during reconcile cluster

wuyingjun-lucky avatar Aug 10 '22 08:08 wuyingjun-lucky

Did you change the apiserver from the correct one to the wrong one? I do not start AA but just use kube-apiserver

wuyingjun-lucky avatar Aug 10 '22 08:08 wuyingjun-lucky

#115 (comment)

What I am confused about is why don`t we set the apiserver to the real address during reconcile cluster

Extracting the apiserver address from kubeconfig seems like a good way to let the mutation webhook do the work. Try to only update the status when reconciling the cluster.

But we don't have a mutation webhook yet, so if it feels important to not have an spec.apiserver fields, we can check and set this field when reconciling the cluster.

Add a mutation webhook for spec.apiserver, I'm not sure it's necessary

Iceber avatar Aug 10 '22 08:08 Iceber

But we don't have a mutation webhook yet, so if it feels important to not have an spec.apiserver fields, we can check and set this field when reconciling the cluster.

I think you are right, let webhook do the work is more appropriately.

May be we need a clusterpedia-ctl which can fix it easily.

wuyingjun-lucky avatar Aug 10 '22 08:08 wuyingjun-lucky

I found https://github.com/c-bata/go-prompt and may consider using it to create a kubectl plugin in the future.

This also means that the user does not need to execute the script to generate cluster shortcut for kubectl

Iceber avatar Aug 10 '22 08:08 Iceber

#115 (comment)

What I am confused about is why don`t we set the apiserver to the real address during reconcile cluster

Extracting the apiserver address from kubeconfig seems like a good way to let the mutation webhook do the work. Try to only update the status when reconciling the cluster.

But we don't have a mutation webhook yet, so if it feels important to not have an spec.apiserver fields, we can check and set this field when reconciling the cluster.

Add a mutation webhook for spec.apiserver, I'm not sure it's necessary

How about to place a field named apiserver to pediacluster.status and we can fill the apiserver just like fill the Version @Iceber But it may have same field in spec and status

wuyingjun-lucky avatar Aug 22 '22 05:08 wuyingjun-lucky

@Iceber

wuyingjun-lucky avatar Aug 23 '22 05:08 wuyingjun-lucky

Until we support webhook, I think this is a good way to make sure the apiserver is displayed.

Iceber avatar Aug 23 '22 07:08 Iceber