Skip to content
Snippets Groups Projects
Commit 3429bc77 authored by Paweł Krupa (paulfantom)'s avatar Paweł Krupa (paulfantom)
Browse files

disable injecting unnecessary variables allowing access to k8s API

parent f51e9b14
Branches develop
No related tags found
No related merge requests found
...@@ -121,6 +121,7 @@ function(params) { ...@@ -121,6 +121,7 @@ function(params) {
apiVersion: 'v1', apiVersion: 'v1',
kind: 'ServiceAccount', kind: 'ServiceAccount',
metadata: am._metadata, metadata: am._metadata,
automountServiceAccountToken: false,
}, },
service: { service: {
......
...@@ -115,6 +115,7 @@ function(params) { ...@@ -115,6 +115,7 @@ function(params) {
apiVersion: 'v1', apiVersion: 'v1',
kind: 'ServiceAccount', kind: 'ServiceAccount',
metadata: bb._metadata, metadata: bb._metadata,
automountServiceAccountToken: false,
}, },
clusterRole: { clusterRole: {
...@@ -238,6 +239,7 @@ function(params) { ...@@ -238,6 +239,7 @@ function(params) {
spec: { spec: {
containers: [blackboxExporter, reloader, kubeRbacProxy], containers: [blackboxExporter, reloader, kubeRbacProxy],
nodeSelector: { 'kubernetes.io/os': 'linux' }, nodeSelector: { 'kubernetes.io/os': 'linux' },
automountServiceAccountToken: true,
serviceAccountName: 'blackbox-exporter', serviceAccountName: 'blackbox-exporter',
volumes: [{ volumes: [{
name: 'config', name: 'config',
......
...@@ -88,10 +88,12 @@ function(params) ...@@ -88,10 +88,12 @@ function(params)
// 'allowPrivilegeEscalation: false' can be deleted when https://github.com/brancz/kubernetes-grafana/pull/128 gets merged. // 'allowPrivilegeEscalation: false' can be deleted when https://github.com/brancz/kubernetes-grafana/pull/128 gets merged.
// 'readOnlyRootFilesystem: true' can be deleted when https://github.com/brancz/kubernetes-grafana/pull/129 gets merged. // 'readOnlyRootFilesystem: true' can be deleted when https://github.com/brancz/kubernetes-grafana/pull/129 gets merged.
// 'capabilities: { drop: ['ALL'] }' can be deleted when https://github.com/brancz/kubernetes-grafana/pull/130 gets merged. // 'capabilities: { drop: ['ALL'] }' can be deleted when https://github.com/brancz/kubernetes-grafana/pull/130 gets merged.
// FIXME(paulfantom): `automountServiceAccountToken` can be removed after porting to brancz/kuberentes-grafana
deployment+: { deployment+: {
spec+: { spec+: {
template+: { template+: {
spec+: { spec+: {
automountServiceAccountToken: false,
containers: std.map(function(c) c { containers: std.map(function(c) c {
securityContext+: { securityContext+: {
allowPrivilegeEscalation: false, allowPrivilegeEscalation: false,
......
...@@ -129,6 +129,7 @@ function(params) (import 'github.com/kubernetes/kube-state-metrics/jsonnet/kube- ...@@ -129,6 +129,7 @@ function(params) (import 'github.com/kubernetes/kube-state-metrics/jsonnet/kube-
}, },
}, },
spec+: { spec+: {
automountServiceAccountToken: true,
containers: std.map(function(c) c { containers: std.map(function(c) c {
ports:: null, ports:: null,
livenessProbe:: null, livenessProbe:: null,
......
...@@ -114,6 +114,7 @@ function(params) { ...@@ -114,6 +114,7 @@ function(params) {
apiVersion: 'v1', apiVersion: 'v1',
kind: 'ServiceAccount', kind: 'ServiceAccount',
metadata: ne._metadata, metadata: ne._metadata,
automountServiceAccountToken: false,
}, },
service: { service: {
...@@ -240,6 +241,7 @@ function(params) { ...@@ -240,6 +241,7 @@ function(params) {
{ name: 'sys', hostPath: { path: '/sys' } }, { name: 'sys', hostPath: { path: '/sys' } },
{ name: 'root', hostPath: { path: '/' } }, { name: 'root', hostPath: { path: '/' } },
], ],
automountServiceAccountToken: true,
serviceAccountName: ne._config.name, serviceAccountName: ne._config.name,
securityContext: { securityContext: {
runAsUser: 65534, runAsUser: 65534,
......
...@@ -253,6 +253,7 @@ function(params) { ...@@ -253,6 +253,7 @@ function(params) {
spec: { spec: {
containers: [c], containers: [c],
serviceAccountName: $.serviceAccount.metadata.name, serviceAccountName: $.serviceAccount.metadata.name,
automountServiceAccountToken: true,
nodeSelector: { 'kubernetes.io/os': 'linux' }, nodeSelector: { 'kubernetes.io/os': 'linux' },
volumes: [ volumes: [
{ name: 'tmpfs', emptyDir: {} }, { name: 'tmpfs', emptyDir: {} },
...@@ -268,6 +269,7 @@ function(params) { ...@@ -268,6 +269,7 @@ function(params) {
apiVersion: 'v1', apiVersion: 'v1',
kind: 'ServiceAccount', kind: 'ServiceAccount',
metadata: pa._metadata, metadata: pa._metadata,
automountServiceAccountToken: false,
}, },
clusterRole: { clusterRole: {
......
...@@ -131,6 +131,7 @@ function(params) ...@@ -131,6 +131,7 @@ function(params)
spec+: { spec+: {
template+: { template+: {
spec+: { spec+: {
automountServiceAccountToken: true,
containers: std.map(function(c) c { containers: std.map(function(c) c {
securityContext+: { securityContext+: {
capabilities: { drop: ['ALL'] }, capabilities: { drop: ['ALL'] },
......
...@@ -98,6 +98,7 @@ function(params) { ...@@ -98,6 +98,7 @@ function(params) {
apiVersion: 'v1', apiVersion: 'v1',
kind: 'ServiceAccount', kind: 'ServiceAccount',
metadata: p._metadata, metadata: p._metadata,
automountServiceAccountToken: false,
}, },
service: { service: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment