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

Compliance multi-tenant changes #3111

Merged
merged 6 commits into from
Jan 22, 2024

Conversation

Josh-Tigera
Copy link
Contributor

Description

For PR author

  • Tests for change.
    - [ ] If changing pkg/apis/, run make gen-files
    - [ ] If changing versions, run make gen-versions

For PR reviewers

A note for code reviewers - all pull requests must have the following:

  • Milestone set according to targeted release.
  • Appropriate labels:
    • kind/bug if this is a bugfix.
    • kind/enhancement if this is a a new feature.
    • enterprise if this PR applies to Calico Enterprise only.

Copy link
Member

@caseydavenport caseydavenport left a comment

Choose a reason for hiding this comment

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

Looking good! A few relatively minor comments. Main one is re: how network policy is structured.

Copy link
Member

@caseydavenport caseydavenport left a comment

Choose a reason for hiding this comment

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

A few more small things. Looks like you have a couple of unused TenantNamespaces fields left over from earlier commits as well.

@marvin-tigera
Copy link
Contributor

Removing "merge-when-ready" label due to new commits

@marvin-tigera
Copy link
Contributor

Removing "merge-when-ready" label due to new commits


// Watch for changes to primary resource Compliance
err = c.Watch(&source.Kind{Type: &operatorv1.Compliance{}}, &handler.EnqueueRequestForObject{})
err = complianceController.Watch(&source.Kind{Type: &operatorv1.Compliance{}}, &handler.EnqueueRequestForObject{})
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs to be eventHandler

@@ -431,25 +431,25 @@ func guardianAllowTigeraPolicy(cfg *GuardianConfiguration) (*v3.NetworkPolicy, e
{
Action: v3.Allow,
Protocol: &networkpolicy.TCPProtocol,
Source: ComplianceBenchmarkerSourceEntityRule,
Source: networkpolicy.CreateSourceEntityRule(ComplianceNamespace, ComplianceBenchmarkerName),
Copy link
Member

@caseydavenport caseydavenport Jan 22, 2024

Choose a reason for hiding this comment

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

I think for all of these single-tenant rules, you just want to use the DefaultHelper - https://github.com/Josh-Tigera/operator/blob/691931ed32299b33efcbd98c8c69d8b49f1ba760/pkg/render/common/networkpolicy/networkpolicy.go#L205

This way we still follow the same code path for single / multi-tenant code.

Copy link
Member

@caseydavenport caseydavenport left a comment

Choose a reason for hiding this comment

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

Two minor comments but otherwise LGTM

@marvin-tigera marvin-tigera merged commit c68c5cc into tigera:master Jan 22, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants