-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove namespace from linkerd-jaeger chart (#6669)
Another part of #6584 based off of #6635 (alpeb/no-ns-helm-core) Stop rendering `namespace.yaml` in the `linkerd-jaeger` chart, same as we did in #6635. This makes use of a Helm `post-install` hook to add the `linkerd.io/extension: jaeger` label to the namespace created by Helm. The `linkerd.io/inject: enabled` and `config.linkerd.io/proxy-await: enabled` annotations have been moved down from the namespace and into each workload.
- Loading branch information
Showing
14 changed files
with
137 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
jaeger/charts/linkerd-jaeger/templates/namespace-metadata-rbac.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
annotations: | ||
{{ include "partials.annotations.created-by" . }} | ||
"helm.sh/hook": post-install | ||
"helm.sh/hook-weight": "0" | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
name: namespace-metadata | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
annotations: | ||
{{ include "partials.annotations.created-by" . }} | ||
"helm.sh/hook": post-install | ||
"helm.sh/hook-weight": "0" | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
name: namespace-metadata | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["namespaces"] | ||
verbs: ["get", "patch"] | ||
resourceNames: ["{{.Release.Namespace}}"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
annotations: | ||
{{ include "partials.annotations.created-by" . }} | ||
"helm.sh/hook": post-install | ||
"helm.sh/hook-weight": "0" | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
name: namespace-metadata | ||
roleRef: | ||
kind: Role | ||
name: namespace-metadata | ||
apiGroup: rbac.authorization.k8s.io | ||
subjects: | ||
- kind: ServiceAccount | ||
name: namespace-metadata | ||
namespace: {{.Release.Namespace}} |
46 changes: 46 additions & 0 deletions
46
jaeger/charts/linkerd-jaeger/templates/namespace-metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
annotations: | ||
{{ include "partials.annotations.created-by" . }} | ||
"helm.sh/hook": post-install | ||
"helm.sh/hook-weight": "0" | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
labels: | ||
app.kubernetes.io/name: namespace-metadata | ||
app.kubernetes.io/part-of: Linkerd | ||
app.kubernetes.io/version: {{default .Values.linkerdVersion .Values.cliVersion}} | ||
name: namespace-metadata | ||
spec: | ||
template: | ||
metadata: | ||
annotations: | ||
{{ include "partials.annotations.created-by" . }} | ||
labels: | ||
app.kubernetes.io/name: namespace-metadata | ||
app.kubernetes.io/part-of: Linkerd | ||
app.kubernetes.io/version: {{default .Values.linkerdVersion .Values.cliVersion}} | ||
spec: | ||
restartPolicy: Never | ||
serviceAccountName: namespace-metadata | ||
containers: | ||
- name: namespace-metadata | ||
image: curlimages/curl:7.78.0 | ||
command: ["/bin/sh"] | ||
args: | ||
- -c | ||
- | | ||
ops='' | ||
token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) | ||
ns=$(curl -kfv -H "Authorization: Bearer $token" \ | ||
"https://kubernetes.default.svc/api/v1/namespaces/{{.Release.Namespace}}") | ||
if echo "$ns" | grep -vq 'labels'; then | ||
ops="$ops{\"op\": \"add\",\"path\": \"/metadata/labels\",\"value\": {}}," | ||
fi | ||
ops="$ops{\"op\": \"add\", \"path\": \"/metadata/labels/linkerd.io~1extension\", \"value\": \"jaeger\"}" | ||
curl -kfv -XPATCH -H "Content-Type: application/json-patch+json" -H "Authorization: Bearer $token" \ | ||
-d "[$ops]" \ | ||
"https://kubernetes.default.svc/api/v1/namespaces/{{.Release.Namespace}}?fieldManager=kubectl-label" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
{{- if (.Values.installNamespace) -}} | ||
{{- if eq .Release.Service "CLI" -}} | ||
--- | ||
kind: Namespace | ||
apiVersion: v1 | ||
metadata: | ||
name: {{.Values.namespace}} | ||
name: {{.Release.Namespace}} | ||
labels: | ||
linkerd.io/extension: jaeger | ||
annotations: | ||
linkerd.io/inject: enabled | ||
config.linkerd.io/proxy-await: "enabled" | ||
{{ end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.