diff --git a/api/clusters/v1alpha1/accessrequest_types.go b/api/clusters/v1alpha1/accessrequest_types.go index 9e8545d..7d52460 100644 --- a/api/clusters/v1alpha1/accessrequest_types.go +++ b/api/clusters/v1alpha1/accessrequest_types.go @@ -5,6 +5,13 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +const ( + // AccessRequestPending is the phase if the AccessRequest has not been scheduled yet. + AccessRequestPending = "Pending" + // AccessRequestGranted is the phase if the AccessRequest has been granted. + AccessRequestGranted = "Granted" +) + // +kubebuilder:validation:XValidation:rule="!has(oldSelf.clusterRef) || has(self.clusterRef)", message="clusterRef may not be removed once set" // +kubebuilder:validation:XValidation:rule="!has(oldSelf.requestRef) || has(self.requestRef)", message="requestRef may not be removed once set" type AccessRequestSpec struct { diff --git a/api/clusters/v1alpha1/clusterrequest_types.go b/api/clusters/v1alpha1/clusterrequest_types.go index a7b2943..4ad5285 100644 --- a/api/clusters/v1alpha1/clusterrequest_types.go +++ b/api/clusters/v1alpha1/clusterrequest_types.go @@ -4,6 +4,13 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +const ( + // ClusterRequestPending is the phase if the ClusterRequest has not been scheduled yet. + ClusterRequestPending = "Pending" + // ClusterRequestScheduled is the phase if the ClusterRequest has been scheduled. + ClusterRequestScheduled = "Scheduled" +) + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="spec is immutable" type ClusterRequestSpec struct { // Purpose is the purpose of the requested cluster. diff --git a/api/common/reference_types.go b/api/common/reference_types.go new file mode 100644 index 0000000..89c9ee2 --- /dev/null +++ b/api/common/reference_types.go @@ -0,0 +1,26 @@ +package common + +import ( + corev1 "k8s.io/api/core/v1" + apimachinery "k8s.io/apimachinery/pkg/types" +) + +// ObjectReference is a reference to an object in any namespace. +type ObjectReference apimachinery.NamespacedName + +// LocalObjectReference is a reference to an object in the same namespace as the resource referencing it. +type LocalObjectReference corev1.LocalObjectReference + +// SecretReference is a reference to a secret in any namespace with a key. +type SecretReference struct { + ObjectReference `json:",inline"` + // Key is the key in the secret to use. + Key string `json:"key"` +} + +// LocalSecretReference is a reference to a secret in the same namespace as the resource referencing it with a key. +type LocalSecretReference struct { + LocalObjectReference `json:",inline"` + // Key is the key in the secret to use. + Key string `json:"key"` +} diff --git a/api/common/status_types.go b/api/common/status_types.go new file mode 100644 index 0000000..dad5733 --- /dev/null +++ b/api/common/status_types.go @@ -0,0 +1,25 @@ +package common + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +const ( + // StatusPhaseReady indicates that the resource is ready. All conditions are met and are in status "True". + StatusPhaseReady = "Ready" + // StatusPhaseProgressing indicates that the resource is not ready and being created or updated. At least one condition is not met and is in status "False". + StatusPhaseProgressing = "Progressing" + // StatusPhaseTerminating indicates that the resource is not ready and in deletion. At least one condition is not met and is in status "False". + StatusPhaseTerminating = "Terminating" +) + +// Status represents the status of an openMCP resource. +type Status struct { + // ObservedGeneration is the generation of this resource that was last reconciled by the controller. + ObservedGeneration int64 `json:"observedGeneration"` + + // Phase is the current phase of the resource. + Phase string `json:"phase"` + + // Conditions contains the conditions. + // +optional + Conditions []metav1.Condition `json:"conditions,omitempty"` +}