Skip to content
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
17 changes: 14 additions & 3 deletions apis/resourcestatemetrics/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,20 @@ spec:
type: object
type: object
namespace:
description: Kubernetes namespace where the resource-state-metrics controller
and related resources will be deployed.
type: string
description: Kubernetes namespace configuration.
properties:
name:
type: string
description: Kubernetes namespace where the resource-state-metrics controller and related resources will be deployed.
default: resource-state-metrics-system
create:
type: boolean
description: Should the kubernetes namespace be provisioned.
default: true
type: object
default:
name: resource-state-metrics-system
create: true
rbac:
description: RBAC configuration for the controller.
properties:
Expand Down
1 change: 0 additions & 1 deletion examples/xr-rsm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: rsm
spec:
parameters:
namespace: resource-state-metrics
rbac:
allowedAPIGroups:
- apiextensions.crossplane.io
Expand Down
4 changes: 3 additions & 1 deletion functions/rsm/01-namespace.yaml.gotmpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# code: language=yaml
# yaml-language-server: $schema=../../.up/json/models/index.schema.json

{{- if $xr.spec.parameters.namespace.create }}
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ $xr.spec.parameters.namespace }}
name: {{ $xr.spec.parameters.namespace.name }}
annotations:
{{ setResourceNameAnnotation "namespace" }}
labels:
app.kubernetes.io/name: resource-state-metrics
app.kubernetes.io/managed-by: crossplane
{{- end }}
2 changes: 1 addition & 1 deletion functions/rsm/02-serviceaccount.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: resource-state-metrics
namespace: {{ $xr.spec.parameters.namespace }}
namespace: {{ $xr.spec.parameters.namespace.name }}
annotations:
{{ setResourceNameAnnotation "serviceaccount" }}
labels:
Expand Down
2 changes: 1 addition & 1 deletion functions/rsm/04-clusterrolebinding.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: resource-state-metrics
namespace: {{ $xr.spec.parameters.namespace }}
namespace: {{ $xr.spec.parameters.namespace.name }}
2 changes: 1 addition & 1 deletion functions/rsm/05-deployment.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: resource-state-metrics
namespace: {{ $xr.spec.parameters.namespace }}
namespace: {{ $xr.spec.parameters.namespace.name }}
annotations:
{{ setResourceNameAnnotation "deployment" }}
labels:
Expand Down
2 changes: 1 addition & 1 deletion functions/rsm/06-service.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apiVersion: v1
kind: Service
metadata:
name: resource-state-metrics
namespace: {{ $xr.spec.parameters.namespace }}
namespace: {{ $xr.spec.parameters.namespace.name }}
annotations:
{{ setResourceNameAnnotation "service" }}
labels:
Expand Down
10 changes: 5 additions & 5 deletions tests/test-rsm/test.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,12 @@ items:
subjects:
- kind: ServiceAccount
name: resource-state-metrics
namespace: resource-state-metrics
namespace: resource-state-metrics-system
- apiVersion: apps/v1
kind: Deployment
metadata:
name: resource-state-metrics
namespace: resource-state-metrics
namespace: resource-state-metrics-system
annotations:
crossplane.io/composition-resource-name: deployment
labels:
Expand Down Expand Up @@ -605,7 +605,7 @@ items:
- apiVersion: v1
kind: Namespace
metadata:
name: resource-state-metrics
name: resource-state-metrics-system
annotations:
crossplane.io/composition-resource-name: namespace
labels:
Expand All @@ -623,7 +623,7 @@ items:
kind: Service
metadata:
name: resource-state-metrics
namespace: resource-state-metrics
namespace: resource-state-metrics-system
annotations:
crossplane.io/composition-resource-name: service
labels:
Expand Down Expand Up @@ -654,7 +654,7 @@ items:
automountServiceAccountToken: false
metadata:
name: resource-state-metrics
namespace: resource-state-metrics
namespace: resource-state-metrics-system
annotations:
crossplane.io/composition-resource-name: serviceaccount
labels:
Expand Down
Loading