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

Add karmadactl annotate command #4466

Closed
Affan-7 opened this issue Dec 21, 2023 · 7 comments
Closed

Add karmadactl annotate command #4466

Affan-7 opened this issue Dec 21, 2023 · 7 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@Affan-7
Copy link
Member

Affan-7 commented Dec 21, 2023

What would you like to be added:
Add the karmadactl annotate command.

Why is this needed:
Users may want to use the annotate command from the karmadactl. Currently the karmadactl doesn't support the annotate command, so users would have to switch to the kubectl to run it. Adding the annotate command into the karmadactl will enhance the user experience and take karmadactl one step closer to become independent of kubectl.

Part of #4291.

Design:
The karmadactl will communicate with the Karmada API server to add, remove or update the annotations. A user must specify a single member cluster using --cluster flag to perform this action.

@Affan-7 Affan-7 added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 21, 2023
@Affan-7
Copy link
Member Author

Affan-7 commented Dec 21, 2023

Hi @RainbowMango,

What do you think of it?

@Affan-7
Copy link
Member Author

Affan-7 commented Dec 21, 2023

/assign

@zhzhuang-zju
Copy link
Contributor

@Affan-7 Hi~Command kubectl annotate is used to add or update the annotations of one or more resources. Can you introduce what you think is the function of karmadactl annotate in multi-cluster scenarios and its enhancements compared to kubectl annotate? When you start your development work, you can first introduce your design, such as what are the input parameters and their meaning and assignment.

@Affan-7
Copy link
Member Author

Affan-7 commented Dec 26, 2023

@zhzhuang-zju

Just updated the description. I would love to hear your thoughts.

Design:
The karmadactl will communicate with the Karmada API server to add, remove or update the annotations. A user must specify a single member cluster using --cluster flag to perform this action.

@zhzhuang-zju
Copy link
Contributor

@zhzhuang-zju

Just updated the description. I would love to hear your thoughts.

Design:
The karmadactl will communicate with the Karmada API server to add, remove or update the annotations. A user must specify a single member cluster using --cluster flag to perform this action.

Thank you for providing your thoughts. However, as annotate is a command that can modify resources, I do not recommend using it directly on member clusters. In fact, when updating the annotations on one or more resources directly on a member cluster, Karmada will re-modify them to their previous state. Like

(base) ➜  karmada git:(crypt) ✗ ka annotate deployment deploy-01 description='my frontend'
deployment.apps/deploy-01 annotated
(base) ➜  karmada git:(crypt) ✗ ka get deployment deploy-01 -oyaml
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    description: my frontend
...
(base) ➜  karmada git:(crypt) ✗ km2 get deployment deploy-01 -oyaml
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
    description: my frontend
...
(base) ➜  karmada git:(crypt) ✗ km2 annotate --overwrite deployment deploy-01 description='test'
deployment.apps/deploy-01 annotated
(base) ➜  karmada git:(crypt) ✗ km2 get deployment deploy-01 -oyaml
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
    description: my frontend
...

We can also find that when annotating control plane resources, the modifications have been synchronized to the member clusters, so it seems that there is no need to implement the annotate command specifically for the member clusters.

@Affan-7
Copy link
Member Author

Affan-7 commented Dec 27, 2023

@zhzhuang-zju

Do you have a better idea to implement the annotations or we should close the issue?

@zhzhuang-zju
Copy link
Contributor

@Affan-7 Previously, at a weekly meeting, we discussed how to improve the karmadactl experience and found that users are more interested in commands for Karmada’s unique scenarios, such as promote, or commands with enhanced capabilities relative to kubectl. So I think you can think about it from the above two perspectives. This is more difficult than simply applying kubectl's capabilities to karmada. I haven't have a good idea yet. If there is any progress on my side, I will ping you as soon as possible.

@Affan-7 Affan-7 closed this as completed Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
Status: No status
Development

No branches or pull requests

2 participants