You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api/clusters/v1alpha1/clusterrequest_types.go
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ type ClusterRequestSpec struct {
11
11
Purposestring`json:"purpose"`
12
12
}
13
13
14
-
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.clusterRef) || has(self.clusterRef)", message="clusterRef may not be removed once set"
14
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.cluster) || has(self.cluster)", message="cluster may not be removed once set"
15
15
typeClusterRequestStatusstruct {
16
16
CommonStatus`json:",inline"`
17
17
@@ -23,8 +23,8 @@ type ClusterRequestStatus struct {
23
23
// Cluster is the reference to the Cluster that was returned as a result of a granted request.
24
24
// Note that this information needs to be recoverable in case this status is lost, e.g. by adding a back reference in form of a finalizer to the Cluster resource.
25
25
// +optional
26
-
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="clusterRef is immutable"
Copy file name to clipboardExpand all lines: api/crds/manifests/clusters.openmcp.cloud_clusterrequests.yaml
+10-4Lines changed: 10 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,12 @@ spec:
26
26
- jsonPath: .status.phase
27
27
name: Phase
28
28
type: string
29
+
- jsonPath: .status.cluster.name
30
+
name: Cluster
31
+
type: string
32
+
- jsonPath: .status.cluster.namespace
33
+
name: Cluster-NS
34
+
type: string
29
35
name: v1alpha1
30
36
schema:
31
37
openAPIV3Schema:
@@ -62,7 +68,7 @@ spec:
62
68
rule: self == oldSelf
63
69
status:
64
70
properties:
65
-
clusterRef:
71
+
cluster:
66
72
description: |-
67
73
Cluster is the reference to the Cluster that was returned as a result of a granted request.
68
74
Note that this information needs to be recoverable in case this status is lost, e.g. by adding a back reference in form of a finalizer to the Cluster resource.
The _AccessRequest Controller_ is responsible for labelling `AccessRequest` resources with the name of the ClusterProvider that is responsible for them.
4
+
5
+
This is needed because the information, which ClusterProvider is responsible for answering the `AccessRequest` is contained in the referenced `ClusterProfile`. Depending on `AccessRequest`'s spec, a `Cluster` and potentially also a `ClusterRequest` must be fetched before the `ClusterProfile` is known, which then has to be fetched too. If multiple ClusterProviders are running in the cluster, all of them would need to fetch these resources, only for all but one of them to notice that they are not responsible and don't have to do anything.
6
+
7
+
To increase performance and simplify reconciliation logic in the individual ClusterProviders, this central AccessRequest controller takes over the task of figuring out the responsible ClusterProvider and adds a `provider.clusters.openmcp.cloud` label with its name to the `AccessRequest` resource. It reacts only on resources which do not yet have this label, so it should reconcile each `AccessRequest` only once (excluding repeated reconciliations due to errors).
8
+
9
+
ClusterProviders should only reconcile `AccessRequest` resources where the value of the `provider.clusters.openmcp.cloud` label matches their own provider name and ignore resources with other values or if the label is missing completely.
10
+
11
+
## Configuration
12
+
13
+
The AccessRequest controller is run as long as `accessrequest` is included in the `--controllers` flag. It is included by default.
14
+
15
+
The entire configuration for the AccessRequest controller is optional.
16
+
```yaml
17
+
accessRequest: # optional
18
+
selector: # optional
19
+
matchLabels: <...> # optional
20
+
matchExpressions: <...> # optional
21
+
```
22
+
23
+
The following fields can be specified inside the `accessRequest` node:
24
+
- `selector`_(optional)_
25
+
- A standard k8s label selector, as it is also used in Deployments, for example. If specified, only `AccessRequest` resources matching the selector are reconciled by the controller. This can be used to distribute resources between multiple instances of the AccessRequest controller watching the same cluster.
0 commit comments