Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Add api definitions #2

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions apis/objectstorage.k8s.io/v1alpha1/azure_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright 2020 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// +k8s:deepcopy-gen=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License is missing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


package v1alpha1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need protocol-specific types now? I may be a bit behind, but I thought the Bucket instance was no longer going to expose protocol-specific fields, other than, perhaps, common values for all protocols.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffvance This PR is inline with the KEP that is merged. We will iterate it when the new proposal is merged.


type AzureProtocol struct {
ContainerName string `json:"containerName,omitempty"`
StorageAccount string `json:"storageAccount,omitempty"`
}
23 changes: 23 additions & 0 deletions apis/objectstorage.k8s.io/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Copyright 2020 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// +k8s:deepcopy-gen=package,register
// +groupName=objectstorage.k8s.io
// +k8s:protobuf-gen=package
// +k8s:openapi-gen=true
// +kubebuilder:validation:Required

package v1alpha1
26 changes: 26 additions & 0 deletions apis/objectstorage.k8s.io/v1alpha1/gcs_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright 2020 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// +k8s:deepcopy-gen=false

package v1alpha1

type GCSProtocol struct {
BucketName string `json:"bucketName,omitempty"`
PrivateKeyName string `json:"privateKeyName,omitempty"`
ProjectID string `json:"projectID,omitempty"`
ServiceAccount string `json:"serviceAccount,omitempty"`
}
1,210 changes: 1,210 additions & 0 deletions apis/objectstorage.k8s.io/v1alpha1/openapi_generated.go

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions apis/objectstorage.k8s.io/v1alpha1/protocol_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Copyright 2020 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

type ProtocolName string

const (
ProtocolNameS3 ProtocolName = "s3"
ProtocolNameAzure ProtocolName = "azureBlob"
ProtocolNameGCS ProtocolName = "gcs"
)

type RequestedProtocol struct {
// +kubebuilder:validation:Enum:={s3,azureBlob,gcs}
Name ProtocolName `json:"name"`
// +optional
Version string `json:"version,omitempty"`
}

type Protocol struct {
// +required
RequestedProtocol `json:"requestedProtocol"`
// +optional
S3 *S3Protocol `json:"s3,omitempty"`
// +optional
AzureBlob *AzureProtocol `json:"azureBlob,omitempty"`
// +optional
GCS *GCSProtocol `json:"gcs,omitempty"`
}
38 changes: 38 additions & 0 deletions apis/objectstorage.k8s.io/v1alpha1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Copyright 2020 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "objectstorage.k8s.io", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
35 changes: 35 additions & 0 deletions apis/objectstorage.k8s.io/v1alpha1/s3_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
Copyright 2020 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// +k8s:deepcopy-gen=false

package v1alpha1

type S3SignatureVersion string

const (
S3SignatureVersionV2 S3SignatureVersion = "S3v2"
S3SignatureVersionV4 S3SignatureVersion = "S3v4"
)

type S3Protocol struct {
Version string `json:"version,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
BucketName string `json:"bucketName,omitempty"`
Region string `json:"region,omitempty"`
// +kubebuilder:validation:Enum:={s3v2,s3v4}
SignatureVersion S3SignatureVersion `json:"signatureVersion,omitempty"`
}
Loading