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

Fix api service reg #1337

Merged
merged 17 commits into from
Nov 15, 2023
Merged

Conversation

ishankhare07
Copy link
Contributor

What issue type does this pull request address? (keep at least one, remove the others)
/kind bugfix
/kind enhancement

What does this pull request do? Which issues does it resolve? (use resolves #<issue_number> if possible)
resolves #1163 ENG-1901

Please provide a short message that should be published in the vcluster release notes
Fixed an issue where vcluster when deployed with k8s/eks distro and metrics proxy enabled could not resolve apiservice properly because syncer and apiserver being in separate pods

What else do we need to know?

@ishankhare07 ishankhare07 marked this pull request as ready for review October 31, 2023 12:45
charts/eks/templates/metrics-proxy.yaml Outdated Show resolved Hide resolved
@@ -169,6 +174,7 @@ spec:
{{- end }}
{{- if or .Values.proxy.metricsServer.nodes.enabled .Values.proxy.metricsServer.pods.enabled}}
- --proxy-metrics-server=true
- --single-binary-distro=false
Copy link
Member

Choose a reason for hiding this comment

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

Why do we have an env var and flag for this? Also why is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this info is needed at 2 places basically, one is at places like endpoints syncer, apiregistration etc.
and the other is in specialservices

Since we don't have a way to inject controller context here, I thought to inject the env var

Copy link
Contributor

Choose a reason for hiding this comment

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

How about removing the global Default variable in the resolver (https://github.com/ishankhare07/vcluster/blob/c98aba12ee29bc661a75af190cabca0b8bd5d213/pkg/specialservices/resolver.go#L12) and adding a boolean to the function definition of DefaultNameserverFinder.

As the specialservices.Default variable is used in two places, why not store the variable from the controller context in those two syncers and then pass it down to the DefaultNameserverFinder function?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, would it make more sense to pass down the name of the distro as an arg instead of this flag and then decide within the code if it's a single binary distro?

@FabianKramm
Copy link
Member

@ishankhare07 also would be good if we add some sort of test here to avoid breaking this in future

@@ -169,6 +174,7 @@ spec:
{{- end }}
{{- if or .Values.proxy.metricsServer.nodes.enabled .Values.proxy.metricsServer.pods.enabled}}
- --proxy-metrics-server=true
- --single-binary-distro=false
Copy link
Contributor

Choose a reason for hiding this comment

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

How about removing the global Default variable in the resolver (https://github.com/ishankhare07/vcluster/blob/c98aba12ee29bc661a75af190cabca0b8bd5d213/pkg/specialservices/resolver.go#L12) and adding a boolean to the function definition of DefaultNameserverFinder.

As the specialservices.Default variable is used in two places, why not store the variable from the controller context in those two syncers and then pass it down to the DefaultNameserverFinder function?

pkg/controllers/k8sdefaultendpoint/k8sdefaultendpoint.go Outdated Show resolved Hide resolved
test/e2e_metrics_proxy/metricsProxy.go Show resolved Hide resolved
@ishankhare07
Copy link
Contributor Author

ishankhare07 commented Nov 8, 2023

#1337 (comment)

The DefaultNameserverFinder function is not called explicitly anywhere and is implicitly called on package import.
Also the .pro code depends on it and is supposed to override it in case integrated coredns is used over there.

We are still storing the boolean in the controllerctx and using it where possible. But if we want to pass it to DefaultNameserverFinder we need to be explicitly calling it in OSS somewhere and also when calling it in Pro, based on the flag we have to call it as default or reset it in case

Edit: I think I misunderstood, I got what you're suggesting and it makes sense - will push an update soon

@ishankhare07 ishankhare07 force-pushed the fix-api-service-reg branch 2 times, most recently from 441f68f to 73719a4 Compare November 9, 2023 10:13
enable hostNetwork for metrics server

Signed-off-by: Ishan Khare <[email protected]>

const (
DefaultKubeDNSServiceName = "kube-dns"
DefaultKubeDNSServiceNamespace = "kube-system"

DistroEnvKey = "SINGLE_BINARY_DISTRO"
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove this?

if vEndpoints.Labels == nil {
vEndpoints.Labels = map[string]string{}
}
// vEndpoints.Labels[discoveryv1.LabelSkipMirror] = "true"
Copy link
Member

Choose a reason for hiding this comment

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

why is this commented out?

Copy link

netlify bot commented Nov 15, 2023

Deploy Preview for vcluster-docs canceled.

Name Link
🔨 Latest commit f742c4e
🔍 Latest deploy log https://app.netlify.com/sites/vcluster-docs/deploys/6554b680eb9899000845f053

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.

Deletion of namespace hangs when proxying metrics-server
3 participants