-
Notifications
You must be signed in to change notification settings - Fork 2
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
Proposed #3
base: reviewed
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR 🚀
I finished my first review round and found a couple of things.
Other than that, the license headers are missing in all *.go
files.
It might also make sense to create a linter Make
target right from the beginning. You could reuse the check and format make targets. The corresponding tools are installed via tools.mk.
Another thing which came to my mind. In gardener/gardener
we just removed the vendor
folder (ref) and we plan to continue in extensions too. As this is a new component, it would be sense to not create it in the first place.
// WebhookCertDir is the directory that contains the webhook server key and certificate. | ||
WebhookCertDir string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Covered by the previous answer.
// GetClientSet returns a [kubernetes.Clientset] from the given kubeconfig path. | ||
// If kubeconfigPath is nil, the function assumes that the process is running in a K8s pod, and attempts to create | ||
// client set based on the convention for in-cluster configuration. | ||
func GetClientSet(kubeconfigPath string) (*kclient.Clientset, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need such a function? When using controller-runtime the manager
creates a client/clientset based on a rest.Config
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is only used to validate the connection settings. A clientset is created, just to see if there would be errors, and then discarded. I saw that approach in another Gardener project. I don't know if it is really necessary - my guess was that it was added to compensate for some case where the manager-issued error message was too unclear.
"sigs.k8s.io/controller-runtime/pkg/webhook" | ||
) | ||
|
||
type FakeManager struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We typically don't have a FakeManager
in Gardener.
For unit tests normal fake clients should be enough. For integration tests we use sigs.k8s.io/controller-runtime/pkg/envtest
where the real manager could be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does one achieve isolation during unit tests, for e.g. a function which uses a manager to run a controller? In case I want to verify that the function will make an attempt to run the controller, but I don't want the controller actually executed.
I'd like to leave that for last, so I do all of them in one go and don't risk some file slipping through the cracks. Do we have an automatic check to save me, in case I forget adding a copyright header?
Done. I have a Regarding removing the vendor folder: |
Initial implementation of the HA service, which is responsible for ensuring HA operation by injecting a service endpoint directing traffic to the active replica. This initial PR also adds most of the component's central infrastructure.