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

ignore addresses for kubernetes registry #9492

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

butonic
Copy link
Member

@butonic butonic commented Jun 28, 2024

We no longer pass an address to the go micro kubernetes registry implementation. This causes the implementation to autodetect the namespace and not hardcode it to default.

related #8589

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@butonic
Copy link
Member Author

butonic commented Jun 28, 2024

related code in the implementation:

	// get first host
	var host string
	if len(k.options.Addrs) > 0 && len(k.options.Addrs[0]) > 0 {
		host = k.options.Addrs[0]
	}

	if k.options.Timeout == 0 {
		k.options.Timeout = time.Second * 1
	}

	// if no hosts setup, assume InCluster
	var c client.Kubernetes
	if len(host) == 0 {
		c = client.NewClientInCluster()          // <---- this picks up the namespace from the pod
	} else {
		c = client.NewClientByHost(host)         // <---- this hardcodes the namespace to "default"
	}

when the namespace is default, all services will be registered in the default namespace. but then nothing would work and pods from multiple ocis instances in the same kubernetes cluster but in different namespaces would 'see' each other. 🤔

Copy link

sonarcloud bot commented Jun 28, 2024

@butonic butonic merged commit d839bfb into master Jul 30, 2024
3 checks passed
ownclouders pushed a commit that referenced this pull request Jul 30, 2024
…registry

ignore addresses for kubernetes registry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants