Skip to content

connect components using watchable#197

Merged
arkodg merged 20 commits intoenvoyproxy:mainfrom
arkodg:connect-components
Aug 22, 2022
Merged

connect components using watchable#197
arkodg merged 20 commits intoenvoyproxy:mainfrom
arkodg:connect-components

Conversation

@arkodg
Copy link
Copy Markdown
Contributor

@arkodg arkodg commented Aug 9, 2022

Signed-off-by: Arko Dasgupta arko@tetrate.io

@arkodg arkodg requested a review from a team as a code owner August 9, 2022 01:10
@arkodg arkodg marked this pull request as draft August 9, 2022 01:10
@arkodg arkodg force-pushed the connect-components branch from 45987f3 to 376ae4a Compare August 10, 2022 00:34
Comment thread internal/cmd/server.go Outdated
Comment thread internal/cmd/server.go Outdated
Comment thread internal/cmd/server.go Outdated
Comment thread internal/cmd/server.go Outdated
Comment thread internal/cmd/server.go Outdated
Comment thread internal/gatewayapi/service/service.go Outdated
Comment thread internal/gatewayapi/service/service.go Outdated
Comment thread internal/infrastructure/service/service.go Outdated
Comment thread internal/infrastructure/service/service.go Outdated
Comment thread internal/provider/kubernetes/gateway.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of passing in logger logr.Logger, consider using a context and then calling logr.FromContext(ctx), xref.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I always prefer using function args to pass data around over context unless I absolutely need to ( and when the data is tied to a context rather than the package).
I can change the function signature and use a Config object instead to reduce the number of params passed to it

Comment thread internal/provider/kubernetes/gateway.go Outdated
Comment thread internal/provider/kubernetes/kubernetes.go Outdated
Comment thread internal/provider/kubernetes/httproute.go Outdated
Comment thread internal/provider/kubernetes/gatewayclass.go Outdated
Comment thread internal/provider/kubernetes/gateway.go Outdated
Comment on lines 44 to 50
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Each controller should have a unique name. This is typically used to tie logging messages back to a specific controller, xref.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this ties to gwapiv1b1.GatewayController(name) / class controller, not the same of the sw controller/reconciler

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The value of controller should continue to be exposed to users to support running multiple Envoy Gateways in a cluster.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not sure what you are referring to here

Copy link
Copy Markdown
Contributor

@danehans danehans left a comment

Choose a reason for hiding this comment

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

@arkodg this is a great start! Other than a few nits, test coverage, and passing CI, this LGTM.

Copy link
Copy Markdown
Contributor

@LukeShu LukeShu left a comment

Choose a reason for hiding this comment

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

Yeah, this is basically how I think watchable should be used. I left a suggestion to simplify the simple cases. If we think we'll have a lot of non-map uses, adding a watchable.Value would be good.

Comment thread tools/make/lint.mk Outdated
Comment thread internal/cmd/server.go Outdated
Comment thread internal/gatewayapi/service/service.go Outdated
Comment thread internal/gatewayapi/service/service.go Outdated
Comment thread internal/xds/server/service/service.go Outdated
Comment thread internal/message/types.go Outdated
Comment on lines 70 to 85
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we expect to track multiple sets of resources, and this is a short-term hack? Or is this a hack around not being able to have a single "watchable.Value" without wrapping it in a map?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

its the latter, wrapping it to return a single value embedded in a map (with a single key-value pair)

Comment thread internal/message/types.go Outdated
Copy link
Copy Markdown
Contributor

@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.

Took a really quick look over this and had one naming thing, sorry to be picky, but I think it could really bite us down the line if we don't fix it now.

I'll have more of a look at the rest later.

Comment thread internal/cmd/server.go Outdated
Arko Dasgupta added 6 commits August 17, 2022 19:16
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
@arkodg arkodg marked this pull request as draft August 18, 2022 18:40
Arko Dasgupta added 2 commits August 18, 2022 13:50
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
@arkodg arkodg marked this pull request as ready for review August 18, 2022 21:20
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Arko Dasgupta added 2 commits August 18, 2022 19:58
from envoyproxy#189

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
@arkodg
Copy link
Copy Markdown
Contributor Author

arkodg commented Aug 19, 2022

this PR is ready to be reviewed now. I'd prefer not to increase the size of this PR anymore and address other issues in a follow up PR

Two issue I'd like to highlight

  • the provider fails while starting with this error
no matches for kind "HTTPRoute" in version "[gateway.networking.k8s.io/v1beta1](http://gateway.networking.k8s.io/v1beta1)"

from here
this issue is not tied to this PR but is likely introduced by
#194 and is present on main too. I have commented the snippet causing the issue and this can be resolved in a follow up PR after reopening #189
cc @chauhanshubham

  • looks like there is always a watchable subscription notification during init
    I've circumvented it by skipping those messages
if msg == nil {
  continue
}

but im wondering if this is by design @LukeShu ?

Arko Dasgupta added 3 commits August 18, 2022 20:14
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
@arkodg
Copy link
Copy Markdown
Contributor Author

arkodg commented Aug 19, 2022

looks like the 1st error highlighted in #197 (comment) is not an issue, reverted the code, and installed the right version of GAPI CRDs(0.5.0) which installed the v1beta1 version for HTTPRoute which is used internally in the code, thank you @chauhanshubham for pointing this out 🙇

Copy link
Copy Markdown
Contributor

@danehans danehans left a comment

Choose a reason for hiding this comment

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

Please review my feedback. I'm not opposed to approving the PR with the suggested changes or filing issues to track the suggested changes.

Comment thread internal/cmd/server.go Outdated
Comment on lines +78 to +79
// setupServices starts all the services required for the Envoy Gateway to
// fulfill its tasks.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The func name states it starts all the services but it's starting runners. I'm not going to block the PR on this but I prefer we use service instead of runner, e.g. providerService. I find it easier to build a mental model around service.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I reverted all the code based on @youngnick's suggestion, I'll rename this function to setupRunners make this more logical. This name is not final and would prefer if we can revisit this in the near future.

Comment thread internal/gatewayapi/runner/runner.go Outdated
Comment thread internal/gatewayapi/runner/runner.go
kind: Deployment
metadata:
name: envoy-gateway
namespace: system
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment on lines -30 to -34
- name: envoy-gateway
args:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are these changes required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

these args were being appended to the envoy-gateway container, which I dont think is the intent

metadata:
name: envoy-gateway
namespace: system
namespace: envoy-gateway-system
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

uncommenting the above line changes the name of the envoy-gateway pod to envoy-gateway-envoy-gateway, do we want that ?

# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: envoy-gateway-
# namePrefix: envoy-gateway-
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See my other comments in reference to changing this. Not sure why this change is needed.

Comment thread internal/provider/kubernetes/config/envoy-gateway/kustomization.yaml Outdated
Comment thread tools/make/kube.mk Outdated
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
@arkodg arkodg requested a review from danehans August 19, 2022 22:32
@LukeShu
Copy link
Copy Markdown
Contributor

LukeShu commented Aug 22, 2022

Wait, is there no CI checking that make generate is up-to-date?

@arkodg
Copy link
Copy Markdown
Contributor Author

arkodg commented Aug 22, 2022

Wait, is there no CI checking that make generate is up-to-date?

not yet, raised #213 to track it

@arkodg arkodg dismissed danehans’s stale review August 22, 2022 19:14

plan on fixing additional issues in follow up PRs

@arkodg arkodg merged commit 603e2a3 into envoyproxy:main Aug 22, 2022
@arkodg arkodg deleted the connect-components branch August 22, 2022 19:15
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.

5 participants