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

Adding Protocol to BucketClass to allow admin to provide backend info… #16

Merged
merged 1 commit into from
Jan 20, 2021
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
60 changes: 13 additions & 47 deletions apis/objectstorage.k8s.io/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions apis/objectstorage.k8s.io/v1alpha1/protocol_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,11 @@ const (
ProtocolNameGCS ProtocolName = "gcs"
)

type RequestedProtocol struct {
type Protocol 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
Expand Down
1 change: 0 additions & 1 deletion apis/objectstorage.k8s.io/v1alpha1/s3_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const (
)

type S3Protocol struct {
Version string `json:"version,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
BucketName string `json:"bucketName,omitempty"`
Region string `json:"region,omitempty"`
Expand Down
7 changes: 3 additions & 4 deletions apis/objectstorage.k8s.io/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ type BucketRequestSpec struct {
// +optional
BucketPrefix string `json:"bucketPrefix,omitempty"`
// +optional
BucketClassName string `json:"bucketClassName,omitempty"`
Protocol RequestedProtocol `json:"protocol"`
BucketClassName string `json:"bucketClassName,omitempty"`
}

type BucketRequestStatus struct {
Expand Down Expand Up @@ -145,7 +144,7 @@ type BucketClass struct {
// +listType=atomic
// +optional
AllowedNamespaces []string `json:"allowedNamespaces,omitempty"`
Protocol string `json:"protocol"`
Protocol Protocol `json:"protocol"`
// +optional
AnonymousAccessMode AnonymousAccessMode `json:"anonymousAccessMode,omitempty"`
// +kubebuilder:default:=retain
Expand Down Expand Up @@ -196,7 +195,7 @@ type BucketAccessSpec struct {
// +optional
BucketAccessRequest *corev1.ObjectReference `json:"bucketAccessRequest,omitempty"`
// +optional
ServiceAccount *corev1.ObjectReference `json:"serviceAccount,omitempty"`
ServiceAccount *corev1.ObjectReference `json:"serviceAccount,omitempty"`
// +optional
MintedSecretName string `json:"mintedSecretName,omitempty"`
PolicyActionsConfigMapData string `json:"policyActionsConfigMapData,omitempty"`
Expand Down
19 changes: 1 addition & 18 deletions apis/objectstorage.k8s.io/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func NewObjectStorageControllerWithClientset(identity string, leaderLockName str
// Run - runs the controller. Note that ctx must be cancellable i.e. ctx.Done() should not return nil
func (c *ObjectStorageController) Run(ctx context.Context) error {
if !c.initialized {
fmt.Errorf("Uninitialized controller. Atleast 1 listener should be added")
return fmt.Errorf("Uninitialized controller. Atleast 1 listener should be added")
}

ns := func() string {
Expand Down
45 changes: 44 additions & 1 deletion crds/objectstorage.k8s.io_bucketclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,50 @@ spec:
type: string
type: object
protocol:
type: string
properties:
azureBlob:
properties:
containerName:
type: string
storageAccount:
type: string
type: object
gcs:
properties:
bucketName:
type: string
privateKeyName:
type: string
projectID:
type: string
serviceAccount:
type: string
type: object
name:
enum:
- s3
- azureBlob
- gcs
type: string
s3:
properties:
bucketName:
type: string
endpoint:
type: string
region:
type: string
signatureVersion:
enum:
- s3v2
- s3v4
type: string
type: object
version:
type: string
required:
- name
type: object
provisioner:
type: string
retentionPolicy:
Expand Down
15 changes: 0 additions & 15 deletions crds/objectstorage.k8s.io_bucketrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,6 @@ spec:
type: string
bucketPrefix:
type: string
protocol:
properties:
name:
enum:
- s3
- azureBlob
- gcs
type: string
version:
type: string
required:
- name
type: object
required:
- protocol
type: object
status:
properties:
Expand Down
25 changes: 9 additions & 16 deletions crds/objectstorage.k8s.io_buckets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,12 @@ spec:
serviceAccount:
type: string
type: object
requestedProtocol:
properties:
name:
enum:
- s3
- azureBlob
- gcs
type: string
version:
type: string
required:
- name
type: object
name:
enum:
- s3
- azureBlob
- gcs
type: string
s3:
properties:
bucketName:
Expand All @@ -161,11 +154,11 @@ spec:
- s3v2
- s3v4
type: string
version:
type: string
type: object
version:
type: string
required:
- requestedProtocol
- name
type: object
provisioner:
type: string
Expand Down