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

fix empty resource selectors which result to policy will not be consi… #1706

Merged
merged 1 commit into from
May 10, 2022

Conversation

likakuli
Copy link
Contributor

@likakuli likakuli commented May 1, 2022

…dered matched

Signed-off-by: likakuli 1154584512@qq.com

What type of PR is this?

/kind bug

What this PR does / why we need it:
Override policy with empty resourceselectors should effective as nil which means match every resource.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmada-controller-manager`: `OverridePolicy` with empty `ResourceSelector` will be considered to match all resources just like nil.

…dered matched

Signed-off-by: likakuli <1154584512@qq.com>
@karmada-bot karmada-bot added the kind/bug Categorizes issue or PR as related to a bug. label May 1, 2022
@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 1, 2022
@RainbowMango
Copy link
Member

/assign

@RainbowMango
Copy link
Member

@huone1 Please help with it.

@likakuli
Copy link
Contributor Author

Any problem with it?

@RainbowMango
Copy link
Member

Sorry for let this sit. I'll try my best to look at it today.

@RainbowMango
Copy link
Member

I guess we can't apply an empty ResourceSelector. E.g.

apiVersion: policy.karmada.io/v1alpha1
kind: PropagationPolicy
metadata:
  name: nginx-propagation
spec:
  resourceSelectors:
  placement:
    clusterAffinity:
      clusterNames:
        - member1
        - member2

Set ResourceSelector to empty, and this is not allowed:

error: error validating "samples/nginx/propagationpolicy.yaml": error validating data: ValidationError(PropagationPolicy.spec): missing required field "resourceSelectors" in io.karmada.policy.v1alpha1.PropagationPolicy.spec; if you choose to ignore these errors, turn validation off with --validate=false

I'm not saying this patch is not acceptable, just want to know your cases? Am I missing something?

@RainbowMango
Copy link
Member

Sorry, ignore the common on above. What we are talking about is OverridePolicy.

Can you share your yamls here?

@RainbowMango
Copy link
Member

apiVersion: policy.karmada.io/v1alpha1
kind: OverridePolicy
metadata:
  name: example-override
  namespace: default
spec:
  resourceSelectors:
  overrideRules:
    - targetCluster:
        clusterNames:
          - member1
      overriders:
        plaintext:
          - path: "/metadata/annotations"
            operator: add
            value:
              foo: bar

I get it. Your yaml might look like this resourceSelectors:.

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label May 10, 2022
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 10, 2022
@karmada-bot karmada-bot merged commit 977725d into karmada-io:master May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants