Skip to content
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
1,051 changes: 0 additions & 1,051 deletions imageregistry/v1/00-crd.yaml

This file was deleted.

1,757 changes: 1,757 additions & 0 deletions imageregistry/v1/00_imageregistry.crd.yaml

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions imageregistry/v1/00_imageregistry.crd.yaml-patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- op: add
path: /spec/versions/name=v1/schema/openAPIV3Schema/properties/spec/properties/storage/properties/oss/properties/encryption/anyOf
value:
- properties:
type:
not:
enum: ["KMS"]
not:
required: ["kms"]
- properties:
type:
enum: ["KMS"]
required: ["kms"]
File renamed without changes.
78 changes: 78 additions & 0 deletions imageregistry/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,81 @@ type ImageRegistryConfigStorageIBMCOS struct {
ServiceInstanceCRN string `json:"serviceInstanceCRN,omitempty"`
}

// EndpointAccessibility defines the Alibaba VPC endpoint for storage
type EndpointAccessibility string

// AlibabaEncryptionMethod defines an enumerable type for the encryption mode
type AlibabaEncryptionMethod string

const (
// InternalEndpoint sets the VPC endpoint to internal
InternalEndpoint EndpointAccessibility = "Internal"
// PublicEndpoint sets the VPC endpoint to public
PublicEndpoint EndpointAccessibility = "Public"

// PlainText is an AlibabaEncryptionMethod. This is the default. This means no encryption
PlainText AlibabaEncryptionMethod = "PlainText"
// AES256 is an AlibabaEncryptionMethod. This means AES256 encryption
AES256 AlibabaEncryptionMethod = "AES256"
// KMS is an AlibabaEncryptionMethod. This means KMS encryption
KMS AlibabaEncryptionMethod = "KMS"
)

// EncryptionAlibaba this a union type in kube parlance. Depending on the value for the AlibabaEncryptionMethod,
// different pointers may be used
type EncryptionAlibaba struct {
// Method defines the different encrytion modes available
// Empty value means no opinion and the platform chooses the a default, which is subject to change over time.
// Currently the default is `AES256`.
// +kubebuilder:validation:Enum="PlainText";"KMS";"AES256"
// +kubebuilder:default="AES256"
// +optional
Method AlibabaEncryptionMethod `json:"method"`

// KMS (key management service) is an encryption type that holds the struct for KMS KeyID
// +optional
KMS *KMSEncryptionAlibaba `json:"kms,omitempty"`
Copy link
Copy Markdown
Contributor

@sttts sttts Dec 10, 2021

Choose a reason for hiding this comment

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

if this is only to be set when type matches, you have to add a patch file (can be follow-up), setting

anyOf:
- properties:
       type:
         not:
           enum: ["KMS"]
  not:
      required: ["kms"]
- properties:
    type:
      enum: ["KMS"]
  required: ["kms"]

Double check the logic.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Let me research how to do this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

}

type KMSEncryptionAlibaba struct {
// KeyID holds the KMS encryption key ID
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
KeyID string `json:"keyID"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can this be empty? Which format?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

When the Type is set to KMS then a key would be required. When it is not, it can be empty.

The CMK ID that must be specified when SSEAlgorithm is set to KMS and a specified CMK is used for encryption. In other cases, this element must be set to null.

}

// ImageRegistryConfigStorageAlibabaOSS holds Alibaba Cloud OSS configuration.
// Configures the registry to use Alibaba Cloud Object Storage Service for backend storage.
// More about oss, you can look at the [official documentation](https://www.alibabacloud.com/help/product/31815.htm)
type ImageRegistryConfigStorageAlibabaOSS struct {
// Bucket is the bucket name in which you want to store the registry's data.
// About Bucket naming, more details you can look at the [official documentation](https://www.alibabacloud.com/help/doc-detail/257087.htm)
// Empty value means no opinion and the platform chooses the a default, which is subject to change over time.
// Currently the default will be autogenerated in the form of <clusterid>-image-registry-<region>-<random string 27 chars>
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:MinLength=3
// +kubebuilder:validation:Pattern=`^[0-9a-z]+(-[0-9a-z]+)*$`
// +optional
Bucket string `json:"bucket,omitempty"`
// Region is the Alibaba Cloud Region in which your bucket exists.
// For a list of regions, you can look at the [official documentation](https://www.alibabacloud.com/help/doc-detail/31837.html).
// Empty value means no opinion and the platform chooses the a default, which is subject to change over time.
// Currently the default will be based on the installed Alibaba Cloud Region.
// +optional
Region string `json:"region,omitempty"`
// EndpointAccessibility specifies whether the registry use the OSS VPC internal endpoint
// Empty value means no opinion and the platform chooses the a default, which is subject to change over time.
// Currently the default is `Internal`.
// +kubebuilder:validation:Enum="Internal";"Public";""
// +kubebuilder:default="Internal"
// +optional
EndpointAccessibility EndpointAccessibility `json:"endpointAccessibility,omitempty"`
// Encryption specifies whether you would like your data encrypted on the server side.
// More details, you can look cat the [official documentation](https://www.alibabacloud.com/help/doc-detail/117914.htm)
// +optional
Encryption *EncryptionAlibaba `json:"encryption,omitempty"`
}

// ImageRegistryConfigStorage describes how the storage should be configured
// for the image registry.
type ImageRegistryConfigStorage struct {
Expand Down Expand Up @@ -333,6 +408,9 @@ type ImageRegistryConfigStorage struct {
// ibmcos represents configuration that uses IBM Cloud Object Storage.
// +optional
IBMCOS *ImageRegistryConfigStorageIBMCOS `json:"ibmcos,omitempty"`
// Oss represents configuration that uses Alibaba Cloud Object Storage Service.
// +optional
OSS *ImageRegistryConfigStorageAlibabaOSS `json:"oss,omitempty"`
// managementState indicates if the operator manages the underlying
// storage unit. If Managed the operator will remove the storage when
// this operator gets Removed.
Expand Down
63 changes: 63 additions & 0 deletions imageregistry/v1/zz_generated.deepcopy.go

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

31 changes: 31 additions & 0 deletions imageregistry/v1/zz_generated.swagger_doc_generated.go

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