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

Proposed #3

Open
wants to merge 2 commits into
base: reviewed
Choose a base branch
from
Open

Proposed #3

wants to merge 2 commits into from

Conversation

andrerun
Copy link
Contributor

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.

@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 14, 2023
@gardener-robot gardener-robot added needs/review Needs review size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py) needs/second-opinion Needs second review by someone else labels Nov 14, 2023
@andrerun andrerun marked this pull request as ready for review November 14, 2023 07:46
Copy link

@oliver-goetz oliver-goetz left a 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 vendorfolder (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.

.gitignore Show resolved Hide resolved
.gitignore Show resolved Hide resolved
CODEOWNERS Show resolved Hide resolved
go.mod Show resolved Hide resolved
go.mod Show resolved Hide resolved
Comment on lines +72 to +73
// WebhookCertDir is the directory that contains the webhook server key and certificate.
WebhookCertDir string

Choose a reason for hiding this comment

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

Same here.

Copy link
Contributor Author

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.

pkg/ha/ha_service_test.go Show resolved Hide resolved
pkg/util/gardener/util.go Show resolved Hide resolved
Comment on lines +14 to +17
// 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) {

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.

Copy link
Contributor Author

@andrerun andrerun Jan 4, 2024

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 {

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.

Copy link
Contributor Author

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.

@andrerun
Copy link
Contributor Author

andrerun commented Jan 3, 2024

Other than that, the license headers are missing in all *.go files.

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?

It might also make sense to create a linter Make target right from the beginning.

Done. I have a check target, but the makefile is not in this PR (unless I'm overlooking something - I didn't see a makefile in the PR).

Regarding removing the vendor folder:
Sure, but let's leave this for last, as it bears no risks. I'd like to minimise the changes I do in parallel, because it's the first time I use some of this tech and there are too many things I need to keep in mind. I'll get back to you on this, as I'd like to ask about pros and cons. I already ran into cons of vendoring, big time, as one of the critical libraries I use is source incompatible with g/g.

@gardener-robot gardener-robot added the lifecycle/stale Nobody worked on this for 6 months (will further age) label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Nobody worked on this for 6 months (will further age) needs/review Needs review needs/second-opinion Needs second review by someone else reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants