From f14d5e8bb49bb584d88003368bb5b3867e62dd4a Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 21 Jul 2021 17:16:27 -0400 Subject: [PATCH] Add openapi markers for csv --- .../v1alpha1/clusterserviceversion_types.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/operators/v1alpha1/clusterserviceversion_types.go b/pkg/operators/v1alpha1/clusterserviceversion_types.go index 9389ef528..eb4d1635e 100644 --- a/pkg/operators/v1alpha1/clusterserviceversion_types.go +++ b/pkg/operators/v1alpha1/clusterserviceversion_types.go @@ -50,18 +50,21 @@ type InstallModeSet map[InstallModeType]bool // NamedInstallStrategy represents the block of an ClusterServiceVersion resource // where the install strategy is specified. +// +k8s:openapi-gen=true type NamedInstallStrategy struct { StrategyName string `json:"strategy"` StrategySpec StrategyDetailsDeployment `json:"spec,omitempty"` } // StrategyDeploymentPermissions describe the rbac rules and service account needed by the install strategy +// +k8s:openapi-gen=true type StrategyDeploymentPermissions struct { ServiceAccountName string `json:"serviceAccountName"` Rules []rbac.PolicyRule `json:"rules"` } // StrategyDeploymentSpec contains the name, spec and labels for the deployment ALM should create +// +k8s:openapi-gen=true type StrategyDeploymentSpec struct { Name string `json:"name"` Spec appsv1.DeploymentSpec `json:"spec"` @@ -70,6 +73,7 @@ type StrategyDeploymentSpec struct { // StrategyDetailsDeployment represents the parsed details of a Deployment // InstallStrategy. +// +k8s:openapi-gen=true type StrategyDetailsDeployment struct { DeploymentSpecs []StrategyDeploymentSpec `json:"deployments"` Permissions []StrategyDeploymentPermissions `json:"permissions,omitempty"` @@ -265,6 +269,7 @@ type APIServiceDefinitions struct { // ClusterServiceVersionSpec declarations tell OLM how to install an operator // that can manage apps for a given version. +// +k8s:openapi-gen=true type ClusterServiceVersionSpec struct { InstallStrategy NamedInstallStrategy `json:"install"` Version version.OperatorVersion `json:"version,omitempty"` @@ -321,25 +326,30 @@ type ClusterServiceVersionSpec struct { RelatedImages []RelatedImage `json:"relatedImages,omitempty"` } +// +k8s:openapi-gen=true type CleanupSpec struct { Enabled bool `json:"enabled"` } +// +k8s:openapi-gen=true type Maintainer struct { Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` } +// +k8s:openapi-gen=true type AppLink struct { Name string `json:"name,omitempty"` URL string `json:"url,omitempty"` } +// +k8s:openapi-gen=true type Icon struct { Data string `json:"base64data"` MediaType string `json:"mediatype"` } +// +k8s:openapi-gen=true type RelatedImage struct { Name string `json:"name"` Image string `json:"image"` @@ -418,6 +428,7 @@ func (c *ClusterServiceVersion) HasCAResources() bool { } // Conditions appear in the status as a record of state transitions on the ClusterServiceVersion +// +k8s:openapi-gen=true type ClusterServiceVersionCondition struct { // Condition of the ClusterServiceVersion Phase ClusterServiceVersionPhase `json:"phase,omitempty"` @@ -473,6 +484,7 @@ const ( ) // DependentStatus is the status for a dependent requirement (to prevent infinite nesting) +// +k8s:openapi-gen=true type DependentStatus struct { Group string `json:"group"` Version string `json:"version"` @@ -482,6 +494,7 @@ type DependentStatus struct { Message string `json:"message,omitempty"` } +// +k8s:openapi-gen=true type RequirementStatus struct { Group string `json:"group"` Version string `json:"version"` @@ -495,6 +508,7 @@ type RequirementStatus struct { // ClusterServiceVersionStatus represents information about the status of a CSV. Status may trail the actual // state of a system. +// +k8s:openapi-gen=true type ClusterServiceVersionStatus struct { // Current condition of the ClusterServiceVersion Phase ClusterServiceVersionPhase `json:"phase,omitempty"` @@ -527,6 +541,7 @@ type ClusterServiceVersionStatus struct { } // CleanupStatus represents information about the status of cleanup while a CSV is pending deletion +// +k8s:openapi-gen=true type CleanupStatus struct { // PendingDeletion is the list of custom resource objects that are pending deletion and blocked on finalizers. // This indicates the progress of cleanup that is blocking CSV deletion or operator uninstall. @@ -535,12 +550,14 @@ type CleanupStatus struct { } // ResourceList represents a list of resources which are of the same Group/Kind +// +k8s:openapi-gen=true type ResourceList struct { Group string `json:"group"` Kind string `json:"kind"` Instances []ResourceInstance `json:"instances"` } +// +k8s:openapi-gen=true type ResourceInstance struct { Name string `json:"name"` // Namespace can be empty for cluster-scoped resources