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
8 changes: 4 additions & 4 deletions api/clusters/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ const (
// +kubebuilder:selectablefield:JSONPath=".spec.profile"
// +kubebuilder:printcolumn:JSONPath=".spec.purposes",name="Purposes",type=string
// +kubebuilder:printcolumn:JSONPath=`.status.phase`,name="Phase",type=string
// +kubebuilder:printcolumn:JSONPath=`.metadata.annotations["clusters.openmcp.cloud/k8sversion"]`,name="Version",type=string
// +kubebuilder:printcolumn:JSONPath=`.metadata.annotations["clusters.openmcp.cloud/profile"]`,name="Profile",type=string
// +kubebuilder:printcolumn:JSONPath=`.metadata.labels["provider.clusters.openmcp.cloud"]`,name="Provider",type=string, priority=10
// +kubebuilder:printcolumn:JSONPath=".spec.profile",name="ProfileRef",type=string,priority=10
// +kubebuilder:printcolumn:JSONPath=`.metadata.labels["clusters.openmcp.cloud/k8sversion"]`,name="Version",type=string
// +kubebuilder:printcolumn:JSONPath=`.metadata.labels["clusters.openmcp.cloud/provider"]`,name="Provider",type=string
// +kubebuilder:printcolumn:JSONPath=".spec.profile",name="Profile",type=string,priority=10
// +kubebuilder:printcolumn:JSONPath=`.metadata.annotations["clusters.openmcp.cloud/providerinfo"]`,name="Info",type=string,priority=10
// +kubebuilder:printcolumn:JSONPath=".status.apiServer",name="APIServer",type=string,priority=10
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

// Cluster is the Schema for the clusters API
Expand Down
25 changes: 13 additions & 12 deletions api/clusters/v1alpha1/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,25 @@ const (
)

const (
// K8sVersionAnnotation can be used to display the k8s version of the cluster.
K8sVersionAnnotation = GroupName + "/k8sversion"
// K8sVersionLabel can be used to display the k8s version of the cluster.
// This is useful since the cluster spec can contain only a partial version (e.g. "1.23") or no version at all, so the actual version can not be determined from the spec alone.
// The responsible ClusterProvider has to set this label.
K8sVersionLabel = GroupName + "/k8sversion"
// ProviderInfoAnnotation can be used to display provider-specific information about the cluster.
// The responsible ClusterProvider can set this annotation to display additional information about the cluster.
// The value will be shown in a column when 'kubectl get clusters -o wide' is used.
ProviderInfoAnnotation = GroupName + "/providerinfo"
// ProfileNameAnnotation can be used to display the actual name (not the hash) of the cluster profile.
ProfileNameAnnotation = GroupName + "/profile"
// EnvironmentAnnotation can be used to display the environment of the cluster.
EnvironmentAnnotation = GroupName + "/environment"
// ProviderAnnotation can be used to display the provider of the cluster.
ProviderAnnotation = GroupName + "/provider"
// ProviderLabel can be used to display the provider of the cluster.
// It is also used to indicate the provider that is responsible for an AccessRequest.
// For clusters, the responsible ClusterProvider has to set this label.
// For AccessRequests, the generic controller that is part of the openMCP Operator sets it.
ProviderLabel = GroupName + "/provider"

// DeleteWithoutRequestsLabel marks that the corresponding cluster can be deleted if the scheduler removes the last request pointing to it.
// Its value must be "true" for the label to take effect.
DeleteWithoutRequestsLabel = GroupName + "/delete-without-requests"
// ProviderLabel is used to indicate the provider that is responsible for an AccessRequest.
ProviderLabel = "provider." + GroupName
// ProfileLabel is used to make the profile information easily accessible for the ClusterProviders.
ProfileLabel = "profile." + GroupName
// ProfileLabel is used to make the profile information easily accessible on AccessRequests.
ProfileLabel = GroupName + "/profile"
)

const (
Expand Down
14 changes: 7 additions & 7 deletions api/crds/manifests/clusters.openmcp.cloud_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.annotations["clusters.openmcp.cloud/k8sversion"]
- jsonPath: .metadata.labels["clusters.openmcp.cloud/k8sversion"]
name: Version
type: string
- jsonPath: .metadata.annotations["clusters.openmcp.cloud/profile"]
name: Profile
type: string
- jsonPath: .metadata.labels["provider.clusters.openmcp.cloud"]
- jsonPath: .metadata.labels["clusters.openmcp.cloud/provider"]
name: Provider
priority: 10
type: string
- jsonPath: .spec.profile
name: ProfileRef
name: Profile
priority: 10
type: string
- jsonPath: .metadata.annotations["clusters.openmcp.cloud/providerinfo"]
name: Info
priority: 10
type: string
- jsonPath: .status.apiServer
name: APIServer
priority: 10
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
Expand Down
4 changes: 2 additions & 2 deletions docs/controller/accessrequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ To increase performance and simplify reconciliation logic in the individual Clus

The added labels are:
```yaml
provider.clusters.openmcp.cloud: <provider-name>
profile.clusters.openmcp.cloud: <profile-name>
clusters.openmcp.cloud/provider: <provider-name>
clusters.openmcp.cloud/profile: <profile-name>
```

ClusterProviders should only reconcile `AccessRequest` resources where both labels are set and the value of the provider label matches their own provider name. Resources where either label is missing or the value of the provider label does not match the own provider name must be ignored.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: mc-access-profile
namespace: bar
labels:
profile.clusters.openmcp.cloud: default
clusters.openmcp.cloud/profile: default
spec:
clusterRef:
name: my-cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: mc-access-provider
namespace: bar
labels:
provider.clusters.openmcp.cloud: asdf
clusters.openmcp.cloud/provider: asdf
spec:
clusterRef:
name: my-cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: mcr-access-profile
namespace: bar
labels:
profile.clusters.openmcp.cloud: wrong
clusters.openmcp.cloud/profile: wrong
spec:
requestRef:
name: my-cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: mcr-access-provider
namespace: bar
labels:
provider.clusters.openmcp.cloud: wrong
clusters.openmcp.cloud/provider: wrong
spec:
requestRef:
name: my-cluster
Expand Down