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

support az aware hashring and multiple sts in one hashring #129

Merged
merged 9 commits into from May 16, 2024

Conversation

christopherzli
Copy link
Contributor

@christopherzli christopherzli commented Jan 24, 2024

What changes are proposed in this pull request?

  1. Support az aware hashring in Thanos v0.32+
    https://thanos.io/tip/components/receive.md/#az-aware-ketama-hashring-experimental
  2. supported multiple sts in one hashring
  3. Update dependencies including golang version, along with bingo and golangci-lint version, and fixed all lint tests

How is this tested?

main_test.go,
Make thanos-receive-controller
#127

@christopherzli christopherzli changed the title support az aware hashring support az aware hashring, update thanos and its dependencies Jan 24, 2024
@christopherzli christopherzli changed the title support az aware hashring, update thanos and its dependencies support az aware hashring and multiple sts in one hashring Jan 24, 2024
@@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.17

require github.com/golangci/golangci-lint v1.45.2 // cmd/golangci-lint
Copy link
Contributor Author

Choose a reason for hiding this comment

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

needs to update golangci-lint version and bingo version to work with golang v1.21

@@ -19,6 +19,11 @@ linters:
- varnamelen
- paralleltest
- cyclop
- exhaustruct
Copy link
Contributor Author

Choose a reason for hiding this comment

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

temp disable some newly added lint checks, feel free to resolve on these lint issues

k8s.io/apimachinery v0.26.1
k8s.io/client-go v0.26.1
github.com/prometheus/client_golang v1.17.0
github.com/thanos-io/thanos v0.33.0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

accomodate thanos newer version

return p.listsMetric
}

func (p prometheusReflectorMetrics) NewListDurationMetric(name string) cache.SummaryMetric {
func (p prometheusReflectorMetrics) NewListDurationMetric(_ string) cache.SummaryMetric {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix lint issues

@@ -283,7 +289,7 @@ func newReflectorMetrics(reg *prometheus.Registry) prometheusReflectorMetrics {

const labelParts = 2

func splitLabel(in string) (key, value string) {
func splitLabel(in string) (string, string) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix nonamed return values

statefulsets[hashring] = []*appsv1.StatefulSet{}
}
// Append the new value to the slice associated with the hashring key
statefulsets[hashring] = append(statefulsets[hashring], sts.DeepCopy())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

support multiple sts placed in a single hashring in our setup

@@ -679,6 +686,40 @@ func (c *controller) populate(ctx context.Context, hashrings []receive.HashringC
}
}

func (c *controller) populateEndpoint(sts *appsv1.StatefulSet, podIndex int, err error, pod *corev1.Pod) *receive.Endpoint {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

extracted this function to reduce cognitive complexity required by lint

@christopherzli
Copy link
Contributor Author

tested it worked when scale up 1 node, the configmap updates the configmap too:
Screenshot 2024-01-25 at 2 16 19 AM

christopherzli added a commit to databricks/thanos-receive-controller that referenced this pull request Jan 25, 2024
## What changes are proposed in this pull request?
1. Support az aware hashring in Thanos v0.32+ 

https://thanos.io/tip/components/receive.md/#az-aware-ketama-hashring-experimental,
2. also supported multiple sts in one hashring config
3. fix lint and go dependency issues
OSS PR:
observatorium#129
## How is this tested?
main_test.go,
Make thanos-receive-controller
pending test in deployment
Copy link
Collaborator

@philipgough philipgough left a comment

Choose a reason for hiding this comment

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

lgtm thanks for this

@philipgough philipgough merged commit 2753f3f into observatorium:main May 16, 2024
4 checks passed
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.

None yet

2 participants