Skip to content

Commit

Permalink
Merge pull request #135 from appuio/feat/support-rendering-kustomize
Browse files Browse the repository at this point in the history
Fix metrics rbac and secret
  • Loading branch information
thobens authored Dec 3, 2024
2 parents e087c04 + 6fd2b19 commit 4a1aa5b
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 0 deletions.
30 changes: 30 additions & 0 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,35 @@ local certSecret =
else
null;

local metricsRbac =
local sa = kube.ServiceAccount('metrics') {
metadata+: {
namespace: params.namespace,
},
};
[
sa,
kube.Secret(sa.metadata.name) {
metadata+: {
annotations+: {
'kubernetes.io/service-account.name': sa.metadata.name,
'vcluster.loft.sh/force-sync': 'true',
},
namespace: params.namespace,
},
type: 'kubernetes.io/service-account-token',
data:: {},
},
kube.ClusterRoleBinding(sa.metadata.name) {
roleRef: {
apiGroup: 'rbac.authorization.k8s.io',
kind: 'ClusterRole',
name: 'system:monitoring',
},
subjects_: [ sa ],
},
];

// Define outputs below
{
'00_namespace': [
Expand All @@ -68,6 +97,7 @@ local certSecret =
],
[if hasCountriesConfig then '10_odoo_countrylist']: countriesConfigMap,
[if certSecret != null then '10_certs']: certSecret,
'10_rbac_api_metrics': metricsRbac,
'10_rbac_cluster_admin_impersonation': (import 'rbac-cluster-admin-impersonation.libsonnet'),
'10_rbac_basic_user': (import 'rbac-basic-user.libsonnet'),
'10_rbac_organization': (import 'rbac-organization.libsonnet'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v1
kind: ServiceAccount
metadata:
annotations: {}
labels:
name: metrics
name: metrics
namespace: appuio-control-api
---
apiVersion: v1
kind: Secret
metadata:
annotations:
kubernetes.io/service-account.name: metrics
vcluster.loft.sh/force-sync: 'true'
labels:
name: metrics
name: metrics
namespace: appuio-control-api
type: kubernetes.io/service-account-token
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations: {}
labels:
name: metrics
name: metrics
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:monitoring
subjects:
- kind: ServiceAccount
name: metrics
namespace: appuio-control-api
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v1
kind: ServiceAccount
metadata:
annotations: {}
labels:
name: metrics
name: metrics
namespace: appuio-control-api
---
apiVersion: v1
kind: Secret
metadata:
annotations:
kubernetes.io/service-account.name: metrics
vcluster.loft.sh/force-sync: 'true'
labels:
name: metrics
name: metrics
namespace: appuio-control-api
type: kubernetes.io/service-account-token
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations: {}
labels:
name: metrics
name: metrics
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:monitoring
subjects:
- kind: ServiceAccount
name: metrics
namespace: appuio-control-api
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v1
kind: ServiceAccount
metadata:
annotations: {}
labels:
name: metrics
name: metrics
namespace: appuio-control-api
---
apiVersion: v1
kind: Secret
metadata:
annotations:
kubernetes.io/service-account.name: metrics
vcluster.loft.sh/force-sync: 'true'
labels:
name: metrics
name: metrics
namespace: appuio-control-api
type: kubernetes.io/service-account-token
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations: {}
labels:
name: metrics
name: metrics
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:monitoring
subjects:
- kind: ServiceAccount
name: metrics
namespace: appuio-control-api

0 comments on commit 4a1aa5b

Please sign in to comment.