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

Use node IP for advertised.listeners when node port is used #936

Merged
merged 9 commits into from
Mar 1, 2023

Conversation

bartam1
Copy link
Contributor

@bartam1 bartam1 commented Feb 21, 2023

Q A
Bug fix? no
New feature? yes
API breaks? no
Deprecations? no
Related tickets mentioned in #901 and #900
License Apache 2.0

What's in this PR?

Using node ip based on configuration (NodePortNodeAddressType) for brokers in advertised.listeners when hostnameOverride and nodePortExternalIP are not set

Why?

Users dont have to specify the node external addresses by hand for the brokers when nodeport is used.

Checklist

  • Implementation tested
  • Error handling code meets the guideline
  • Logging code meets the guideline
  • User guide and development docs updated (if needed)

@bartam1 bartam1 changed the title Issue 900 Use node IP for advertised.listeners when node port is used Feb 21, 2023
@bartam1 bartam1 mentioned this pull request Feb 21, 2023
1 task
@bartam1 bartam1 marked this pull request as ready for review February 21, 2023 13:00
@bartam1 bartam1 requested a review from a team as a code owner February 21, 2023 13:00
panyuenlau
panyuenlau previously approved these changes Feb 21, 2023
Copy link
Member

@panyuenlau panyuenlau left a comment

Choose a reason for hiding this comment

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

Implementation LGTM.

It's just that I would really like to see those nested if-else clauses to be wrapped with a util function rather having them to live directly in the createExternalListenerStatuses func

pkg/resources/kafka/kafka.go Outdated Show resolved Hide resolved
pkg/resources/kafka/kafka.go Outdated Show resolved Hide resolved
pkg/resources/kafka/kafka.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Kuvesz Kuvesz left a comment

Choose a reason for hiding this comment

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

Looks good to me, though I'd like to see @panyuenlau 's suggestions before approving.

Kuvesz
Kuvesz previously approved these changes Feb 22, 2023
Copy link
Contributor

@Kuvesz Kuvesz left a comment

Choose a reason for hiding this comment

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

LGTM

panyuenlau
panyuenlau previously approved these changes Feb 24, 2023
Copy link
Member

@panyuenlau panyuenlau 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 taking it over from the community.

Should we also update this banzaicloud_v1beta1_kafkacluster.yaml to reflect the new changes on the KafkaCluster changes? And perhaps the node port section in the koperator docs as well

@bartam1 bartam1 dismissed stale reviews from panyuenlau and Kuvesz via 59fcafa February 27, 2023 14:13
@bartam1 bartam1 requested review from panyuenlau and Kuvesz February 27, 2023 14:13
@bartam1 bartam1 requested a review from panyuenlau February 28, 2023 10:58
Kuvesz
Kuvesz previously approved these changes Feb 28, 2023
Comment on lines 197 to 203
// When "hostNameOverride" and brokerConfig.nodePortExternalIP are empty and NodePort access method is selected for an external listener
// the NodePortNodeAdddressType defines the Kafka broker's Kubernetes node's address type that shall be used in the advertised.listeners property.
// https://kubernetes.io/docs/concepts/architecture/nodes/#addresses
// The NodePortNodeAddressType's values can be Hostname, ExternalIP, InternalIP, InternalDNS,ExternalDNS
// +kubebuilder:validation:Enum=Hostname;ExternalIP;InternalIP;InternalDNS;ExternalDNS
// +optional
NodePortNodeAddressType corev1.NodeAddressType `json:"nodePortNodeAddressType,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed from here after merging #942 right?

Copy link
Member

@panyuenlau panyuenlau Feb 28, 2023

Choose a reason for hiding this comment

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

The API changes will be gone from this PR after #942 is merged and this PR is rebased with master

Copy link
Contributor

Choose a reason for hiding this comment

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

fair

Kuvesz
Kuvesz previously approved these changes Mar 1, 2023
go.mod Outdated
@@ -1,6 +1,6 @@
module github.com/banzaicloud/koperator

go 1.19
go 1.18
Copy link
Member

Choose a reason for hiding this comment

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

Is this change intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No

Copy link
Member

@pregnor pregnor left a comment

Choose a reason for hiding this comment

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

LGTM at a glance

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.

5 participants