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

CON-7851\Register Lb validation handler #586

Closed
wants to merge 50 commits into from

Conversation

elijahomolo
Copy link
Contributor

@elijahomolo elijahomolo commented Feb 9, 2023

https://jira.internal.digitalocean.com/browse/CON-7851

This PR addresses CON-7851 by adding a new validation handler to handle LB type requests. This PR only adds the functionality to parse the LB service type and pass Create and Update requests to the appropriate LBAAS DO API endpoints. A followup PR will add validation for individual configurations.

@elijahomolo
Copy link
Contributor Author

PR to fix CI: #585

Copy link
Collaborator

@timoreimann timoreimann left a comment

Choose a reason for hiding this comment

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

I'd appreciate if we could introduce a flag / environment variable at this point already that causes the webhook to not do anything (and log clearly about it) unless it is enabled specifically.

This is to guard against users eventually discovered our (unfinished) work and trying it out, possibly creating more tickets due to confusion.

cloud-controller-manager/do/doks_lb_validator.go Outdated Show resolved Hide resolved
cloud-controller-manager/do/doks_lb_validator.go Outdated Show resolved Hide resolved
cloud-controller-manager/do/doks_lb_validator_test.go Outdated Show resolved Hide resolved
tmp/webhook_manifests/manifest.yaml Outdated Show resolved Hide resolved
tmp/webhook_manifests/manifest.yaml Outdated Show resolved Hide resolved
tmp/webhook_manifests/manifest.yaml Outdated Show resolved Hide resolved
tmp/webhook_manifests/webhook-rolebinding.yaml Outdated Show resolved Hide resolved
cloud-controller-manager/do/doks_lb_validator.go Outdated Show resolved Hide resolved
cloud-controller-manager/do/doks_lb_validator.go Outdated Show resolved Hide resolved
cloud-controller-manager/do/doks_lb_validator.go Outdated Show resolved Hide resolved
go.mod Outdated
@@ -4,7 +4,8 @@ go 1.19

require (
github.com/davecgh/go-spew v1.1.1
github.com/digitalocean/godo v1.97.0
github.com/digitalocean/godo v1.97.1-0.20230308191258-ca2138d84446
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be 1.98. Change might've got lost in the rebase here. Pretty sure he had it at one point.

@elijahomolo elijahomolo force-pushed the lb-validation-handler branch 2 times, most recently from e2a673b to 17d2f0c Compare March 27, 2023 15:33
cloud-controller-manager/do/kubernetes_lb_validator.go Outdated Show resolved Hide resolved
cloud-controller-manager/do/kubernetes_lb_validator.go Outdated Show resolved Hide resolved
cloud-controller-manager/do/kubernetes_lb_validator.go Outdated Show resolved Hide resolved
}

err = v.decoder.DecodeRaw(req.OldObject, svc)
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The IP would only be available once an LB is fully provisioned, so I'm not sure we can use that.

Can you check if status.loadBalancer.ingress exists right after a managed LB is created? If it does even though the IP address is still missing, then we could use that as a trigger.

The other possibility is to check the LB ID annotation, though using something on the status should be a bit more reliable.

}

err = v.decoder.DecodeRaw(req.OldObject, svc)
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you answer this question of mine:

Is req.OldObject possibly nil when the Service is brand new?

cloud-controller-manager/do/kubernetes_lb_validator.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@timoreimann timoreimann left a comment

Choose a reason for hiding this comment

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

We should also have a very clear note/disclaimer about the state of the web hook, i.e., that it is purely experimental yet. I suggest we

  • add a README.md right next to the main.go file
  • add a loud and clear log message at the start of the webhook
  • add a comment header in the main.go file

@timoreimann
Copy link
Collaborator

@elijahomolo you seem to have merge commit markers in your go.mod file now. You need to remove them and run go mod tidy && go mod vendor afterwards to be safe.

@timoreimann
Copy link
Collaborator

Closing in favor of #676 and several follow-up PRs that were submitted/merged by now to continue and complete the validation web hook work.

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.

None yet

4 participants