-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 chart: Add enableServiceLinks #7129
Helm chart: Add enableServiceLinks #7129
Conversation
./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% |
Could you raise the Helm Chart version so it's released? |
./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% |
@jeschkies I have updated the Helm chart version, please help to review again, thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you describe the problem a bit more? Is there some technical limit on the number of service environment variables that can be injected into a POD? What was the technical issue this created for you?
@@ -32,6 +32,13 @@ spec: | |||
{{- include "loki.gatewaySelectorLabels" . | nindent 8 }} | |||
spec: | |||
serviceAccountName: {{ include "loki.serviceAccountName" . -}} | |||
{{- if semverCompare ">=1.13-0" .Capabilities.KubeVersion.GitVersion }} | |||
{{- if or (.Values.loki.enableServiceLinks) (eq (.Values.loki.enableServiceLinks | toString) "<nil>") }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why doe we need the toString
compared to "<nil>"
? shouldn't helm treat a nil value as falsey? Also, would you consider moving this to a single if
statement, potentially even extracting a template function if it's messy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The toString
is to set the enableServiceLinks
to true (default value) when enableServiceLinks
is not provided in the values.yaml.
We will need to have 2 if because in k8s version < v1.13.0, there is no enableServiceLinks
and I have moved this chunk into template to make it dry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were deploying the loki-stack in the same namespace as knative and as the service grow, we were not able to start the pod due to too many services environment variables being injected. We are moving loki-stack to different namespace at the moment to fix the issue, but thought this feature could help those that has constraint with the namespace(ie. only allow to deploy to certain namespace).
You can refer to the link I have attached about the pod unable to startup due to too many service environments injected into the pods.
Here is the link for an interesting experiment did for the knative: knative/serving#8498
d33f3ee
to
e8eccf2
Compare
./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% |
7717b00
to
adcf94f
Compare
./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.1%
+ distributor 0%
+ querier 0%
+ querier/queryrange 0%
+ iter 0%
+ storage 0%
+ chunkenc 0%
+ logql 0%
+ loki 0% |
@trevorwhitney Is it possible to help review this MR? Thank you so much |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reading a bit more into those Knative issue you linked (thank you) I'm open to this change. I have one small tweak to your template function I'd like to see, then LGTM!
{{- if or (.Values.loki.enableServiceLinks) (eq (.Values.loki.enableServiceLinks | toString) "<nil>") -}} | ||
enableServiceLinks: true | ||
{{- else -}} | ||
enableServiceLinks: false | ||
{{- end -}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't love the to string and comparison to the string "<nil>", as I feel like that's too tightly coupled to go template implementation details. How would you feel about switching the logic to avoid that?
{{- if or (.Values.loki.enableServiceLinks) (eq (.Values.loki.enableServiceLinks | toString) "<nil>") -}} | |
enableServiceLinks: true | |
{{- else -}} | |
enableServiceLinks: false | |
{{- end -}} | |
{{- if not .Values.loki.enableServiceLinks -}} | |
enableServiceLinks: false | |
{{- else -}} | |
enableServiceLinks: true | |
{{- end -}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this result in a true
if it's explicitly true
or omitted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work because if the value is omitted, it is treated as false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the change to {{- if or (.Values.loki.enableServiceLinks) (ne .Values.loki.enableServiceLinks false) -}}
so instead of using toString
will check if it is false, this way will decouple with go templating implementation, hope this is ok for you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not following. My understanding was we want enableServiceLinks
to be true
if it's either explicitly set to true
or if it's omitted. The above should work since we set the default to true
, so if omitted it should use the default value. I checked out your branch, and made only the change above, and these are my results.
helm template . --set loki.enableServiceLinks=false --show-only templates/gateway/deployment-gateway.yaml
:
---
# Source: loki/templates/gateway/deployment-gateway.yaml
...
spec:
serviceAccountName: loki
enableServiceLinks: false
...
helm template . --set loki.enableServiceLinks=true --show-only templates/gateway/deployment-gateway.yaml
:
---
# Source: loki/templates/gateway/deployment-gateway.yaml
...
spec:
serviceAccountName: loki
enableServiceLinks: true
...
helm template . --show-only templates/gateway/deployment-gateway.yaml
---
# Source: loki/templates/gateway/deployment-gateway.yaml
...
spec:
serviceAccountName: loki
enableServiceLinks: true
...
Sorry for the confusion, but is this not the correct behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This second condition is to cover the case where the enableServiceLinks
is missing in values.yaml
or it is set to empty string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's missing in values.yaml
I don't understand why it wouldn't get the default value?
adcf94f
to
e3a1ef5
Compare
./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.1%
+ distributor 0%
+ querier 0%
+ querier/queryrange 0%
+ iter 0%
+ storage 0%
+ chunkenc 0%
+ logql 0%
+ loki 0% |
e3a1ef5
to
b0bd555
Compare
./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% |
1 similar comment
./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% |
./tools/diff_coverage.sh ../loki-target-branch/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% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Could you generate the documentation reference?
43b0f52
to
0a34c27
Compare
./tools/diff_coverage.sh ../loki-target-branch/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% |
@TAYTS could you merge the current main branch? It will fix the build error. |
0a34c27
to
e295046
Compare
./tools/diff_coverage.sh ../loki-target-branch/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% |
1 similar comment
./tools/diff_coverage.sh ../loki-target-branch/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% |
e295046
to
12cbd84
Compare
./tools/diff_coverage.sh ../loki-target-branch/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% |
**What this PR does / why we need it**: This is to allow disable `enableServiceLinks` so that the service environments are not injected into the pods where in my scenario Loki is deployed in the same namespace as the Knative services resulted the Loki pod unable to start up due to too many service environment being injected. Reference issue for pod unable to startup due to too many services: kubernetes/kubernetes#84539 (comment) Co-authored-by: Trevor Whitney <trevorjwhitney@gmail.com>
What this PR does / why we need it:
This is to allow disable
enableServiceLinks
so that the service environments are not injected into the pods where in my scenario Loki is deployed in the same namespace as the Knative services resulted the Loki pod unable to start up due to too many service environment being injected.Reference issue for pod unable to startup due to too many services: kubernetes/kubernetes#84539 (comment)
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Checklist
CHANGELOG.md
.docs/sources/upgrading/_index.md