You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, you could address the findings from Oliver's review against the main branch by creating a PR that addresses his comments.
Mid
Switch to prow for head-update and pull-requests jobs. For new repos we already use prow as it gives many possibilities such as having e2e test, defining checks in much better format than CI/CD black magics, etc.
No developer docs/instructions how to run it locally (aka local setup docs).
Switch to project to push to AR. GCR is being replaced by AR and C. Cwienk was adapting all repos to publish to AR. Looks like he missed this repo: Move from GCR to artifact registry #10
We drop vendoring from the repos. Nowadays, gardener/gardener and most of the extension repos don't have a vendor dir. As a new Project you could drop vendor dir as well: Drop vendoring #13
rm LICENSE.md. The licenses are already defined under LICENSES/ and there is the symlink LICENSE in the root of the repo: Switch to use REUSE license format #12
go.mod: We usually use only 2 require blocks. One for the direct dependencies, and the other one managed by the goo tool for the indirect/transitive ones. You could merge the first and the second require blocks.: Apply review comments. Add debug support #7
[andrerun-new]: See the log entry below. It's a bit ugly - a project outsider may have a hard time figuring out what's going on. @ialidzhikov, a pod gets stuck without an IP address every now and then, right? It's not an extremely rare event? If so, I think I should add special handling for this case and log a nicer message. [under-discussion]
ERROR gardener-custom-metrics.input.scraper Kapi metrics retrieval failed {"op": "scrape", "namespace": "shoot--local--local", "pod": "kube-apiserver-5588c58789-crm72", "error": "metrics client: making http request: Get \"https:///metrics\": http: no Host in request URL"}
[andrerun-new]: The design reason is I want to keep the decision 'where to scrape', outside of the scraper. There's also a minor runtime concern - I prefer less object creation/GC churn.
3: Storing the same Pod labels would be a lot waste of memory. I see that you need the Pod labels to allow selecting metrics by object labelSelector. Maybe the whole model has to be adapted. We can for example accept that Pod labels are immutable and store them only once and not for every new metric value. [under-discussion]
[andrerun]: The main benefit I see in the second replica is that it ties compute resources in another AZ, so it guards against AZ resource shortage disrupting failover. Overall, I have my reservations regarding the need for a second replica, considering the intended use of the component, but that was a hard requirement introduced by the GEP review process. I'll elaborate offline. [under-discussion]
I didn't manage to test the component in local setup at all (due to missing docs/instructions) but I wanted to ask how it behaves on restarts and whether the HPA acting on the custom metric is fine with it. I assume on Pod restart the leader will change and the newly elected replica won't report any metrics (or will report 0-ed metrics value). Is HPA able to deal with unavailability of the gardener-custom-metrics component?
Final notes. I didn't deep dive into non-trivial packages like ./pkg/input/metrics_scraper.
The text was updated successfully, but these errors were encountered:
First, you could address the findings from Oliver's review against the main branch by creating a PR that addresses his comments.
Mid
sigs.k8s.io/custom-metrics-apiserver
dependency (v1.28.0
) https://github.com/gardener/gardener-custom-metrics/blob/392b48aab8e985dfbbea4a9cffdf753fcc315cb3/go.mod#L21 This should also transitively update the K8s dependencies to the latest versions. I recall the you mentioned that you have problems with the dependencies: Upgradek8s.io/*
tov0.28
,sigs.k8s.io/controller-runtime
tov0.16
#14k8s.io/*
tov0.28
,sigs.k8s.io/controller-runtime
tov0.16
#14testIsolation
approach to fake/mockTimeNow
. Usek8s.io/utils/clock/.RealClock
/k8s.io/utils/clock/testing.FakeClock
instead. Example: https://github.com/gardener/gardener/blob/dff43d99d2128c99f6d09116145ee48aebfd97f4/pkg/controllermanager/controller/event/reconciler.go#L38. Usages that need adaptation:shoot-<project-name>-<shoot-name>
. See https://github.com/gardener/gardener/blob/76704c377f34cdbdf1b0d3986b243c8b67c66909/pkg/component/kubeapiserverexposure/kube_apiserver_service.go#L237-L239 and https://github.com/gardener/gardener/blob/76704c377f34cdbdf1b0d3986b243c8b67c66909/pkg/utils/gardener/shoot.go#L696-L708. You should rather adapt the check to be "has prefixshoot-
": Apply review comments. Add debug support #7example/custom-metrics-deployment.yaml
Minor
.docforge
dir and switch to the central manifest. After Use central and new manifest format gardener/documentation#431, the repos do no longer needs to define a.docforge
dir and the manifests are maintained centrally. See the linked issue for more details. Additionally, as a consequence https://github.com/gardener/gardener-custom-metrics/blob/392b48aab8e985dfbbea4a9cffdf753fcc315cb3/Makefile#L104-L106 has to be dropped. Drop also themake check-docforge
target. It should be no longer needed.: Fixmake verify
#11make check
is reporting golangci-lint findings. You could fix them.: Fixmake verify
#11make format
is failing that there is notest/
dir.: Fixmake verify
#11make generate
is not implemented (https://github.com/gardener/gardener-custom-metrics/blob/392b48aab8e985dfbbea4a9cffdf753fcc315cb3/Makefile#L112-L116): Does the project need code generation at all? If not, let's remove it.make verify
#11pkg/version
pkg - we usually don't define such pkg in other repos and rather reuse thek8s.io/component-base/version/verflag
pkg. You should be already familiar with it as in Add support for a --version command line flag gardener/gardener-extension-runtime-gvisor#38 you used this pkg and eliminated a custom version pkg in the runtime-gvisor extension: Move from GCR to artifact registry #10metricsClientTestIsolation
you could directly have a field that isrest.HTTPClient
. When you instantiate in non-test code, you pass real client to a constuctor func such asNewMetricsClient(httpClient)
. When you instantiate in test code, you pass fake/mock client../pkg/util/gardener
to/third_party/
. Example: gardener/gardener@a1eb2fb: Drop vendoring #13fmt.Errorf
natively as in every other place in the gardener code-base.Nits (really, really, really minor)
rm LICENSE.md
. The licenses are already defined underLICENSES/
and there is the symlinkLICENSE
in the root of the repo: Switch to use REUSE license format #12mgr
. You could follow also the same pattern: Upgradek8s.io/*
tov0.28
,sigs.k8s.io/controller-runtime
tov0.16
#14hack/test-e2e-local.sh
but it seems not used. Let's drop it for now and introduce it if needed in the future.: Drop vendoring #13VERSION
file should rather contain the following versionv0.1.0-dev
: Apply review comments. Add debug support #7go.mod
: We usually use only 2require
blocks. One for the direct dependencies, and the other one managed by the goo tool for the indirect/transitive ones. You could merge the first and the second require blocks.: Apply review comments. Add debug support #7make verify
#11v0.23.7
) in https://github.com/gardener/gardener-custom-metrics/blob/392b48aab8e985dfbbea4a9cffdf753fcc315cb3/go.mod#L15. I assume you had to add the replace because of gardener/gardener and all modules that vendor gardener/gardener requirek8s.io/[email protected]+incompatible
gardener/gardener#6807. But I see that this repo no longer vendorsgithub.com/gardener/gardener
and in the latest versions of gardener this issue is fixed.: Drop the sigs.k8s.io/metrics-server dependency #8hack/tools.go
to make it clear that this is a tool dependency: Upgradek8s.io/*
tov0.28
,sigs.k8s.io/controller-runtime
tov0.16
#14Good package names are short and clear. They are lower case, with no under_scores or mixedCaps.
%s/%s
, the String() method of atypes.NamespacedName
already does this.kapi
is an abreviation that get's used somewhere in gardener/gardener code-base. Consider renaming tokubeAPIServer
.responce
->response
: Apply review comments. Add debug support #7metrics client:
prefix from the error messages from this func. It should be rather added by the caller.InjectClient
are removed in the newer versions ofsigs.k8s.io/controller-runtime
. This should be adapted after upgrading the dependencies to the latest versions: Upgradek8s.io/*
tov0.28
,sigs.k8s.io/controller-runtime
tov0.16
#14NewKubeAPIServerPodPredicate
.dueAtTime.Sub(q.scrapePeriod)
.--version
flag.Questions:
pod.Status.PodIP
is empty. According to the doc string of the field,pod.Status.PodIP
will be empty if not yet allocated.MetricsUrl
? Instead you could only store the Pod IP and construct the metrics URL when fetching the metrics.3: Storing the same Pod labels would be a lot waste of memory. I see that you need the Pod labels to allow selecting metrics by object labelSelector. Maybe the whole model has to be adapted. We can for example accept that Pod labels are immutable and store them only once and not for every new metric value. [under-discussion]
Final notes. I didn't deep dive into non-trivial packages like
./pkg/input/metrics_scraper
.The text was updated successfully, but these errors were encountered: