Skip to content

Commit 3900564

Browse files
committed
add kubeconfig to every tenant
1 parent 59d4c5c commit 3900564

File tree

3 files changed

+62
-2
lines changed

3 files changed

+62
-2
lines changed

packages/apps/tenant/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ description: Separated tenant namespace
44
icon: /logos/tenant.svg
55

66
type: application
7-
version: 1.6.0
7+
version: 1.6.1
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{{- $cozyConfig := lookup "v1" "ConfigMap" "cozy-system" "cozystack" }}
2+
{{- $host := index $cozyConfig.data "root-host" }}
3+
{{- $apiServerAdress := index $cozyConfig.data "api-server-adress" }}
4+
{{- $k8sClientSecret := lookup "v1" "Secret" "cozy-keycloak" "k8s-client" }}
5+
{{- $k8sClient := index $k8sClientSecret.data "client-secret-key" | b64dec }}
6+
{{- $rootSaConfigMap := lookup "v1" "ConfigMap" "kube-system" "kube-root-ca.crt" }}
7+
{{- $k8sCa := index $rootSaConfigMap.data "ca.crt" | b64enc }}
8+
9+
apiVersion: rbac.authorization.k8s.io/v1
10+
kind: Role
11+
metadata:
12+
name: {{ include "tenant.name" . }}-dashboard-resources
13+
namespace: {{ .Release.namespace }}
14+
rules:
15+
- apiGroups:
16+
- ""
17+
resources:
18+
- secrets
19+
resourceNames:
20+
- kubeconfig-{{ include "tenant.name" . }}
21+
verbs: ["get", "list", "watch"]
22+
23+
24+
---
25+
26+
apiVersion: v1
27+
kind: Secret
28+
metadata:
29+
name: kubeconfig-{{ include "tenant.name" . }}
30+
namespace: tenant-root
31+
stringData:
32+
kubeconfig: |
33+
apiVersion: v1
34+
clusters:
35+
- cluster:
36+
server: https://{{ $apiServerAdress }}:6443
37+
certificate-authority-data: {{ $k8sCa }}
38+
name: cluster
39+
contexts:
40+
- context:
41+
cluster: cluster
42+
namespace: {{ include "tenant.name" . }}
43+
user: keycloak
44+
name: {{ include "tenant.name" . }}
45+
current-context: default
46+
users:
47+
- name: keycloak
48+
user:
49+
exec:
50+
apiVersion: client.authentication.k8s.io/v1beta1
51+
args:
52+
- oidc-login
53+
- get-token
54+
- --oidc-issuer-url=https://keycloak.{{ $host }}/realms/cozy
55+
- --oidc-client-id=kubernetes
56+
- --oidc-client-secret={{ $k8sClient }}
57+
- --skip-open-browser
58+
- --grant-type=password
59+
command: kubectl

packages/apps/versions_map

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ tenant 1.3.0 ceefae03
8787
tenant 1.3.1 c56e5769
8888
tenant 1.4.0 94c688f7
8989
tenant 1.5.0 48128743
90-
tenant 1.6.0 HEAD
90+
tenant 1.6.0 df448b99
91+
tenant 1.6.1 HEAD
9192
virtual-machine 0.1.4 f2015d6
9293
virtual-machine 0.1.5 7cd7de7
9394
virtual-machine 0.2.0 5ca8823

0 commit comments

Comments
 (0)