Skip to content
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

Fix metrics rbac and secret #135

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading