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

OCPBUGS-42579: Add network policies for konnectivity server and ignition server proxy #4840

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

davidvossel
Copy link
Contributor

This fixes two issues that impact HCP with the NodePort publishing strategy.

  1. The konnectivity server component has moved in and out of the kas pod throughout several releases. The result is, some releases have network policies that allow connections to the konnectivity server, and others do not. To account for this, the hypershift operator needs to support both when the konnectivity server is in the kas pod and when it is outside of the pod.

This is resolved by adding a new network policy that allows access to the konnectivity server when it is hosted within the kas pod (which is how this is currently deployed in 4.17)

  1. Nodes currently can't access the ignition proxy to retrieve their configs. This is resolved by adding a network policy for the ignition proxy.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Oct 2, 2024
@openshift-ci-robot
Copy link

@davidvossel: This pull request references Jira Issue OCPBUGS-42579, which is invalid:

  • expected the bug to target the "4.18.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

This fixes two issues that impact HCP with the NodePort publishing strategy.

  1. The konnectivity server component has moved in and out of the kas pod throughout several releases. The result is, some releases have network policies that allow connections to the konnectivity server, and others do not. To account for this, the hypershift operator needs to support both when the konnectivity server is in the kas pod and when it is outside of the pod.

This is resolved by adding a new network policy that allows access to the konnectivity server when it is hosted within the kas pod (which is how this is currently deployed in 4.17)

  1. Nodes currently can't access the ignition proxy to retrieve their configs. This is resolved by adding a network policy for the ignition proxy.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release label Oct 2, 2024
Copy link
Contributor

openshift-ci bot commented Oct 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: davidvossel

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

@openshift-ci openshift-ci bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/needs-area labels Oct 2, 2024
@davidvossel
Copy link
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Oct 2, 2024
@openshift-ci-robot
Copy link

@davidvossel: This pull request references Jira Issue OCPBUGS-42579, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.18.0) matches configured target version for branch (4.18.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

No GitHub users were found matching the public email listed for the QA contact in Jira ([email protected]), skipping review request.

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Oct 2, 2024
Copy link
Contributor

@jparrill jparrill left a comment

Choose a reason for hiding this comment

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

Hey David, thanks for the PR. It's there any chance to add a unitTest around the netpol reconciliation to identify the policy is placed properly when is in or out of the KAS?

@@ -151,6 +151,13 @@ func (r *HostedClusterReconciler) reconcileNetworkPolicies(ctx context.Context,
}); err != nil {
return fmt.Errorf("failed to reconcile ignition nodeport network policy: %w", err)
}
// Reconcile nodeport-ignition-procy Network Policy
Copy link
Contributor

@jparrill jparrill Oct 2, 2024

Choose a reason for hiding this comment

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

nit: s/nodeport-ignition-procy/nodeport-ignition-proxy/


// Reconcile nodeport-konnectivity Network Policy when konnectivity is hosted in the kas pod
policy = networkpolicy.NodePortKonnectivityKASNetworkPolicy(controlPlaneNamespaceName)
if _, err := createOrUpdate(ctx, r.Client, policy, func() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will create the policy always, we need to identify where is konnectivity and then place the netpol accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need to identify where is konnectivity and then place the netpol accordingly.

how? the hypershift operator isn't responsible for laying down the konnectivity agent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah you're right. I had an eye in the security people that maybe they will concern to have that gate opened.

Copy link
Contributor Author

@davidvossel davidvossel left a comment

Choose a reason for hiding this comment

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

It's there any chance to add a unitTest around the netpol reconciliation to identify the policy is placed properly when is in or out of the KAS?

i don't believe the hypershift operator has knowledge of where the konnectivity server is placed.


// Reconcile nodeport-konnectivity Network Policy when konnectivity is hosted in the kas pod
policy = networkpolicy.NodePortKonnectivityKASNetworkPolicy(controlPlaneNamespaceName)
if _, err := createOrUpdate(ctx, r.Client, policy, func() error {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need to identify where is konnectivity and then place the netpol accordingly.

how? the hypershift operator isn't responsible for laying down the konnectivity agent.

Copy link
Contributor

@jparrill jparrill left a comment

Choose a reason for hiding this comment

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

Looks good so far. This also will cover this other bug OCPBUGS-39317. I will mark it as dup and remark it will be solved with this PR.


// Reconcile nodeport-konnectivity Network Policy when konnectivity is hosted in the kas pod
policy = networkpolicy.NodePortKonnectivityKASNetworkPolicy(controlPlaneNamespaceName)
if _, err := createOrUpdate(ctx, r.Client, policy, func() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah you're right. I had an eye in the security people that maybe they will concern to have that gate opened.

@jparrill
Copy link
Contributor

jparrill commented Oct 7, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 7, 2024
Copy link
Contributor

openshift-ci bot commented Oct 7, 2024

@davidvossel: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 605ee5a into openshift:main Oct 7, 2024
15 checks passed
@openshift-ci-robot
Copy link

@davidvossel: Jira Issue OCPBUGS-42579: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-42579 has been moved to the MODIFIED state.

In response to this:

This fixes two issues that impact HCP with the NodePort publishing strategy.

  1. The konnectivity server component has moved in and out of the kas pod throughout several releases. The result is, some releases have network policies that allow connections to the konnectivity server, and others do not. To account for this, the hypershift operator needs to support both when the konnectivity server is in the kas pod and when it is outside of the pod.

This is resolved by adding a new network policy that allows access to the konnectivity server when it is hosted within the kas pod (which is how this is currently deployed in 4.17)

  1. Nodes currently can't access the ignition proxy to retrieve their configs. This is resolved by adding a network policy for the ignition proxy.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-bot
Copy link

[ART PR BUILD NOTIFIER]

Distgit: hypershift
This PR has been included in build ose-hypershift-container-v4.18.0-202410071842.p0.g605ee5a.assembly.stream.el9.
All builds following this will include this PR.

@davidvossel
Copy link
Contributor Author

/cherry-pick release-4.17 release-4.16 release-4.15 release-4.14

@openshift-cherrypick-robot

@davidvossel: new pull request created: #4865

In response to this:

/cherry-pick release-4.17 release-4.16 release-4.15 release-4.14

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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. area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants