diff --git a/Makefile b/Makefile index c9c1431407e..6d664ef34fe 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,7 @@ $(call add-crd-gen,machine-beta,./machine/v1beta1,./machine/v1beta1,./machine/v1 $(call add-crd-gen,machine,./machine/v1,./machine/v1,./machine/v1) $(call add-crd-gen,monitoring-alpha,./monitoring/v1alpha1,./monitoring/v1alpha1,./monitoring/v1alpha1) $(call add-crd-gen,route,./route/v1,./route/v1,./route/v1) +$(call add-crd-gen,platform,./platform/v1alpha1,./platform/v1alpha1,./platform/v1alpha1) RUNTIME ?= podman RUNTIME_IMAGE_NAME ?= registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.18-openshift-4.12 diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index 1c47df76a6f..6c1f358381a 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -905,6 +905,12 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/openshift/api/osin/v1.SessionSecret": schema_openshift_api_osin_v1_SessionSecret(ref), "github.com/openshift/api/osin/v1.SessionSecrets": schema_openshift_api_osin_v1_SessionSecrets(ref), "github.com/openshift/api/osin/v1.TokenConfig": schema_openshift_api_osin_v1_TokenConfig(ref), + "github.com/openshift/api/platform/v1alpha1.ActiveBundleDeployment": schema_openshift_api_platform_v1alpha1_ActiveBundleDeployment(ref), + "github.com/openshift/api/platform/v1alpha1.Package": schema_openshift_api_platform_v1alpha1_Package(ref), + "github.com/openshift/api/platform/v1alpha1.PlatformOperator": schema_openshift_api_platform_v1alpha1_PlatformOperator(ref), + "github.com/openshift/api/platform/v1alpha1.PlatformOperatorList": schema_openshift_api_platform_v1alpha1_PlatformOperatorList(ref), + "github.com/openshift/api/platform/v1alpha1.PlatformOperatorSpec": schema_openshift_api_platform_v1alpha1_PlatformOperatorSpec(ref), + "github.com/openshift/api/platform/v1alpha1.PlatformOperatorStatus": schema_openshift_api_platform_v1alpha1_PlatformOperatorStatus(ref), "github.com/openshift/api/project/v1.Project": schema_openshift_api_project_v1_Project(ref), "github.com/openshift/api/project/v1.ProjectList": schema_openshift_api_project_v1_ProjectList(ref), "github.com/openshift/api/project/v1.ProjectRequest": schema_openshift_api_project_v1_ProjectRequest(ref), @@ -46541,6 +46547,216 @@ func schema_openshift_api_osin_v1_TokenConfig(ref common.ReferenceCallback) comm } } +func schema_openshift_api_platform_v1alpha1_ActiveBundleDeployment(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ActiveBundleDeployment references a BundleDeployment resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the metadata.name of the referenced BundleDeployment object.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + } +} + +func schema_openshift_api_platform_v1alpha1_Package(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Package contains fields to configure which OLM package this PlatformOperator will install", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name contains the desired OLM-based Operator package name that is defined in an existing CatalogSource resource in the cluster.\n\nThis configured package will be managed with the cluster's lifecycle. In the current implementation, it will be retrieving this name from a list of supported operators out of the catalogs included with OpenShift.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + } +} + +func schema_openshift_api_platform_v1alpha1_PlatformOperator(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PlatformOperator is the Schema for the PlatformOperators API.\n\nCompatibility 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.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/openshift/api/platform/v1alpha1.PlatformOperatorSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/openshift/api/platform/v1alpha1.PlatformOperatorStatus"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "github.com/openshift/api/platform/v1alpha1.PlatformOperatorSpec", "github.com/openshift/api/platform/v1alpha1.PlatformOperatorStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_openshift_api_platform_v1alpha1_PlatformOperatorList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PlatformOperatorList contains a list of PlatformOperators\n\nCompatibility 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.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/openshift/api/platform/v1alpha1.PlatformOperator"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/openshift/api/platform/v1alpha1.PlatformOperator", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_openshift_api_platform_v1alpha1_PlatformOperatorSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PlatformOperatorSpec defines the desired state of PlatformOperator.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "package": { + SchemaProps: spec.SchemaProps{ + Description: "package contains the desired package and its configuration for this PlatformOperator.", + Default: map[string]interface{}{}, + Ref: ref("github.com/openshift/api/platform/v1alpha1.Package"), + }, + }, + }, + Required: []string{"package"}, + }, + }, + Dependencies: []string{ + "github.com/openshift/api/platform/v1alpha1.Package"}, + } +} + +func schema_openshift_api_platform_v1alpha1_PlatformOperatorStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PlatformOperatorStatus defines the observed state of PlatformOperator", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "conditions represent the latest available observations of a platform operator's current state.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"), + }, + }, + }, + }, + }, + "activeBundleDeployment": { + SchemaProps: spec.SchemaProps{ + Description: "activeBundleDeployment is the reference to the BundleDeployment resource that's being managed by this PO resource. If this field is not populated in the status then it means the PlatformOperator has either not been installed yet or is failing to install.", + Default: map[string]interface{}{}, + Ref: ref("github.com/openshift/api/platform/v1alpha1.ActiveBundleDeployment"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/openshift/api/platform/v1alpha1.ActiveBundleDeployment", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"}, + } +} + func schema_openshift_api_project_v1_Project(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/openapi/openapi.json b/openapi/openapi.json index c597f739d97..b4a25a791ae 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -27416,6 +27416,130 @@ } } }, + "com.github.openshift.api.platform.v1alpha1.ActiveBundleDeployment": { + "description": "ActiveBundleDeployment references a BundleDeployment resource.", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "name is the metadata.name of the referenced BundleDeployment object.", + "type": "string", + "default": "" + } + } + }, + "com.github.openshift.api.platform.v1alpha1.Package": { + "description": "Package contains fields to configure which OLM package this PlatformOperator will install", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "name contains the desired OLM-based Operator package name that is defined in an existing CatalogSource resource in the cluster.\n\nThis configured package will be managed with the cluster's lifecycle. In the current implementation, it will be retrieving this name from a list of supported operators out of the catalogs included with OpenShift.", + "type": "string", + "default": "" + } + } + }, + "com.github.openshift.api.platform.v1alpha1.PlatformOperator": { + "description": "PlatformOperator is the Schema for the PlatformOperators API.\n\nCompatibility 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.", + "type": "object", + "required": [ + "spec" + ], + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "default": {}, + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.platform.v1alpha1.PlatformOperatorSpec" + }, + "status": { + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.platform.v1alpha1.PlatformOperatorStatus" + } + } + }, + "com.github.openshift.api.platform.v1alpha1.PlatformOperatorList": { + "description": "PlatformOperatorList contains a list of PlatformOperators\n\nCompatibility 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.", + "type": "object", + "required": [ + "items" + ], + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "items": { + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.platform.v1alpha1.PlatformOperator" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "default": {}, + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + } + }, + "com.github.openshift.api.platform.v1alpha1.PlatformOperatorSpec": { + "description": "PlatformOperatorSpec defines the desired state of PlatformOperator.", + "type": "object", + "required": [ + "package" + ], + "properties": { + "package": { + "description": "package contains the desired package and its configuration for this PlatformOperator.", + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.platform.v1alpha1.Package" + } + } + }, + "com.github.openshift.api.platform.v1alpha1.PlatformOperatorStatus": { + "description": "PlatformOperatorStatus defines the observed state of PlatformOperator", + "type": "object", + "properties": { + "activeBundleDeployment": { + "description": "activeBundleDeployment is the reference to the BundleDeployment resource that's being managed by this PO resource. If this field is not populated in the status then it means the PlatformOperator has either not been installed yet or is failing to install.", + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.platform.v1alpha1.ActiveBundleDeployment" + }, + "conditions": { + "description": "conditions represent the latest available observations of a platform operator's current state.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Condition" + }, + "x-kubernetes-list-map-keys": [ + "type" + ], + "x-kubernetes-list-type": "map", + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge" + } + } + }, "com.github.openshift.api.project.v1.Project": { "description": "Projects are the unit of isolation and collaboration in OpenShift. A project has one or more members, a quota on the resources that the project may consume, and the security controls on the resources in the project. Within a project, members may have different roles - project administrators can set membership, editors can create and manage the resources, and viewers can see but not access running containers. In a normal cluster project administrators are not able to alter their quotas - that is restricted to cluster administrators.\n\nListing or watching projects will return only projects the user has the reader role on.\n\nAn OpenShift project is an alternative representation of a Kubernetes namespace. Projects are exposed as editable to end users while namespaces are not. Direct creation of a project is typically restricted to administrators, while end users should use the requestproject resource.\n\nCompatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).", "type": "object", diff --git a/platform/install.go b/platform/install.go new file mode 100644 index 00000000000..624a5e0c4e2 --- /dev/null +++ b/platform/install.go @@ -0,0 +1,28 @@ +package platform + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + platformv1alpha1 "github.com/openshift/api/platform/v1alpha1" +) + +const ( + GroupName = "platform.openshift.io" +) + +var ( + schemeBuilder = runtime.NewSchemeBuilder( + platformv1alpha1.Install, + ) + // Install is a function which adds every version of this group to a scheme + Install = schemeBuilder.AddToScheme +) + +func Resource(resource string) schema.GroupResource { + return schema.GroupResource{Group: GroupName, Resource: resource} +} + +func Kind(kind string) schema.GroupKind { + return schema.GroupKind{Group: GroupName, Kind: kind} +} diff --git a/platform/v1alpha1/doc.go b/platform/v1alpha1/doc.go new file mode 100644 index 00000000000..46e077f490f --- /dev/null +++ b/platform/v1alpha1/doc.go @@ -0,0 +1,7 @@ +// +k8s:deepcopy-gen=package,register +// +k8s:defaulter-gen=TypeMeta +// +k8s:openapi-gen=true + +// +groupName=platform.openshift.io +// Package v1alpha1 is the v1alpha1 version of the API. +package v1alpha1 diff --git a/platform/v1alpha1/platformoperators.crd.yaml b/platform/v1alpha1/platformoperators.crd.yaml new file mode 100644 index 00000000000..f5a37f2efc4 --- /dev/null +++ b/platform/v1alpha1/platformoperators.crd.yaml @@ -0,0 +1,114 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + release.openshift.io/feature-gate: TechPreviewNoUpgrade + api-approved.openshift.io: https://github.com/openshift/api/pull/1234 + creationTimestamp: null + name: platformoperators.platform.openshift.io +spec: + group: platform.openshift.io + names: + kind: PlatformOperator + listKind: PlatformOperatorList + plural: platformoperators + singular: platformoperator + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: "PlatformOperator is the Schema for the PlatformOperators API. \n 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." + type: object + required: + - spec + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: PlatformOperatorSpec defines the desired state of PlatformOperator. + type: object + required: + - package + properties: + package: + description: package contains the desired package and its configuration for this PlatformOperator. + type: object + required: + - name + properties: + name: + description: "name contains the desired OLM-based Operator package name that is defined in an existing CatalogSource resource in the cluster. \n This configured package will be managed with the cluster's lifecycle. In the current implementation, it will be retrieving this name from a list of supported operators out of the catalogs included with OpenShift. \n ---" + type: string + maxLength: 56 + pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?' + status: + description: PlatformOperatorStatus defines the observed state of PlatformOperator + type: object + properties: + activeBundleDeployment: + description: activeBundleDeployment is the reference to the BundleDeployment resource that's being managed by this PO resource. If this field is not populated in the status then it means the PlatformOperator has either not been installed yet or is failing to install. + type: object + required: + - name + properties: + name: + description: name is the metadata.name of the referenced BundleDeployment object. + type: string + conditions: + description: conditions represent the latest available observations of a platform operator's current state. + type: array + items: + description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" + type: object + required: + - lastTransitionTime + - message + - reason + - status + - type + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + type: string + format: date-time + message: + description: message is a human readable message indicating details about the transition. This may be an empty string. + type: string + maxLength: 32768 + observedGeneration: + description: observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + type: integer + format: int64 + minimum: 0 + reason: + description: reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + type: string + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + status: + description: status of the condition, one of True, False, Unknown. + type: string + enum: + - "True" + - "False" + - Unknown + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + type: string + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + served: true + storage: true + subresources: + status: {} diff --git a/platform/v1alpha1/register.go b/platform/v1alpha1/register.go new file mode 100644 index 00000000000..17abfd7229c --- /dev/null +++ b/platform/v1alpha1/register.go @@ -0,0 +1,25 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + GroupName = "platform.openshift.io" + GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // Install is a function which adds this version to a scheme + Install = schemeBuilder.AddToScheme +) + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(GroupVersion, + &PlatformOperator{}, + &PlatformOperatorList{}, + ) + metav1.AddToGroupVersion(scheme, GroupVersion) + return nil +} diff --git a/platform/v1alpha1/types.go b/platform/v1alpha1/types.go new file mode 100644 index 00000000000..0c67988f2e2 --- /dev/null +++ b/platform/v1alpha1/types.go @@ -0,0 +1,87 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Package contains fields to configure which OLM package this PlatformOperator will install +type Package struct { + // name contains the desired OLM-based Operator package name + // that is defined in an existing CatalogSource resource in the cluster. + // + // This configured package will be managed with the cluster's lifecycle. In + // the current implementation, it will be retrieving this name from a list of + // supported operators out of the catalogs included with OpenShift. + // +kubebuilder:validation:Required + // + // +kubebuilder:validation:Pattern:=[a-z0-9]([-a-z0-9]*[a-z0-9])? + // +kubebuilder:validation:MaxLength:=56 + // --- + // + More restrictions to package names supported is an intentional design + // + decision that, while limiting to user options, allows code built on these + // + API's to make more confident assumptions on data structure. + Name string `json:"name"` +} + +// PlatformOperatorSpec defines the desired state of PlatformOperator. +type PlatformOperatorSpec struct { + // package contains the desired package and its configuration for this + // PlatformOperator. + // +kubebuilder:validation:Required + Package Package `json:"package"` +} + +// ActiveBundleDeployment references a BundleDeployment resource. +type ActiveBundleDeployment struct { + // name is the metadata.name of the referenced BundleDeployment object. + // +kubebuilder:validation:Required + Name string `json:"name"` +} + +// PlatformOperatorStatus defines the observed state of PlatformOperator +type PlatformOperatorStatus struct { + // conditions represent the latest available observations of a platform operator's current state. + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` + + // activeBundleDeployment is the reference to the BundleDeployment resource that's + // being managed by this PO resource. If this field is not populated in the status + // then it means the PlatformOperator has either not been installed yet or is + // failing to install. + // +optional + ActiveBundleDeployment ActiveBundleDeployment `json:"activeBundleDeployment,omitempty"` +} + +// +genclient +// +genclient:nonNamespaced +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PlatformOperator is the Schema for the PlatformOperators API. +// +// 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. +// +openshift:compatibility-gen:level=4 +type PlatformOperator struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec PlatformOperatorSpec `json:"spec"` + Status PlatformOperatorStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PlatformOperatorList contains a list of PlatformOperators +// +// 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. +// +openshift:compatibility-gen:level=4 +type PlatformOperatorList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []PlatformOperator `json:"items"` +} diff --git a/platform/v1alpha1/zz_generated.deepcopy.go b/platform/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..a230ef413b6 --- /dev/null +++ b/platform/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,145 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ActiveBundleDeployment) DeepCopyInto(out *ActiveBundleDeployment) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ActiveBundleDeployment. +func (in *ActiveBundleDeployment) DeepCopy() *ActiveBundleDeployment { + if in == nil { + return nil + } + out := new(ActiveBundleDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Package) DeepCopyInto(out *Package) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Package. +func (in *Package) DeepCopy() *Package { + if in == nil { + return nil + } + out := new(Package) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlatformOperator) DeepCopyInto(out *PlatformOperator) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformOperator. +func (in *PlatformOperator) DeepCopy() *PlatformOperator { + if in == nil { + return nil + } + out := new(PlatformOperator) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PlatformOperator) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlatformOperatorList) DeepCopyInto(out *PlatformOperatorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PlatformOperator, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformOperatorList. +func (in *PlatformOperatorList) DeepCopy() *PlatformOperatorList { + if in == nil { + return nil + } + out := new(PlatformOperatorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PlatformOperatorList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlatformOperatorSpec) DeepCopyInto(out *PlatformOperatorSpec) { + *out = *in + out.Package = in.Package + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformOperatorSpec. +func (in *PlatformOperatorSpec) DeepCopy() *PlatformOperatorSpec { + if in == nil { + return nil + } + out := new(PlatformOperatorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlatformOperatorStatus) DeepCopyInto(out *PlatformOperatorStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + out.ActiveBundleDeployment = in.ActiveBundleDeployment + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformOperatorStatus. +func (in *PlatformOperatorStatus) DeepCopy() *PlatformOperatorStatus { + if in == nil { + return nil + } + out := new(PlatformOperatorStatus) + in.DeepCopyInto(out) + return out +} diff --git a/platform/v1alpha1/zz_generated.swagger_doc_generated.go b/platform/v1alpha1/zz_generated.swagger_doc_generated.go new file mode 100644 index 00000000000..0271c2dd279 --- /dev/null +++ b/platform/v1alpha1/zz_generated.swagger_doc_generated.go @@ -0,0 +1,67 @@ +package v1alpha1 + +// This file contains a collection of methods that can be used from go-restful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-swagger-docs.sh + +// AUTO-GENERATED FUNCTIONS START HERE +var map_ActiveBundleDeployment = map[string]string{ + "": "ActiveBundleDeployment references a BundleDeployment resource.", + "name": "name is the metadata.name of the referenced BundleDeployment object.", +} + +func (ActiveBundleDeployment) SwaggerDoc() map[string]string { + return map_ActiveBundleDeployment +} + +var map_Package = map[string]string{ + "": "Package contains fields to configure which OLM package this PlatformOperator will install", + "name": "name contains the desired OLM-based Operator package name that is defined in an existing CatalogSource resource in the cluster.\n\nThis configured package will be managed with the cluster's lifecycle. In the current implementation, it will be retrieving this name from a list of supported operators out of the catalogs included with OpenShift.", +} + +func (Package) SwaggerDoc() map[string]string { + return map_Package +} + +var map_PlatformOperator = map[string]string{ + "": "PlatformOperator is the Schema for the PlatformOperators API.\n\nCompatibility 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.", +} + +func (PlatformOperator) SwaggerDoc() map[string]string { + return map_PlatformOperator +} + +var map_PlatformOperatorList = map[string]string{ + "": "PlatformOperatorList contains a list of PlatformOperators\n\nCompatibility 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.", +} + +func (PlatformOperatorList) SwaggerDoc() map[string]string { + return map_PlatformOperatorList +} + +var map_PlatformOperatorSpec = map[string]string{ + "": "PlatformOperatorSpec defines the desired state of PlatformOperator.", + "package": "package contains the desired package and its configuration for this PlatformOperator.", +} + +func (PlatformOperatorSpec) SwaggerDoc() map[string]string { + return map_PlatformOperatorSpec +} + +var map_PlatformOperatorStatus = map[string]string{ + "": "PlatformOperatorStatus defines the observed state of PlatformOperator", + "conditions": "conditions represent the latest available observations of a platform operator's current state.", + "activeBundleDeployment": "activeBundleDeployment is the reference to the BundleDeployment resource that's being managed by this PO resource. If this field is not populated in the status then it means the PlatformOperator has either not been installed yet or is failing to install.", +} + +func (PlatformOperatorStatus) SwaggerDoc() map[string]string { + return map_PlatformOperatorStatus +} + +// AUTO-GENERATED FUNCTIONS END HERE