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

adding new way to apply firewall #55

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

aabughosh
Copy link
Collaborator

No description provided.

@aabughosh aabughosh added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 9, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 9, 2024
Copy link

openshift-ci bot commented Oct 9, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aabughosh
Once this PR has been reviewed and has the lgtm label, please assign schseba for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 9, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 9, 2024
@aabughosh aabughosh added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 14, 2024
@aabughosh aabughosh removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 3, 2024
@@ -238,3 +240,13 @@ func (u *utils) IsBMInfra() (bool, error) {

return infra.Status.PlatformStatus.Type == configv1.BareMetalPlatformType, nil
}

func (u *utils) GetClusterVersion() (string, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is only used in the test, not sure if you miss a use of this func in main or you can use this function that's already in the test files

versionMajorMinor, err := utilsHelpers.GetClusterVersion()
Expect(err).ToNot(HaveOccurred())

if firewall.IsVersionGreaterThan(versionMajorMinor, "4.16") { // if version more than 4.16 need to change cluster MachineConfiguration.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The communication matrix is only supported since 4.16

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yah yah
The meaning is from 4.17+
And for 4.16 we are not doing that

test/e2e/nftables_test.go Outdated Show resolved Hide resolved
test/e2e/nftables_test.go Outdated Show resolved Hide resolved
test/e2e/nftables_test.go Outdated Show resolved Hide resolved
test/pkg/firewall/firewall.go Outdated Show resolved Hide resolved
test/pkg/firewall/firewall.go Outdated Show resolved Hide resolved
test/pkg/firewall/firewall.go Outdated Show resolved Hide resolved
test/pkg/firewall/firewall.go Outdated Show resolved Hide resolved
test/pkg/firewall/firewall.go Outdated Show resolved Hide resolved
if len(output) == 0 {
return nil, fmt.Errorf("no nft rules on node %s: ", debugPod.Spec.NodeName)
}
func UpdateMachineConfiguration(c *client.ClientSet) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this func belongs to firewall package

Copy link
Collaborator

Choose a reason for hiding this comment

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

From my understanding this is not updating a MC, it's creating a new one.
Can you just use a MC object and apply it with the client?
You already added the scheme here https://github.com/openshift-kni/commatrix/pull/55/files#diff-2895f30116602d8fe6b0545c186d4f81247fa4eaab049dab174c6c91c0036e08R49 no need to create an additional client
Also maybe use a more meaningful name for the MC than "cluster"

allReady := true

for _, mcp := range mcpList.Items {
fmt.Printf("MCP: %s\n", mcp.Name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are checked next I don't think there is an extra value in printing them

test/pkg/firewall/firewall.go Outdated Show resolved Hide resolved
test/pkg/firewall/firewall.go Outdated Show resolved Hide resolved
pkg/client/client.go Outdated Show resolved Hide resolved
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants