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

[helm] Add Loki Canary to Helm Chart #7173

Merged
merged 11 commits into from
Sep 21, 2022

Conversation

trevorwhitney
Copy link
Collaborator

What this PR does / why we need it:

This PR adds the Loki canary as well as the GEL provisioner to the Loki helm chart. The Loki canary expands the self-monitoring functionality of the Helm chart, giving operators insight beyond whether Loki is just running, but also if it's functioning properly.

The GEL provisioner was necessary for the canary to work when the enterprise option (enterprise.enabled = true) is enabled. Since enabling enterprise in the helm chart also enables auth/multi-tenancy, the addition of the provisioner allows the helm chart to automatically create a tenant for the canary via the GEL admin API, and to create applicable access policies and tokens. Furthermore, additional tenants can also be specified, which will be provisioned, creating a read and write token for each that will be stored in k8s secrets.

Which issue(s) this PR fixes:
Fixes #7019

Checklist

  • Documentation added
  • Tests updated
  • Is this an important fix or new feature? Add an entry in the CHANGELOG.md.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/upgrading/_index.md

@trevorwhitney trevorwhitney requested a review from a team as a code owner September 15, 2022 16:51
@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0%
+        distributor	0%
+            querier	0%
+ querier/queryrange	0%
+               iter	0%
+            storage	0%
+           chunkenc	0%
+              logql	0%
+               loki	0%

Copy link
Contributor

@DylanGuedes DylanGuedes left a comment

Choose a reason for hiding this comment

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

few nits

production/helm/loki/CHANGELOG.md Outdated Show resolved Hide resolved
production/helm/loki/README.md Outdated Show resolved Hide resolved
production/helm/loki/templates/_helpers.tpl Show resolved Hide resolved
production/helm/loki/values.yaml Outdated Show resolved Hide resolved
production/helm/loki/values.yaml Outdated Show resolved Hide resolved
production/helm/loki/values.yaml Outdated Show resolved Hide resolved
cluster: {{ include "loki.fullname" . -}}
cluster: {{ include "loki.fullname" . }}
{{- if or .Values.loki.auth_enabled .Values.enterprise.enabled }}
tenantId: {{ .Values.monitoring.selfMonitoring.tenant }}
Copy link
Contributor

Choose a reason for hiding this comment

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

is this identation right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is a tenant ID required for enterprise?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

probably not required for enterprise since with enterprise we're providing the username below.

Copy link
Collaborator Author

@trevorwhitney trevorwhitney Sep 19, 2022

Choose a reason for hiding this comment

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

changed the logic a bit, and yes double checked indenation, following is with auth_enabled = true but enterprise off:

spec:
  clients:
    
    - url: http://loki-gateway.default.svc.cluster.local/loki/api/v1/push
      externalLabels:
        cluster: release-name-loki
      tenantId: self-monitoring

Copy link
Contributor

@jeschkies jeschkies left a comment

Choose a reason for hiding this comment

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

I need to give it one more pass.

@trevorwhitney trevorwhitney force-pushed the add-canary-2 branch 3 times, most recently from 576c0cb to 2fc7aa2 Compare September 21, 2022 15:08
trevorwhitney and others added 11 commits September 21, 2022 09:33
* Add the loki canary as a deamonset
* In order to work with enterprise mode, the loki-canary had to be
  configured with a basic auth user and password. The addition of the
  provisioner job allows us to provision a tenant for both canary and
  self-monitoring usage.
@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0%
+        distributor	0%
+            querier	0%
- querier/queryrange	-0.1%
+               iter	0%
+            storage	0%
+           chunkenc	0%
+              logql	0%
+               loki	0%

@trevorwhitney trevorwhitney merged commit afd63c5 into grafana:main Sep 21, 2022
@trevorwhitney trevorwhitney deleted the add-canary-2 branch September 21, 2022 16:02
@towolf
Copy link
Contributor

towolf commented Sep 23, 2022

Hi @trevorwhitney, could you explain, why you added the loki-canary ServiceAccount as a Helm post-install hook? This fails to work with Helm via Terraform (hashicorp/terraform-provider-helm#683), and I see no reason for this.

https://github.com/grafana/loki/blob/main/production/helm/loki/templates/loki-canary/serviceaccount.yaml#L10

@towolf
Copy link
Contributor

towolf commented Sep 23, 2022

And another question @trevorwhitney, why do you default to latest and not to .Chart.Appversion here?

https://github.com/grafana/loki/blob/main/production/helm/loki/templates/loki-canary/_helpers.tpl#L28

@trevorwhitney
Copy link
Collaborator Author

@towolf the reason for the post-install hook was probably because I copied the service account template from either the tokengen or provisioner jobs, and my guess for those being post-install hooks are to delay the running of the job. But I agree, we probably don't need to delay anything for the canary so we can remove that.

Also, we should definitely use .Char.Appversion here, agreed!

@trevorwhitney
Copy link
Collaborator Author

@towolf here's a PR to fix, thanks for pointing these out!
#7236

trevorwhitney added a commit that referenced this pull request Oct 21, 2022
**What this PR does / why we need it**:

Bring the Loki Canary service account in line with the Loki service
account, removing the post install hook, and sharing the top level
properties for `automountServiceAccountToken` and `imagePullSecrets`.
I'm open to creating canary specific values for these setting if needed,
but want to start by sharing the top level values to reduce config if
possible.

Also default canary to Appversion to be in sync with default Loki
version

**Which issue(s) this PR fixes**:
Fixes two issues raised in comments from @towolf (thanks!) on this
[PR](#7173 (comment)).

Fixes #7237
lxwzy pushed a commit to lxwzy/loki that referenced this pull request Nov 7, 2022
**What this PR does / why we need it**:

This PR adds the Loki canary as well as the GEL provisioner to the Loki
helm chart. The Loki canary expands the self-monitoring functionality of
the Helm chart, giving operators insight beyond whether Loki is just
running, but also if it's functioning properly.

The GEL provisioner was necessary for the canary to work when the
enterprise option (`enterprise.enabled = true`) is enabled. Since
enabling enterprise in the helm chart also enables auth/multi-tenancy,
the addition of the provisioner allows the helm chart to automatically
create a tenant for the canary via the GEL admin API, and to create
applicable access policies and tokens. Furthermore, additional tenants
can also be specified, which will be provisioned, creating a read and
write token for each that will be stored in k8s secrets.

**Which issue(s) this PR fixes**:
Fixes grafana#7019 

Co-authored-by: Karsten Jeschkies <[email protected]>
Co-authored-by: Dylan Guedes <[email protected]>
lxwzy pushed a commit to lxwzy/loki that referenced this pull request Nov 7, 2022
**What this PR does / why we need it**:

Bring the Loki Canary service account in line with the Loki service
account, removing the post install hook, and sharing the top level
properties for `automountServiceAccountToken` and `imagePullSecrets`.
I'm open to creating canary specific values for these setting if needed,
but want to start by sharing the top level values to reduce config if
possible.

Also default canary to Appversion to be in sync with default Loki
version

**Which issue(s) this PR fixes**:
Fixes two issues raised in comments from @towolf (thanks!) on this
[PR](grafana#7173 (comment)).

Fixes grafana#7237
changhyuni pushed a commit to changhyuni/loki that referenced this pull request Nov 8, 2022
**What this PR does / why we need it**:

Bring the Loki Canary service account in line with the Loki service
account, removing the post install hook, and sharing the top level
properties for `automountServiceAccountToken` and `imagePullSecrets`.
I'm open to creating canary specific values for these setting if needed,
but want to start by sharing the top level values to reduce config if
possible.

Also default canary to Appversion to be in sync with default Loki
version

**Which issue(s) this PR fixes**:
Fixes two issues raised in comments from @towolf (thanks!) on this
[PR](grafana#7173 (comment)).

Fixes grafana#7237
Abuelodelanada pushed a commit to canonical/loki that referenced this pull request Dec 1, 2022
**What this PR does / why we need it**:

Bring the Loki Canary service account in line with the Loki service
account, removing the post install hook, and sharing the top level
properties for `automountServiceAccountToken` and `imagePullSecrets`.
I'm open to creating canary specific values for these setting if needed,
but want to start by sharing the top level values to reduce config if
possible.

Also default canary to Appversion to be in sync with default Loki
version

**Which issue(s) this PR fixes**:
Fixes two issues raised in comments from @towolf (thanks!) on this
[PR](grafana#7173 (comment)).

Fixes grafana#7237
mraboosk pushed a commit to mraboosk/loki that referenced this pull request Oct 7, 2024
**What this PR does / why we need it**:

This PR adds the Loki canary as well as the GEL provisioner to the Loki
helm chart. The Loki canary expands the self-monitoring functionality of
the Helm chart, giving operators insight beyond whether Loki is just
running, but also if it's functioning properly.

The GEL provisioner was necessary for the canary to work when the
enterprise option (`enterprise.enabled = true`) is enabled. Since
enabling enterprise in the helm chart also enables auth/multi-tenancy,
the addition of the provisioner allows the helm chart to automatically
create a tenant for the canary via the GEL admin API, and to create
applicable access policies and tokens. Furthermore, additional tenants
can also be specified, which will be provisioned, creating a read and
write token for each that will be stored in k8s secrets.

**Which issue(s) this PR fixes**:
Fixes grafana#7019 

Co-authored-by: Karsten Jeschkies <[email protected]>
Co-authored-by: Dylan Guedes <[email protected]>
mraboosk pushed a commit to mraboosk/loki that referenced this pull request Oct 7, 2024
**What this PR does / why we need it**:

Bring the Loki Canary service account in line with the Loki service
account, removing the post install hook, and sharing the top level
properties for `automountServiceAccountToken` and `imagePullSecrets`.
I'm open to creating canary specific values for these setting if needed,
but want to start by sharing the top level values to reduce config if
possible.

Also default canary to Appversion to be in sync with default Loki
version

**Which issue(s) this PR fixes**:
Fixes two issues raised in comments from @towolf (thanks!) on this
[PR](grafana#7173 (comment)).

Fixes grafana#7237
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add loki canary to helm chart
5 participants