Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Adds Initial Gateway Support #207

Merged

Conversation

danehans
Copy link
Contributor

@danehans danehans commented Feb 17, 2021

Adds initial Gateway support per operator design spec.

Requires: #204
Requires: #198

Fixes: #106
Fixes: projectcontour/contour#3319

@danehans danehans requested a review from a team as a code owner February 17, 2021 18:48
@danehans danehans requested review from stevesloka and sunjayBhatia and removed request for a team February 17, 2021 18:48
@danehans danehans added this to the 1.13.0 milestone Feb 17, 2021
@stevesloka
Copy link
Member

needs rebase @danehans

@danehans danehans force-pushed the pkg_refactor_with_svc_apis_gateway_impl branch 2 times, most recently from 1550db9 to 043a831 Compare February 23, 2021 06:23
@danehans danehans changed the title Adds Gateway Support Adds Initial Gateway Support Feb 23, 2021
@danehans danehans force-pushed the pkg_refactor_with_svc_apis_gateway_impl branch 2 times, most recently from 1d77a64 to 3c83bb0 Compare February 23, 2021 06:46
Copy link
Member

@stevesloka stevesloka left a comment

Choose a reason for hiding this comment

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

Going to work on some manual tests but overall looks good! =)


// OwningGatewayNameLabel is the owner reference label used for a Gateway
// managed by the operator. The value should be the name of the Gateway.
OwningGatewayNameLabel = "contour.operator.projectcontour.io/owning-gateway-name"
Copy link
Member

Choose a reason for hiding this comment

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

nit: Do we need contour in front of the name? Also ending it with owning-gateway-name feels out of place.

Maybe make the owner label: projectcontour.io/operator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to provide consistency with the contour owning ns/name labels. Child resources of the Gateway, i.e. Envoy daemonset, would look like:

kind: DaemonSet
metadata:
  name: envoy
  namespace: foo-gateway-ns
  labels:
    contour.operator.projectcontour.io/owning-gateway-name: foo-gateway
    contour.operator.projectcontour.io/owning-gateway-namespace: foo-gateway-ns

We could drop contour.operator.projectcontour.io/owning-gateway-namespace since the child resources of a gateway will always be in the same ns as the gateway. I can see loosing the contour prefix, but the Contour owning labels should be updated too for consistency. I'd prefer doing that in a follow-up PR. xref: #216


// OwningGatewayNsLabel is the owner reference label used for a Gateway
// managed by the operator. The value should be the namespace of the Gateway.
OwningGatewayNsLabel = "contour.operator.projectcontour.io/owning-gateway-namespace"
Copy link
Member

Choose a reason for hiding this comment

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

Same here in previous comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same response as #207 (comment).

internal/objects/gateway/finalizer.go Outdated Show resolved Hide resolved
@danehans danehans force-pushed the pkg_refactor_with_svc_apis_gateway_impl branch from 3c83bb0 to 846b9fb Compare February 23, 2021 16:22
@danehans
Copy link
Contributor Author

Going to work on some manual tests but overall looks good! =)

@stevesloka note that this PR now includes a gateway e2e test.

@danehans danehans force-pushed the pkg_refactor_with_svc_apis_gateway_impl branch from 846b9fb to 09e4b8d Compare February 23, 2021 17:01
@danehans
Copy link
Contributor Author

@stevesloka commit 09e4b8d resolves #207 (comment).

@danehans danehans requested a review from stevesloka February 23, 2021 17:02
Signed-off-by: Daneyon Hansen <[email protected]>
@danehans danehans force-pushed the pkg_refactor_with_svc_apis_gateway_impl branch from 09e4b8d to 31f5fbf Compare February 23, 2021 17:45
Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

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

Looks OK to me.

One thing I'd want to confirm - does the Operator work fine if installed in a cluster that doesn't have Gateway API?

@danehans
Copy link
Contributor Author

One thing I'd want to confirm - does the Operator work fine if installed in a cluster that doesn't have Gateway API?

@skriss the Gateway CRDs need to be installed in the cluster before running the operator. Fortunately, they are installed as part of the operator deployment manifest.

@stevesloka
Copy link
Member

Fortunately, they are installed as part of the operator deployment manifest.

That's a good point @skriss. I can make a future issue, but we shouldn't require folks to install those CRDs to use the operator.

@danehans
Copy link
Contributor Author

@skriss @stevesloka does Contour read a CLI flag, i.e. --enable-gateway-api=true, to conditionally add controllers to the manager?

@stevesloka
Copy link
Member

Contour checks if the APIs exist in the cluster and if they do then they are enabled for use.

Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

LGTM.

I have a small, non-blocking question though: What happens if a Route is used by multiple Gateways? Right now the ownership labels will just be stomped. I don't know if this will come up often, but it feels like something that we should cover, since I don't think the API says that you can't do that.

@danehans
Copy link
Contributor Author

What happens if a Route is used by multiple Gateways? Right now the ownership labels will just be stomped.

@youngnick the operator is not applying ownership labels to xRoute resources since it does not manage them. I expect every projectcontour/contour controller that admits a route, to adds its gateway ns/name to the route's status.

@danehans danehans merged commit e581ab6 into projectcontour:main Feb 23, 2021
@danehans danehans deleted the pkg_refactor_with_svc_apis_gateway_impl branch February 23, 2021 23:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug/Documentation] - bug in contour operator quickstart Add Gateway API Support
4 participants