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

Resource modifier does not allow adding a label #8470

Open
alfredomagallon opened this issue Dec 2, 2024 · 2 comments
Open

Resource modifier does not allow adding a label #8470

alfredomagallon opened this issue Dec 2, 2024 · 2 comments
Assignees
Labels
Bug Needs info Waiting for information

Comments

@alfredomagallon
Copy link

What steps did you take and what happened:
I tried to use a resource modifier to add a label to a custom resource, in the following way:

patches:
  - operation: add
    path: "/metadata/labels/alfredo"
    value: "true"

However, this is removing all the previous labels present in the resource, and letting the velero added labels only.

What did you expect to happen:

The modifier should have added the label alfredo: "true" to the resource

Environment:

  • Velero version:
- Client:
	Version: v1.15.0
	Git commit: -
Server:
	Version: v1.15.0
  • Velero features: <NOT SET>
  • Kubernetes version (use kubectl version):
Client Version: v1.31.3
Kustomize Version: v5.4.2
Server Version: v1.29.10-eks-7f9249a
  • Cloud provider or hardware configuration: AWS EKS
  • OS (e.g. from /etc/os-release): Ubuntu

Vote on this issue!

This is an invitation to the Velero community to vote on issues, you can see the project's top voted issues listed here.
Use the "reaction smiley face" up to the right of this comment to vote.

  • 👍 for "I would like to see this bug fixed as soon as possible"
  • 👎 for "There are more important bugs to focus on right now"
@kaovilai kaovilai added the Bug label Dec 2, 2024
@ywk253100
Copy link
Contributor

@anshulahuja98 Could you take a look at this?

@anshulahuja98
Copy link
Collaborator

anshulahuja98 commented Dec 5, 2024

Can you try this patch with kubectl once and see if it works as you expect it to?

The design and approach is inspired from [kubectl patch command](https://github.com/kubernetes/kubectl/blob/0a61782351a027411b8b45b1443ec3dceddef421/pkg/cmd/patch/patch.go#L102C2-L104C1)
Update a container’s image using a json patch with positional arrays kubectl patch pod valid-pod -type='json’ -p=’[{“op”: “replace”, “path”: “/spec/containers/0/image”, “value”:“new image”}]’
Before creating the resource modifier yaml, you can try it out using kubectl patch command. The same commands should work as it is.

@ywk253100 ywk253100 added the Needs info Waiting for information label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs info Waiting for information
Projects
None yet
Development

No branches or pull requests

4 participants