Skip to content

[usage] Add network policy to allow ingress from server #11236

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

Merged

Conversation

andrew-farries
Copy link
Contributor

@andrew-farries andrew-farries commented Jul 8, 2022

Description

Add a network policy for the usage component so that it accepts incoming gRPC connections from server (and no other components).

Related Issue(s)

Part of #9036

How to test

  1. Open a preview environment and install the kubecontext for this branch:
previewctl install-context
  1. Run an ubuntu pod in the default namespace.
kubectl run ubuntu -it --image ubuntu -- /bin/sh
  1. Install a grpc client like evans or grpcurl into the container.

  2. Try to connect from the ubuntu pod to the usage service:

./evans --host usage -p 9001 -r repl

See that it fails.

  1. Label the ubuntu pod:
kubectl label pod ubuntu component=server
  1. Try the same evans command from inside the ubuntu container.

This time the connection succeeds because the pod is labelled correctly for the network policy to allow ingress.

Release Notes

NONE

Werft options:

  • /werft with-preview

@andrew-farries andrew-farries requested a review from a team July 8, 2022 13:04
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Jul 8, 2022
@roboquat roboquat added the size/M label Jul 8, 2022
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-af-access-usage-api-from-server.4 because the annotations in the pull request description changed
(with .werft/ from main)

@andrew-farries
Copy link
Contributor Author

/hold

@geropl
Copy link
Member

geropl commented Jul 8, 2022

/werft run

👍 started the job as gitpod-build-af-access-usage-api-from-server.5
(with .werft/ from main)

Random werft error

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

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

Code LGTM, tested and works.

/unhold

@roboquat roboquat merged commit ca861c2 into af/initial-usage-api-impl Jul 8, 2022
@roboquat roboquat deleted the af/access-usage-api-from-server branch July 8, 2022 14:14
@easyCZ
Copy link
Member

easyCZ commented Jul 8, 2022

@geropl You landed this into the parent PR. Sometimes, it's easier to wait for the parent to land and land this directly on top - requires less reviews

@geropl
Copy link
Member

geropl commented Jul 8, 2022

Oh. I feel we should make this explicit, then. Either in the description, or better by adding an (explicit) label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none size/M team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants