diff --git a/apis/objectstorage.k8s.io/v1alpha1/openapi_generated.go b/apis/objectstorage.k8s.io/v1alpha1/openapi_generated.go index bc939b56..dc5f3da7 100644 --- a/apis/objectstorage.k8s.io/v1alpha1/openapi_generated.go +++ b/apis/objectstorage.k8s.io/v1alpha1/openapi_generated.go @@ -29,7 +29,6 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.AnonymousAccessMode": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_AnonymousAccessMode(ref), "sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.AzureProtocol": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_AzureProtocol(ref), "sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Bucket": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_Bucket(ref), "sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccess": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_BucketAccess(ref), @@ -57,42 +56,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA } } -func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_AnonymousAccessMode(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "private": { - SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", - }, - }, - "publicReadOnly": { - SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", - }, - }, - "publicReadWrite": { - SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", - }, - }, - "publicWriteOnly": { - SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", - }, - }, - }, - }, - }, - } -} - func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_AzureProtocol(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -139,17 +102,20 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), }, }, "spec": { SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketSpec"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketStatus"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketStatus"), }, }, }, @@ -182,17 +148,20 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), }, }, "spec": { SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessSpec"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessStatus"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessStatus"), }, }, }, @@ -225,13 +194,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "provisioner": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), }, }, "policyActionsConfigMap": { @@ -246,8 +210,9 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Allows: true, Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -283,7 +248,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), }, }, "items": { @@ -292,7 +258,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessClass"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessClass"), }, }, }, @@ -329,7 +296,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), }, }, "items": { @@ -338,7 +306,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccess"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccess"), }, }, }, @@ -375,17 +344,20 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), }, }, "spec": { SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessRequestSpec"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessRequestSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessRequestStatus"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessRequestStatus"), }, }, }, @@ -418,7 +390,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), }, }, "items": { @@ -427,7 +400,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessRequest"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketAccessRequest"), }, }, }, @@ -456,14 +430,16 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "bucketRequestName": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: "", + Type: []string{"string"}, + Format: "", }, }, "bucketAccessClassName": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: "", + Type: []string{"string"}, + Format: "", }, }, "bucketAccessName": { @@ -493,8 +469,9 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "accessGranted": { SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", + Default: false, + Type: []string{"boolean"}, + Format: "", }, }, }, @@ -509,6 +486,12 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp SchemaProps: spec.SchemaProps{ Type: []string{"object"}, Properties: map[string]spec.Schema{ + "provisioner": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, "bucketInstanceName": { SchemaProps: spec.SchemaProps{ Type: []string{"string"}, @@ -543,12 +526,6 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Format: "", }, }, - "provisioner": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, "parameters": { SchemaProps: spec.SchemaProps{ Type: []string{"object"}, @@ -556,8 +533,9 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Allows: true, Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -617,7 +595,14 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "provisioner": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", }, }, "isDefaultBucketClass": { @@ -637,8 +622,9 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -646,15 +632,11 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "protocol": { SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Protocol"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Protocol"), }, }, - "anonymousAccessMode": { - SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.AnonymousAccessMode"), - }, - }, - "retentionPolicy": { + "deletionPolicy": { SchemaProps: spec.SchemaProps{ Type: []string{"string"}, Format: "", @@ -667,25 +649,20 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Allows: true, Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: "", + Type: []string{"string"}, + Format: "", }, }, }, }, }, - "provisioner": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, }, Required: []string{"protocol"}, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.AnonymousAccessMode", "sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Protocol"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Protocol"}, } } @@ -711,7 +688,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), }, }, "items": { @@ -720,7 +698,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketClass"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketClass"), }, }, }, @@ -757,7 +736,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), }, }, "items": { @@ -766,7 +746,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Bucket"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Bucket"), }, }, }, @@ -803,17 +784,20 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), }, }, "spec": { SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketRequestSpec"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketRequestSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketRequestStatus"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketRequestStatus"), }, }, }, @@ -846,7 +830,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "metadata": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), }, }, "items": { @@ -855,7 +840,8 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketRequest"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketRequest"), }, }, }, @@ -914,8 +900,9 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "bucketAvailable": { SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", + Default: false, + Type: []string{"boolean"}, + Format: "", }, }, }, @@ -936,17 +923,6 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Format: "", }, }, - "retentionPolicy": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - "anonymousAccessMode": { - SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.AnonymousAccessMode"), - }, - }, "bucketClassName": { SchemaProps: spec.SchemaProps{ Type: []string{"string"}, @@ -969,8 +945,9 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -978,7 +955,14 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, "protocol": { SchemaProps: spec.SchemaProps{ - Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Protocol"), + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Protocol"), + }, + }, + "bucketID": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", }, }, "parameters": { @@ -988,19 +972,27 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp Allows: true, Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Default: "", + Type: []string{"string"}, + Format: "", }, }, }, }, }, + "deletionPolicy": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, }, - Required: []string{"retentionPolicy", "protocol"}, + Required: []string{"protocol", "deletionPolicy"}, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.ObjectReference", "sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.AnonymousAccessMode", "sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Protocol"}, + "k8s.io/api/core/v1.ObjectReference", "sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Protocol"}, } } @@ -1070,18 +1062,6 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp SchemaProps: spec.SchemaProps{ Type: []string{"object"}, Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - "version": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, "s3": { SchemaProps: spec.SchemaProps{ Ref: ref("sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.S3Protocol"), @@ -1098,7 +1078,6 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp }, }, }, - Required: []string{"name"}, }, }, Dependencies: []string{ diff --git a/apis/objectstorage.k8s.io/v1alpha1/protocol_types.go b/apis/objectstorage.k8s.io/v1alpha1/protocol_types.go index 28a601be..a2fabd61 100644 --- a/apis/objectstorage.k8s.io/v1alpha1/protocol_types.go +++ b/apis/objectstorage.k8s.io/v1alpha1/protocol_types.go @@ -19,7 +19,7 @@ package v1alpha1 import ( "errors" - osspec "sigs.k8s.io/container-object-storage-interface-spec" + cosi "sigs.k8s.io/container-object-storage-interface-spec" ) type ProtocolName string @@ -29,84 +29,62 @@ const ( ProtocolNameAzure ProtocolName = "azureBlob" ProtocolNameGCS ProtocolName = "gcs" - MissingS3Protocol = "missing s3 in protocol" - MissingAzureProtocol = "missing azure in protocol" - MissingGCSProtocol = "missing gcs in protocol" - InvalidProtocolName = "invalid protocol name" + InvalidProtocol = "invalid protocol" ) type Protocol struct { - // +kubebuilder:validation:Enum:={s3,azureBlob,gcs} - Name ProtocolName `json:"name"` - // +optional - Version string `json:"version,omitempty"` // +optional S3 *S3Protocol `json:"s3,omitempty"` + // +optional AzureBlob *AzureProtocol `json:"azureBlob,omitempty"` + // +optional GCS *GCSProtocol `json:"gcs,omitempty"` } -func (in *Protocol) ConvertToExternal() (*osspec.Protocol, error) { - external := &osspec.Protocol{ - Version: in.Version, - } +func (in *Protocol) ConvertToExternal() (*cosi.Protocol, error) { + external := &cosi.Protocol{} - switch in.Name { - case ProtocolNameS3: - if in.S3 == nil { - return nil, errors.New(MissingS3Protocol) - } - external.Name = osspec.ProtocolName_S3 + protoFound := false + if in.S3 != nil { + protoFound = true external.Type = in.S3.ConvertToExternal() - case ProtocolNameAzure: - if in.AzureBlob == nil { - return nil, errors.New(MissingAzureProtocol) - } - external.Name = osspec.ProtocolName_AZURE + } + if in.AzureBlob != nil { + protoFound = true external.Type = in.AzureBlob.ConvertToExternal() - case ProtocolNameGCS: - if in.GCS == nil { - return nil, errors.New(MissingGCSProtocol) - } - external.Name = osspec.ProtocolName_GCS + } + if in.GCS != nil { + protoFound = true external.Type = in.GCS.ConvertToExternal() - default: - external.Name = osspec.ProtocolName_UnknownProtocol - return external, errors.New(InvalidProtocolName) + } + if !protoFound { + return external, errors.New(InvalidProtocol) } return external, nil } -func ConvertFromProtocolExternal(external *osspec.Protocol) (*Protocol, error) { +func ConvertFromProtocolExternal(external *cosi.Protocol) (*Protocol, error) { in := &Protocol{} - in.Version = external.Version - - switch external.Name { - case osspec.ProtocolName_S3: - if external.GetS3() == nil { - return nil, errors.New(MissingS3Protocol) - } - in.Name = ProtocolNameS3 + + protoFound := false + if external.GetS3() != nil { + protoFound = true in.S3 = ConvertFromS3External(external.GetS3()) - case osspec.ProtocolName_AZURE: - if external.GetAzureBlob() == nil { - return nil, errors.New(MissingAzureProtocol) - } - in.Name = ProtocolNameAzure + } + if external.GetAzureBlob() != nil { + protoFound = true in.AzureBlob = ConvertFromAzureExternal(external.GetAzureBlob()) - case osspec.ProtocolName_GCS: - if external.GetGcs() == nil { - return nil, errors.New(MissingGCSProtocol) - } - in.Name = ProtocolNameGCS + } + if external.GetGcs() != nil { + protoFound = true in.GCS = ConvertFromGCSExternal(external.GetGcs()) - default: - // TODO - Do we to set the protocol Name to specific value here? - return nil, errors.New(InvalidProtocolName) + } + if !protoFound { + return nil, errors.New(InvalidProtocol) } return in, nil diff --git a/apis/objectstorage.k8s.io/v1alpha1/types.go b/apis/objectstorage.k8s.io/v1alpha1/types.go index e9ae280f..9ba4ff2e 100644 --- a/apis/objectstorage.k8s.io/v1alpha1/types.go +++ b/apis/objectstorage.k8s.io/v1alpha1/types.go @@ -21,63 +21,82 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -type BucketRequestSpec struct { - // +optional - BucketInstanceName string `json:"bucketInstanceName,omitempty"` - // +optional - BucketPrefix string `json:"bucketPrefix,omitempty"` - // +optional - BucketClassName string `json:"bucketClassName,omitempty"` -} +func init() { + SchemeBuilder.Register(&Bucket{}, &BucketList{}) + SchemeBuilder.Register(&BucketRequest{}, &BucketRequestList{}) + SchemeBuilder.Register(&BucketClass{}, &BucketClassList{}) -type BucketRequestStatus struct { - // +optional - Message string `json:"message,omitempty"` - // +optional - BucketAvailable bool `json:"bucketAvailable"` + SchemeBuilder.Register(&BucketAccess{}, &BucketAccessList{}) + SchemeBuilder.Register(&BucketAccessRequest{}, &BucketAccessRequestList{}) + SchemeBuilder.Register(&BucketAccessClass{}, &BucketAccessClassList{}) } -type AnonymousAccessMode struct { - // +optional - Private bool `json:"private,omitempty"` - // +optional - PublicReadOnly bool `json:"publicReadOnly,omitempty"` +type DeletionPolicy string + +const ( + DeletionPolicyRetain DeletionPolicy = "Retain" + DeletionPolicyDelete DeletionPolicy = "Delete" + DeletionPolicyForceDelete DeletionPolicy = "Force" +) + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:storageversion +// +kubebuilder:subresource:status + +type Bucket struct { + metav1.TypeMeta `json:",inline"` // +optional - PublicReadWrite bool `json:"publicReadWrite,omitempty"` + + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec BucketSpec `json:"spec,omitempty"` + // +optional - PublicWriteOnly bool `json:"publicWriteOnly,omitempty"` + Status BucketStatus `json:"status,omitempty"` } type BucketSpec struct { // +optional Provisioner string `json:"provisioner,omitempty"` - // +kubebuilder:default:=retain - RetentionPolicy RetentionPolicy `json:"retentionPolicy"` - // +optional - AnonymousAccessMode AnonymousAccessMode `json:"anonymousAccessMode,omitempty"` + // +optional - BucketClassName string `json:"bucketClassName,omitempty"` - BucketRequest *corev1.ObjectReference `json:"bucketRequest,omitempty"` + BucketClassName string `json:"bucketClassName,omitempty"` + + BucketRequest *corev1.ObjectReference `json:"bucketRequest,omitempty"` + // +listType=atomic AllowedNamespaces []string `json:"allowedNamespaces,omitempty"` - Protocol Protocol `json:"protocol"` + + Protocol Protocol `json:"protocol"` + + // +optional + BucketID string `json:"bucketID,omitempty"` + // +optional Parameters map[string]string `json:"parameters,omitempty"` + + // +kubebuilder:default:=retain + DeletionPolicy DeletionPolicy `json:"deletionPolicy"` } type BucketStatus struct { // +optional Message string `json:"message,omitempty"` + // +optional BucketAvailable bool `json:"bucketAvailable,omitempty"` } -type RetentionPolicy string +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -const ( - RetentionPolicyRetain RetentionPolicy = "Retain" - RetentionPolicyDelete RetentionPolicy = "Delete" -) +type BucketList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Bucket `json:"items"` +} // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -88,42 +107,40 @@ const ( type BucketRequest struct { metav1.TypeMeta `json:",inline"` // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` - Spec BucketRequestSpec `json:"spec,omitempty"` + + Spec BucketRequestSpec `json:"spec,omitempty"` + // +optional Status BucketRequestStatus `json:"status,omitempty"` } -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type BucketRequestSpec struct { + // +optional + BucketInstanceName string `json:"bucketInstanceName,omitempty"` -type BucketRequestList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []BucketRequest `json:"items"` -} + // +optional + BucketPrefix string `json:"bucketPrefix,omitempty"` -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:scope=Cluster -// +kubebuilder:storageversion -// +kubebuilder:subresource:status + // +optional + BucketClassName string `json:"bucketClassName,omitempty"` +} -type Bucket struct { - metav1.TypeMeta `json:",inline"` +type BucketRequestStatus struct { // +optional - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec BucketSpec `json:"spec,omitempty"` + Message string `json:"message,omitempty"` + // +optional - Status BucketStatus `json:"status,omitempty"` + BucketAvailable bool `json:"bucketAvailable"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type BucketList struct { +type BucketRequestList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []Bucket `json:"items"` + Items []BucketRequest `json:"items"` } // +genclient @@ -135,24 +152,27 @@ type BucketList struct { type BucketClass struct { metav1.TypeMeta `json:",inline"` + // +optional metav1.ObjectMeta `json:"metadata,omitempty"` + Provisioner string `json:"provisioner,omitempty"` + // +optional // +kubebuilder:default:=false IsDefaultBucketClass bool `json:"isDefaultBucketClass,omitempty"` + // +listType=atomic // +optional AllowedNamespaces []string `json:"allowedNamespaces,omitempty"` - Protocol Protocol `json:"protocol"` - // +optional - AnonymousAccessMode AnonymousAccessMode `json:"anonymousAccessMode,omitempty"` + + Protocol Protocol `json:"protocol"` + // +kubebuilder:default:=retain - RetentionPolicy RetentionPolicy `json:"retentionPolicy,omitempty"` + DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty"` + // +optional Parameters map[string]string `json:"parameters,omitempty"` - // +optional - Provisioner string `json:"provisioner,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -172,11 +192,12 @@ type BucketClassList struct { type BucketAccessClass struct { metav1.TypeMeta `json:",inline"` + // +optional metav1.ObjectMeta `json:"metadata,omitempty"` - // +optional - Provisioner string `json:"provisioner,omitempty"` + PolicyActionsConfigMap *corev1.ObjectReference `json:"policyActionsConfigMap,omitempty"` + // +optional Parameters map[string]string `json:"parameters,omitempty"` } @@ -189,20 +210,46 @@ type BucketAccessClassList struct { Items []BucketAccessClass `json:"items"` } +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:storageversion +// +kubebuilder:subresource:status + +type BucketAccess struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec BucketAccessSpec `json:"spec,omitempty"` + + // +optional + Status BucketAccessStatus `json:"status"` +} + type BucketAccessSpec struct { + // +optional + Provisioner string `json:"provisioner,omitempty"` + // +optional BucketInstanceName string `json:"bucketInstanceName,omitempty"` + // +optional BucketAccessRequest *corev1.ObjectReference `json:"bucketAccessRequest,omitempty"` + // +optional ServiceAccount *corev1.ObjectReference `json:"serviceAccount,omitempty"` + // +optional - MintedSecretName string `json:"mintedSecretName,omitempty"` + MintedSecretName string `json:"mintedSecretName,omitempty"` + PolicyActionsConfigMapData string `json:"policyActionsConfigMapData,omitempty"` + // +optional Principal string `json:"principal,omitempty"` - // +optional - Provisioner string `json:"provisioner,omitempty"` + // +optional Parameters map[string]string `json:"parameters,omitempty"` } @@ -210,39 +257,45 @@ type BucketAccessSpec struct { type BucketAccessStatus struct { // +optional Message string `json:"message,omitempty"` + // +optional AccessGranted bool `json:"accessGranted,omitempty"` } +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type BucketAccessList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []BucketAccess `json:"items"` +} + // +genclient -// +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:scope=Cluster +// +kubebuilder:resource:scope=Namespaced // +kubebuilder:storageversion // +kubebuilder:subresource:status -type BucketAccess struct { +type BucketAccessRequest struct { metav1.TypeMeta `json:",inline"` + // +optional metav1.ObjectMeta `json:"metadata,omitempty"` - Spec BucketAccessSpec `json:"spec,omitempty"` - // +optional - Status BucketAccessStatus `json:"status"` -} -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + Spec BucketAccessRequestSpec `json:"spec,omitempty"` -type BucketAccessList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []BucketAccess `json:"items"` + // +optional + Status BucketAccessRequestStatus `json:"status"` } type BucketAccessRequestSpec struct { // +optional - ServiceAccountName string `json:"serviceAccountName,omitempty"` - BucketRequestName string `json:"bucketRequestName"` + ServiceAccountName string `json:"serviceAccountName,omitempty"` + + BucketRequestName string `json:"bucketRequestName"` + BucketAccessClassName string `json:"bucketAccessClassName"` + // +optional BucketAccessName string `json:"bucketAccessName,omitempty"` } @@ -250,23 +303,9 @@ type BucketAccessRequestSpec struct { type BucketAccessRequestStatus struct { // +optional Message string `json:"message,omitempty"` - // +optional - AccessGranted bool `json:"accessGranted"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:scope=Namespaced -// +kubebuilder:storageversion -// +kubebuilder:subresource:status -type BucketAccessRequest struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec BucketAccessRequestSpec `json:"spec,omitempty"` // +optional - Status BucketAccessRequestStatus `json:"status"` + AccessGranted bool `json:"accessGranted"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -276,13 +315,3 @@ type BucketAccessRequestList struct { metav1.ListMeta `json:"metadata,omitempty"` Items []BucketAccessRequest `json:"items"` } - -func init() { - SchemeBuilder.Register(&Bucket{}, &BucketList{}) - SchemeBuilder.Register(&BucketRequest{}, &BucketRequestList{}) - SchemeBuilder.Register(&BucketClass{}, &BucketClassList{}) - - SchemeBuilder.Register(&BucketAccess{}, &BucketAccessList{}) - SchemeBuilder.Register(&BucketAccessRequest{}, &BucketAccessRequestList{}) - SchemeBuilder.Register(&BucketAccessClass{}, &BucketAccessClassList{}) -} diff --git a/apis/objectstorage.k8s.io/v1alpha1/zz_generated.deepcopy.go b/apis/objectstorage.k8s.io/v1alpha1/zz_generated.deepcopy.go index 8d9e27ed..920365ec 100644 --- a/apis/objectstorage.k8s.io/v1alpha1/zz_generated.deepcopy.go +++ b/apis/objectstorage.k8s.io/v1alpha1/zz_generated.deepcopy.go @@ -25,22 +25,6 @@ import ( 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 *AnonymousAccessMode) DeepCopyInto(out *AnonymousAccessMode) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnonymousAccessMode. -func (in *AnonymousAccessMode) DeepCopy() *AnonymousAccessMode { - if in == nil { - return nil - } - out := new(AnonymousAccessMode) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AzureProtocol) DeepCopyInto(out *AzureProtocol) { *out = *in @@ -370,7 +354,6 @@ func (in *BucketClass) DeepCopyInto(out *BucketClass) { copy(*out, *in) } in.Protocol.DeepCopyInto(&out.Protocol) - out.AnonymousAccessMode = in.AnonymousAccessMode if in.Parameters != nil { in, out := &in.Parameters, &out.Parameters *out = make(map[string]string, len(*in)) @@ -561,7 +544,6 @@ func (in *BucketRequestStatus) DeepCopy() *BucketRequestStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BucketSpec) DeepCopyInto(out *BucketSpec) { *out = *in - out.AnonymousAccessMode = in.AnonymousAccessMode if in.BucketRequest != nil { in, out := &in.BucketRequest, &out.BucketRequest *out = new(v1.ObjectReference) diff --git a/clientset/fake/register.go b/clientset/fake/register.go index b6266233..a7727906 100644 --- a/clientset/fake/register.go +++ b/clientset/fake/register.go @@ -29,7 +29,7 @@ import ( var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) -var parameterCodec = runtime.NewParameterCodec(scheme) + var localSchemeBuilder = runtime.SchemeBuilder{ objectstoragev1alpha1.AddToScheme, } diff --git a/controller/controller.go b/controller/controller.go index 19b86e3f..caac6c52 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -30,8 +30,8 @@ import ( "k8s.io/client-go/tools/leaderelection/resourcelock" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" + "k8s.io/klog/v2" - "github.com/golang/glog" "github.com/spf13/viper" ) @@ -223,14 +223,14 @@ func (c *ObjectStorageController) Run(ctx context.Context) error { RetryPeriod: c.RetryPeriod, Callbacks: leaderelection.LeaderCallbacks{ OnStartedLeading: func(ctx context.Context) { - glog.V(2).Info("became leader, starting") + klog.V(2).InfoS("became leader, starting controller") c.runController(ctx) }, OnStoppedLeading: func() { - glog.Infof("stopped leading") + klog.InfoS("stopped leading") }, OnNewLeader: func(identity string) { - glog.V(3).Infof("new leader detected, current leader: %s", identity) + klog.V(3).InfoS("new leader detected", "name", identity) }, }, } @@ -269,36 +269,21 @@ func (c *ObjectStorageController) processNextItem(ctx context.Context) bool { switch o := op.(type) { case addOp: add := *o.AddFunc - objMeta := o.Object.(metav1.Object) - name := objMeta.GetName() - ns := objMeta.GetNamespace() err = add(ctx, o.Object) if err == nil { o.Indexer.Add(o.Object) - } else { - glog.Errorf("Error adding %s %s: %v", ns, name, err) } case updateOp: update := *o.UpdateFunc - objMeta := o.OldObject.(metav1.Object) - name := objMeta.GetName() - ns := objMeta.GetNamespace() err = update(ctx, o.OldObject, o.NewObject) if err == nil { o.Indexer.Update(o.NewObject) - } else { - glog.Errorf("Error updating %s %s: %v", ns, name, err) } case deleteOp: delete := *o.DeleteFunc - objMeta := o.Object.(metav1.Object) - name := objMeta.GetName() - ns := objMeta.GetNamespace() err = delete(ctx, o.Object) if err == nil { o.Indexer.Delete(o.Object) - } else { - glog.Errorf("Error deleting %s %s: %v", ns, name, err) } default: panic("unknown item in queue") @@ -425,7 +410,6 @@ func (c *ObjectStorageController) runController(ctx context.Context) { defer utilruntime.HandleCrash() defer c.queue.ShutDown() - glog.V(1).Infof("Starting %s controller", name) go ctrlr.Run(ctx.Done()) if !cache.WaitForCacheSync(ctx.Done(), ctrlr.HasSynced) { @@ -438,7 +422,6 @@ func (c *ObjectStorageController) runController(ctx context.Context) { } <-ctx.Done() - glog.V(3).Infof("Stopping %s controller", name) } if c.BucketListener != nil { diff --git a/crds/objectstorage.k8s.io_bucketaccessclasses.yaml b/crds/objectstorage.k8s.io_bucketaccessclasses.yaml index 9e4b7c44..18de5b5d 100644 --- a/crds/objectstorage.k8s.io_bucketaccessclasses.yaml +++ b/crds/objectstorage.k8s.io_bucketaccessclasses.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: (devel) + controller-gen.kubebuilder.io/version: v0.4.1 creationTimestamp: null name: bucketaccessclasses.objectstorage.k8s.io spec: @@ -92,8 +92,6 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - provisioner: - type: string type: object served: true storage: true diff --git a/crds/objectstorage.k8s.io_bucketaccesses.yaml b/crds/objectstorage.k8s.io_bucketaccesses.yaml index 656b308d..46fb7ae6 100644 --- a/crds/objectstorage.k8s.io_bucketaccesses.yaml +++ b/crds/objectstorage.k8s.io_bucketaccesses.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: (devel) + controller-gen.kubebuilder.io/version: v0.4.1 creationTimestamp: null name: bucketaccesses.objectstorage.k8s.io spec: diff --git a/crds/objectstorage.k8s.io_bucketaccessrequests.yaml b/crds/objectstorage.k8s.io_bucketaccessrequests.yaml index f65125c7..65cd3759 100644 --- a/crds/objectstorage.k8s.io_bucketaccessrequests.yaml +++ b/crds/objectstorage.k8s.io_bucketaccessrequests.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: (devel) + controller-gen.kubebuilder.io/version: v0.4.1 creationTimestamp: null name: bucketaccessrequests.objectstorage.k8s.io spec: diff --git a/crds/objectstorage.k8s.io_bucketclasses.yaml b/crds/objectstorage.k8s.io_bucketclasses.yaml index 6572216c..6c106336 100644 --- a/crds/objectstorage.k8s.io_bucketclasses.yaml +++ b/crds/objectstorage.k8s.io_bucketclasses.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: (devel) + controller-gen.kubebuilder.io/version: v0.4.1 creationTimestamp: null name: bucketclasses.objectstorage.k8s.io spec: @@ -25,22 +25,14 @@ spec: type: string type: array x-kubernetes-list-type: atomic - anonymousAccessMode: - properties: - private: - type: boolean - publicReadOnly: - type: boolean - publicReadWrite: - type: boolean - publicWriteOnly: - type: boolean - type: object 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 + deletionPolicy: + default: retain + type: string isDefaultBucketClass: default: false type: boolean @@ -75,12 +67,6 @@ spec: serviceAccount: type: string type: object - name: - enum: - - s3 - - azureBlob - - gcs - type: string s3: properties: bucketName: @@ -95,16 +81,9 @@ spec: - S3V4 type: string type: object - version: - type: string - required: - - name type: object provisioner: type: string - retentionPolicy: - default: retain - type: string required: - protocol type: object diff --git a/crds/objectstorage.k8s.io_bucketrequests.yaml b/crds/objectstorage.k8s.io_bucketrequests.yaml index 115ad20a..09d87721 100644 --- a/crds/objectstorage.k8s.io_bucketrequests.yaml +++ b/crds/objectstorage.k8s.io_bucketrequests.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: (devel) + controller-gen.kubebuilder.io/version: v0.4.1 creationTimestamp: null name: bucketrequests.objectstorage.k8s.io spec: diff --git a/crds/objectstorage.k8s.io_buckets.yaml b/crds/objectstorage.k8s.io_buckets.yaml index 09c5b743..e2aae14a 100644 --- a/crds/objectstorage.k8s.io_buckets.yaml +++ b/crds/objectstorage.k8s.io_buckets.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: (devel) + controller-gen.kubebuilder.io/version: v0.4.1 creationTimestamp: null name: buckets.objectstorage.k8s.io spec: @@ -39,19 +39,10 @@ spec: type: string type: array x-kubernetes-list-type: atomic - anonymousAccessMode: - properties: - private: - type: boolean - publicReadOnly: - type: boolean - publicReadWrite: - type: boolean - publicWriteOnly: - type: boolean - type: object bucketClassName: type: string + bucketID: + type: string bucketRequest: description: 'ObjectReference contains enough information to let you inspect or modify the referred object. --- New uses of this type @@ -111,6 +102,9 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + deletionPolicy: + default: retain + type: string parameters: additionalProperties: type: string @@ -135,12 +129,6 @@ spec: serviceAccount: type: string type: object - name: - enum: - - s3 - - azureBlob - - gcs - type: string s3: properties: bucketName: @@ -155,19 +143,12 @@ spec: - S3V4 type: string type: object - version: - type: string - required: - - name type: object provisioner: type: string - retentionPolicy: - default: retain - type: string required: + - deletionPolicy - protocol - - retentionPolicy type: object status: properties: diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucket.go b/listers/objectstorage.k8s.io/v1alpha1/bucket.go index 16d40085..35b06d5f 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucket.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucket.go @@ -26,10 +26,13 @@ import ( ) // BucketLister helps list Buckets. +// All objects returned here must be treated as read-only. type BucketLister interface { // List lists all Buckets in the indexer. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.Bucket, err error) // Get retrieves the Bucket from the index for a given name. + // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.Bucket, error) BucketListerExpansion } diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucketaccess.go b/listers/objectstorage.k8s.io/v1alpha1/bucketaccess.go index 69308e27..51eb357f 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucketaccess.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucketaccess.go @@ -26,10 +26,13 @@ import ( ) // BucketAccessLister helps list BucketAccesses. +// All objects returned here must be treated as read-only. type BucketAccessLister interface { // List lists all BucketAccesses in the indexer. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketAccess, err error) // Get retrieves the BucketAccess from the index for a given name. + // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.BucketAccess, error) BucketAccessListerExpansion } diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucketaccessclass.go b/listers/objectstorage.k8s.io/v1alpha1/bucketaccessclass.go index c4bbc9aa..146ac41d 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucketaccessclass.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucketaccessclass.go @@ -26,10 +26,13 @@ import ( ) // BucketAccessClassLister helps list BucketAccessClasses. +// All objects returned here must be treated as read-only. type BucketAccessClassLister interface { // List lists all BucketAccessClasses in the indexer. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketAccessClass, err error) // Get retrieves the BucketAccessClass from the index for a given name. + // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.BucketAccessClass, error) BucketAccessClassListerExpansion } diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucketaccessrequest.go b/listers/objectstorage.k8s.io/v1alpha1/bucketaccessrequest.go index a1b11add..7340f910 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucketaccessrequest.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucketaccessrequest.go @@ -26,8 +26,10 @@ import ( ) // BucketAccessRequestLister helps list BucketAccessRequests. +// All objects returned here must be treated as read-only. type BucketAccessRequestLister interface { // List lists all BucketAccessRequests in the indexer. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketAccessRequest, err error) // BucketAccessRequests returns an object that can list and get BucketAccessRequests. BucketAccessRequests(namespace string) BucketAccessRequestNamespaceLister @@ -58,10 +60,13 @@ func (s *bucketAccessRequestLister) BucketAccessRequests(namespace string) Bucke } // BucketAccessRequestNamespaceLister helps list and get BucketAccessRequests. +// All objects returned here must be treated as read-only. type BucketAccessRequestNamespaceLister interface { // List lists all BucketAccessRequests in the indexer for a given namespace. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketAccessRequest, err error) // Get retrieves the BucketAccessRequest from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.BucketAccessRequest, error) BucketAccessRequestNamespaceListerExpansion } diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucketclass.go b/listers/objectstorage.k8s.io/v1alpha1/bucketclass.go index 31248953..f7c5c514 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucketclass.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucketclass.go @@ -26,10 +26,13 @@ import ( ) // BucketClassLister helps list BucketClasses. +// All objects returned here must be treated as read-only. type BucketClassLister interface { // List lists all BucketClasses in the indexer. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketClass, err error) // Get retrieves the BucketClass from the index for a given name. + // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.BucketClass, error) BucketClassListerExpansion } diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucketrequest.go b/listers/objectstorage.k8s.io/v1alpha1/bucketrequest.go index b14298db..005d8622 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucketrequest.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucketrequest.go @@ -26,8 +26,10 @@ import ( ) // BucketRequestLister helps list BucketRequests. +// All objects returned here must be treated as read-only. type BucketRequestLister interface { // List lists all BucketRequests in the indexer. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketRequest, err error) // BucketRequests returns an object that can list and get BucketRequests. BucketRequests(namespace string) BucketRequestNamespaceLister @@ -58,10 +60,13 @@ func (s *bucketRequestLister) BucketRequests(namespace string) BucketRequestName } // BucketRequestNamespaceLister helps list and get BucketRequests. +// All objects returned here must be treated as read-only. type BucketRequestNamespaceLister interface { // List lists all BucketRequests in the indexer for a given namespace. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketRequest, err error) // Get retrieves the BucketRequest from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.BucketRequest, error) BucketRequestNamespaceListerExpansion }