-
Notifications
You must be signed in to change notification settings - Fork 771
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
sidecarSet support namespace selector #1178
Conversation
test/e2e/apps/sidecarset.go
Outdated
nsObj, err := c.CoreV1().Namespaces().Get(context.TODO(), ns, metav1.GetOptions{}) | ||
gomega.Expect(err).NotTo(gomega.HaveOccurred()) | ||
nsObj.Labels["inject"] = "sidecar" | ||
nsObj, err = c.CoreV1().Namespaces().Update(context.TODO(), nsObj, metav1.UpdateOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SA4006: this value of nsObj is never used
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Command | Usage |
---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
Help us improve LIFT! (Sonatype LiftBot external survey)
Was this a good recommendation for you? Answering this survey will not impact your Lift settings.
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
98b4e8d
to
e818909
Compare
e818909
to
4480de4
Compare
@@ -41,6 +41,10 @@ type SidecarSetSpec struct { | |||
// otherwise, match pods in all namespaces(in cluster) | |||
Namespace string `json:"namespace,omitempty"` | |||
|
|||
// NamespaceSelector selector which namespaces inject sidecar containers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NamespaceSelector select which namespaces to inject sidecar containers.
} | ||
if (originNamespace != "" && otherSelector != nil) || | ||
(otherNamespace != "" && originSelector != nil) { | ||
return true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we check other namesapce Selector can select the origin namespace before return true ?
4480de4
to
425d018
Compare
@@ -325,7 +330,7 @@ func validateSidecarConflict(sidecarSets *appsv1alpha1.SidecarSetList, sidecarSe | |||
matchedList := make([]*appsv1alpha1.SidecarSet, 0) | |||
for i := range sidecarSets.Items { | |||
obj := &sidecarSets.Items[i] | |||
if !isSidecarSetNamespaceDiff(sidecarSet, obj) && util.IsSelectorOverlapping(sidecarSet.Spec.Selector, obj.Spec.Selector) { | |||
if !isSidecarSetNamespaceDiff(c, sidecarSet, obj) && util.IsSelectorOverlapping(sidecarSet.Spec.Selector, obj.Spec.Selector) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isSidecarSetNamespaceDiff -> isSidecarSetNamespaceOverlapping?
Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>
425d018
to
330e364
Compare
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zmberg 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 |
Ⅰ. Describe what this PR does
sidecarSet support namespace selector
#948