Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

prometheus-operator config update #1540

Merged
merged 3 commits into from
Aug 25, 2021
Merged

Conversation

knrt10
Copy link
Member

@knrt10 knrt10 commented Jul 26, 2021

Add user-configurable tolerations for prometheus operator and it's
components.

Change configuration for alertmanager. Now it is configured in a
different block

closes: #1527
Signed-off-by: knrt10 kautilya@kinvolk.io

Release notes

Alert manager is not configured as a different block

# old
alertmanager_retention    = "360h"
alertmanager_external_url = "https://api.example.com/alertmanager"
alertmanager_config       = file("alertmanager-config.yaml")
alertmanager_node_selector = {
  "kubernetes.io/hostname" = "worker3"
}

# new
alertmanager {
  retention    = "360h"
  external_url = "https://api.example.com/alertmanager"
  config       = file("alertmanager-config.yaml")
  node_selector = {
    "kubernetes.io/hostname" = "worker3"
  }
}

Operator is also now configured as a new block

# old
prometheus_operator_node_selector = {
  "kubernetes.io/hostname" = "worker3"
}

# new
operator {
  node_selector = {
    "kubernetes.io/hostname" = "worker3"
  }
}

@knrt10 knrt10 requested review from surajssd and invidian July 26, 2021 11:51
@knrt10 knrt10 force-pushed the knrt10/prometheus-tolerations branch from 46a226b to ca844ca Compare July 26, 2021 11:52
Copy link
Member

@invidian invidian left a comment

Choose a reason for hiding this comment

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

Perhaps we could add some tests.

pkg/components/prometheus-operator/component.go Outdated Show resolved Hide resolved
pkg/components/prometheus-operator/component.go Outdated Show resolved Hide resolved
pkg/components/prometheus-operator/component.go Outdated Show resolved Hide resolved
pkg/components/prometheus-operator/template.go Outdated Show resolved Hide resolved
@@ -47,6 +47,12 @@ component "prometheus-operator" {
node_selector = {
"kubernetes.io/hostname" = "worker3"
}
tolerations {
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we could somehow improve this experience for users. E.g. being able to identify what workloads are part of the component and then do some smart mapping to worker groups, so you don't have to specify those manually.

@knrt10 knrt10 force-pushed the knrt10/prometheus-tolerations branch from ca844ca to 06e4198 Compare July 27, 2021 04:51
@knrt10 knrt10 changed the title prometheus-operator add tolerations prometheus-operator config update Jul 27, 2021
@knrt10 knrt10 force-pushed the knrt10/prometheus-tolerations branch from 06e4198 to d54d321 Compare July 27, 2021 05:07
@knrt10
Copy link
Member Author

knrt10 commented Jul 27, 2021

@invidian do we want package tests or e2e test?

Copy link
Member

@invidian invidian left a comment

Choose a reason for hiding this comment

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

@invidian do we want package tests or e2e test?

I think having at least manifest rendering tests touching all new options would be good.

@knrt10 knrt10 force-pushed the knrt10/prometheus-tolerations branch from d54d321 to e6d7dec Compare July 27, 2021 08:44
Copy link
Member

@invidian invidian left a comment

Choose a reason for hiding this comment

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

Just one more nit, otherwise looks good!

pkg/components/prometheus-operator/component.go Outdated Show resolved Hide resolved
@knrt10 knrt10 requested a review from invidian July 28, 2021 05:38
@invidian
Copy link
Member

I suggest adding:

diff --git a/pkg/components/prometheus-operator/component_test.go b/pkg/components/prometheus-operator/component_test.go
index 93c2911a..c161b7d9 100644
--- a/pkg/components/prometheus-operator/component_test.go
+++ b/pkg/components/prometheus-operator/component_test.go
@@ -24,6 +24,8 @@ import (

 //nolint:funlen
 func TestRenderManifest(t *testing.T) {
+       t.Parallel()
+
        tests := []struct {
                desc    string
                hcl     string
@@ -143,6 +145,8 @@ component "prometheus-operator" {
        for _, tc := range tests {
                tc := tc
                t.Run(tc.desc, func(t *testing.T) {
+                       t.Parallel()
+
                        b, d := util.GetComponentBody(tc.hcl, Name)
                        if d != nil {
                                t.Fatalf("error getting component body: %v", d)
@@ -177,6 +181,8 @@ component "prometheus-operator" {

 //nolint:funlen
 func TestConversion(t *testing.T) {
+       t.Parallel()
+
        testCases := []struct {
                name                 string
                inputConfig          string

This cuts down test execution time from 14 seconds to 4 seconds on my machine. Still slow, but better.

@knrt10 knrt10 force-pushed the knrt10/prometheus-tolerations branch from ae4caed to 9fa1767 Compare July 28, 2021 09:39
@knrt10 knrt10 requested a review from invidian July 28, 2021 09:40
Copy link
Member

@invidian invidian left a comment

Choose a reason for hiding this comment

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

Looks OK

@knrt10 knrt10 requested a review from invidian July 28, 2021 10:14
@invidian
Copy link
Member

invidian commented Jul 28, 2021

@invidian I think you said Looks OK and submitted it via request changes. So had to request again smile

I only commented, not requested changes :) Changes looks good to me, but I think some other maintainer should have a look into it and approve it for merging.

@knrt10
Copy link
Member Author

knrt10 commented Jul 28, 2021

@invidian I think you said Looks OK and submitted it via request changes. So had to request again 😄

@invidian invidian removed their request for review July 28, 2021 10:17
@invidian invidian dismissed their stale review July 28, 2021 10:17

Addressed

@knrt10 knrt10 force-pushed the knrt10/prometheus-tolerations branch from 9fa1767 to 0948731 Compare July 29, 2021 11:47
@knrt10 knrt10 requested review from surajssd and invidian July 29, 2021 11:47
@invidian invidian removed their request for review August 3, 2021 20:03
surajssd
surajssd previously approved these changes Aug 4, 2021
@surajssd
Copy link
Member

@knrt10 can you rebase on the current master the ARM issue will be solved.

knrt10 and others added 3 commits August 24, 2021 12:38
Change configuration for alertmanager and operator. Now user can
configure it as a block.

Signed-off-by: knrt10 <kautilya@kinvolk.io>
Add user-configurable tolerations for prometheus-operator and it's
components.

Co-authored-by: Mateusz Gozdek <mateusz@kinvolk.io>
Signed-off-by: knrt10 <kautilya@kinvolk.io>
This add test for new toleration configuration introduced as block.

Signed-off-by: knrt10 <kautilya@kinvolk.io>
@knrt10 knrt10 force-pushed the knrt10/prometheus-tolerations branch from 90f8b68 to 4307660 Compare August 24, 2021 07:09
@knrt10
Copy link
Member Author

knrt10 commented Aug 24, 2021

AWS is still failing on certificate rotation part.

@knrt10
Copy link
Member Author

knrt10 commented Aug 25, 2021

finally, yes

@knrt10 knrt10 merged commit cb5b5c6 into master Aug 25, 2021
@knrt10 knrt10 deleted the knrt10/prometheus-tolerations branch August 25, 2021 03:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFE] Add tolerations to Prometheus Operator
3 participants