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

add namespace-lister deployment to staging #5163

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sadlerap
Copy link
Contributor

This is largely for testing purposes, to see if this deployment configuration is functional. As such, we're only going to deploy this to one of the member clusters for the time being, and we're not going to integrate this with the UI's nginx config until we have a stable deployment.

Copy link

openshift-ci bot commented Dec 16, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sadlerap
Once this PR has been reviewed and has the lgtm label, please assign dirgim for approval. For more information see the 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

@sadlerap sadlerap marked this pull request as draft December 16, 2024 23:36
@sadlerap
Copy link
Contributor Author

sadlerap commented Dec 16, 2024

I think it may not be a bad idea to hold merging this until after the holidays, since I'd rather avoid situations where we accidentally cause an outage while many people are out on vacation.

This is largely for testing purposes, to see if this deployment
configuration is functional.  As such, we're only going to deploy this
to one of the member clusters for the time being, and we're not going to
integrate this with the UI's nginx config until we have a stable
deployment.

Signed-off-by: Andy Sadler <[email protected]>
Copy link
Member

@gbenhaim gbenhaim left a comment

Choose a reason for hiding this comment

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

I suggest that it would be included as a side car in the proxy deployment https://github.com/redhat-appstudio/infra-deployments/tree/main/components/konflux-ui/production/base/proxy it would be much simpler (you can see how it was done for workspace-manager). I don't see a benefit of having it in its own deployment. In addition, since we used impersonation today, token review can't be turned on in namespace-lister, so it means anyone would be able to list namespaces.

Copy link
Member

@gbenhaim gbenhaim left a comment

Choose a reason for hiding this comment

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

please see my comment above.
In addition namespace-lister should be incorporated in Konflux upstream as well - https://github.com/konflux-ci/konflux-ci/tree/main/konflux-ci/ui/core/proxy

@sadlerap
Copy link
Contributor Author

sadlerap commented Jan 9, 2025

I'll start with adding it into the staging deployment of the proxy, then move on to production and upstream if things look stable.

@filariow
Copy link
Member

filariow commented Jan 9, 2025

@gbenhaim I'm mostly fine with any setup we chose, but I'd prefer to have separate deployments for the following reasons.

I suggest that it would be included as a side car in the proxy deployment https://github.com/redhat-appstudio/infra-deployments/tree/main/components/konflux-ui/production/base/proxy it would be much simpler (you can see how it was done for workspace-manager). I don't see a benefit of having it in its own deployment.

If we chose separate deployments we'll have better isolation and scaling.

Isolation: A bug on namespace-lister won't affect the proxy, but just the GET namespace endpoint. If the namespace-lister starts crashing and it is in the same pod of the proxy, the whole pod will crash and -from a user perspective- nothing will work. If we have separate deployments, only the GET namespace endpoint won't work.

Scaling: we can scale the proxy and the namespace-lister independently.

In addition, since we used impersonation today, token review can't be turned on in namespace-lister, so it means anyone would be able to list namespaces.

I'm not sure I got it correctly, but if it is a concern on external users (1) or other deployments (2) invoking the namespace-lister, we could avoid exposing the namespace-lister outside (1) and use a NetworkPolicy to only grant requests from the proxy deployed in the same namespace (1,2); right?

@sadlerap
Copy link
Contributor Author

sadlerap commented Jan 9, 2025

I think I'll leave it as a separate deployment for now.

To me, the biggest reason to do so is a separation of concerns: in particular, we don't need nearly as many permissions on the namespace-lister deployment. The list of permissions that the proxy's service account would grant is far beyond what namespace-lister needs. Why should we grant namespace-lister the extra permissions that the proxy's service account would grant?

Also, I'm not certain it should be moved under the konflux-ui component. Unless that component is also going to be deployed on the internal clusters, we'd be duplicating the resources between the konflux-ui and some other components, which doesn't make sense to me. It seems better to me to unify this underneath a single component.

@gbenhaim thoughts?

Copy link
Member

@filariow filariow left a comment

Choose a reason for hiding this comment

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

some ideas

Comment on lines +20 to +33
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: namespace-lister-auth-delegator
subjects:
- apiGroup: ""
kind: ServiceAccount
name: namespace-lister
namespace: namespace-lister
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:auth-delegator
Copy link
Member

Choose a reason for hiding this comment

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

in the near future we won't rely on the TokenReview API. I'd suggest to move this ClusterRoleBinding to separate file under staging/stone-stg-rh01

Copy link
Member

Choose a reason for hiding this comment

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

If I'm getting it correctly, this is exposing the namespace-lister directly and not the proxy.

If we decide not to deploy the Proxy, this can be removed too

Copy link
Member

Choose a reason for hiding this comment

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

We may simplify by not deploying a Proxy at all and by using port-forward to test namespace-lister is working properly.

@gbenhaim
Copy link
Member

I think I'll leave it as a separate deployment for now.

To me, the biggest reason to do so is a separation of concerns: in particular, we don't need nearly as many permissions on the namespace-lister deployment. The list of permissions that the proxy's service account would grant is far beyond what namespace-lister needs. Why should we grant namespace-lister the extra permissions that the proxy's service account would grant?

ok, you convinced me with this argument.

Also, I'm not certain it should be moved under the konflux-ui component. Unless that component is also going to be deployed on the internal clusters, we'd be duplicating the resources between the konflux-ui and some other components, which doesn't make sense to me. It seems better to me to unify this underneath a single component.

The konflux-ui component is going to be deployed on all clusters (external and internal).

@gbenhaim thoughts?

You would still need to do the following changes:

  1. Remove the Route, namespace lister shouldn't bu publicly exposed.
  2. Remove the nginx deployment, instead edit the nginx config in the konflux-ui component to route traffic to namespace-lister.
  3. Create a network policy that allows only the proxy deployment from the konflux-ui namespace to access namespace-lister (since it doesn't use any authentication).

labels:
apps: namespace-lister
spec:
# securityContext:
Copy link
Member

Choose a reason for hiding this comment

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

can you please remove the comments?

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.

4 participants