1 package v1alpha1 2 3 import ( 4 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 ) 6 7 // Package contains fields to configure which OLM package this PlatformOperator will install 8 type Package struct { 9 // name contains the desired OLM-based Operator package name 10 // that is defined in an existing CatalogSource resource in the cluster. 11 // 12 // This configured package will be managed with the cluster's lifecycle. In 13 // the current implementation, it will be retrieving this name from a list of 14 // supported operators out of the catalogs included with OpenShift. 15 // +kubebuilder:validation:Required 16 // 17 // +kubebuilder:validation:Pattern:=[a-z0-9]([-a-z0-9]*[a-z0-9])? 18 // +kubebuilder:validation:MaxLength:=56 19 // --- 20 // + More restrictions to package names supported is an intentional design 21 // + decision that, while limiting to user options, allows code built on these 22 // + API's to make more confident assumptions on data structure. 23 Name string `json:"name"` 24 } 25 26 // PlatformOperatorSpec defines the desired state of PlatformOperator. 27 type PlatformOperatorSpec struct { 28 // package contains the desired package and its configuration for this 29 // PlatformOperator. 30 // +kubebuilder:validation:Required 31 Package Package `json:"package"` 32 } 33 34 // ActiveBundleDeployment references a BundleDeployment resource. 35 type ActiveBundleDeployment struct { 36 // name is the metadata.name of the referenced BundleDeployment object. 37 // +kubebuilder:validation:Required 38 Name string `json:"name"` 39 } 40 41 // PlatformOperatorStatus defines the observed state of PlatformOperator 42 type PlatformOperatorStatus struct { 43 // conditions represent the latest available observations of a platform operator's current state. 44 // +optional 45 // +patchMergeKey=type 46 // +patchStrategy=merge 47 // +listType=map 48 // +listMapKey=type 49 Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` 50 51 // activeBundleDeployment is the reference to the BundleDeployment resource that's 52 // being managed by this PO resource. If this field is not populated in the status 53 // then it means the PlatformOperator has either not been installed yet or is 54 // failing to install. 55 // +optional 56 ActiveBundleDeployment ActiveBundleDeployment `json:"activeBundleDeployment,omitempty"` 57 } 58 59 // +genclient 60 // +genclient:nonNamespaced 61 //+kubebuilder:object:root=true 62 //+kubebuilder:subresource:status 63 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 64 65 // PlatformOperator is the Schema for the PlatformOperators API. 66 // 67 // Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. 68 // +openshift:compatibility-gen:level=4 69 type PlatformOperator struct { 70 metav1.TypeMeta `json:",inline"` 71 72 // metadata is the standard object's metadata. 73 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 74 metav1.ObjectMeta `json:"metadata,omitempty"` 75 76 Spec PlatformOperatorSpec `json:"spec"` 77 Status PlatformOperatorStatus `json:"status,omitempty"` 78 } 79 80 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 81 82 // PlatformOperatorList contains a list of PlatformOperators 83 // 84 // Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. 85 // +openshift:compatibility-gen:level=4 86 type PlatformOperatorList struct { 87 metav1.TypeMeta `json:",inline"` 88 89 // metadata is the standard list's metadata. 90 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 91 metav1.ListMeta `json:"metadata,omitempty"` 92 93 Items []PlatformOperator `json:"items"` 94 } 95