imageresitry support Alibabacloud oss#1009
imageresitry support Alibabacloud oss#1009menglingwei wants to merge 7 commits intoopenshift:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: menglingwei The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @menglingwei. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/ok-to-test |
| // internal specifies whether the registry use the OSS VPC internal endpoint | ||
| // Optional, defaults to false. if RegionEndpoint is specified, this config will be ignored | ||
| // +optional | ||
| Internal bool `json:"internal,omitempty"` |
There was a problem hiding this comment.
Nothing is a bool. Use an enum string please, with values like Internal and its counterpoint.
There was a problem hiding this comment.
I think it's better to keep it the same as registry storage-driver for oss. https://github.com/docker/docker.github.io/blob/master/registry/storage-drivers/oss.md
There was a problem hiding this comment.
The registry storage driver isn't an openshift API. openshift APIs look like kube APIs and we prefer to have enumerations where the value clearly indicates what it does and the list of values provides helpful description of what the alternatives are.
This field looks like "EndpointAccessibility" with values "Internal" or "Public". Looking at clear enums like that, the default ought to be internal.
There was a problem hiding this comment.
So we might want to change Internal to EndpointAccessibility, and EndpointAccessibility is an enums filed.
var (
InternalEndpoint = EndpointAccessibility("Internal")
PublicEndpoint = EndpointAccessibility("Public")
)
type ImageRegistryConfigStorageOSS struct{
...
EndpointAccessibility EndpointAccessibility `json:"endpointAccessibility,omitempty"`
}
Is ok?
There was a problem hiding this comment.
Is ok?
Yes, that looks good. Please be careful about resolving threads without a push. These comments are disappearing from view.
| // format or not. | ||
| // Optional, defaults to false. | ||
| // +optional | ||
| Encrypt bool `json:"encrypt,omitempty"` |
There was a problem hiding this comment.
You have two encryption related fields? this and keyID? You need to describe the interaction and likely produce an API that makes it impossible to specify an invalid combination.
There was a problem hiding this comment.
Why would we allow a non-encrypted option?
There was a problem hiding this comment.
Here the documation https://www.alibabacloud.com/help/doc-detail/117914.htm?spm=a2c63.p38356.b99.1075.5c3e56989tiYEz.
Encrypt means enable server-side encryption. The default server-side encryption method.
Valid values: KMS, AES256. So if you not set keyID ,AES256 is used for default server-side encryption method.
There was a problem hiding this comment.
There was a problem hiding this comment.
The registry storage driver isn't an openshift API. This API is an openshift API and should conform to our standards. Encryption with values of "ServerSideEncryption" and "ClearText" is very clear.
There was a problem hiding this comment.
@kwoodson @deads2k From the above discussion. I think i need to change internal to an Enum filed like "EndpointAccessibility" , it may be Internal or Public, the default value is Internal. And the Encrty change to an Enum filed like Encryption,It is used to define the server-side encryption algorithm, KMS or AES256, and same time ,add KeyID , if the Encryption value is KMS, the KeyID must be set. So the final structure should be
type EndpointAccessibility string
var (
InternalEndpoint = EndpointAccessibility("Internal")
PublicEndpoint = EndpointAccessibility("Public")
)
type Encryption string
var(
AES256 = Encryption("AES256")
KMS = Encryption("KMS")
)
type ImageRegistryConfigStorageOSS struct {
// bucket is the bucket name in which you want to store the registry's data.
// Optional, will be generated if not provided.
// +optional
// About Bucket naming, more details you can look at the [official documentation](https://www.alibabacloud.com/help/doc-detail/257087.htm)
Bucket string `json:"bucket,omitempty"`
// region is the Alibaba Cloud Region in which your bucket exists.
// Optional, will be set based on the installed Alibaba Cloud Region.
// +optional
// For a list of regions, you can look at the [official documentation](https://www.alibabacloud.com/help/doc-detail/31837.html).
Region string `json:"region,omitempty"`
// EndpointAccessibility specifies whether the registry use the OSS VPC internal endpoint
// Optional, defaults to Internal.
// +optional
EndpointAccessibility EndpointAccessibility `json:"endpointAccessibility,omitempty"`
// encrypt specifies whether the registry stores the image in encrypted
// format or not.
// Optional, defaults to false.
// +optional
// More details, you can look cat the [official documentation](https://www.alibabacloud.com/help/doc-detail/117914.htm)
Encrypt Encryption `json:"encrypt,omitempty"`
// keyID is the KMS key ID to use for encryption.
// +optional
KeyID string `json:"keyID,omitempty"`
}
I wonder if my understanding is correct? If it's correct, I'll do it this way
There was a problem hiding this comment.
If user don't set Encrypt or out of range ,the default value is AES256. If user set Encrypt to KMS and KeyID is not empty, use KMS. Follow the api documents
type Encryption string
var(
AES256 = Encryption("AES256")
KMS = Encryption("KMS")
)
Encrypt Encryption `json:"encrypt,omitempty"`
KeyID string `json:"keyID,omitempty"`
There was a problem hiding this comment.
I didn't realize that keyID was related to Encryption before.
type ImageRegistryConfigStorageAlibaba struct{
}
type Encryption string
var(
ClearText = Encryption("ClearText")
AES256 = Encryption("AES256")
KMS = Encryption("KMS")
)
// this a union type in kube parlance. Depending on the value for the encryptionType,
// different pointers may be used
type EncryptionAlibaba struct{
EncryptionType Encryption `json:"encryptionType"`
KMSEncryptionAlibaba *KMSEncryptionAlibaba `json:"kms"`
}
type KMSEncryptionAlibaba struct{
KeyID string
} There was a problem hiding this comment.
this thread got resolved before a push, unresolving so we can see it.
|
The registry team isn't allowed to merge PRs without approvals from QE/Docs/Px (i.e. QE should confirm that the feature works as expected, Docs can confirm that they have capacity to document it), so I'd expect to have at least a draft PR for cluster-image-registry-operator. You can use |
ok. |
I post a new PR openshift/cluster-image-registry-operator#724. |
|
@dmage I posted a draf PR openshift/cluster-image-registry-operator#724. In cluster-image-reigstry-operator, I need the structure defined in openshift/api. Same as other storage registry privders, such as AWS, GCP, etc |
|
hi,any questions about this PR? |
|
@menglingwei we are making sure that the PR openshift/cluster-image-registry-operator#724 will work with the tests described here using new credentials from CCO. Then when image-registry is validated we can follow up on this one. All the builds is including this change. |
@mtulio got it. |
| // ImageRegistryConfigStorageOSS holds Alibaba Cloud OSS configuration. | ||
| // 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 ImageRegistryConfigStorageOSS struct { |
There was a problem hiding this comment.
Since there's another push coming anyway, let's clean this up to ImageRegistryConfigStorageAlibaba. I think most of us won't recognize OSS
|
/retest |
|
/retest |
2 similar comments
|
/retest |
|
/retest |
|
In my dev environment,. when i run make verify. The following error occurs
|
|
/retest |
1 similar comment
|
/retest |
|
@menglingwei This is caused by the generated code and golang 1.17. When I run Please rerun with golang1.17, add the change, and push. |
|
|
@menglingwei Thanks for the fix! I have pinged the API team and we should receive a review. |
@kwoodson Do I need to update cluster-image-registry-operator now or later? |
|
@menglingwei After this merges, please update the cluster-image-registry-operator PR by removing your repository and update the openshift/api library in the go.mod file. |
| type Encryption string | ||
|
|
||
| var ( | ||
| ClearText = Encryption("ClearText") |
There was a problem hiding this comment.
usual style is ClearText Encryption = "ClearText"
There was a problem hiding this comment.
and they should be defined as const, not var.
| // EncryptionAlibaba this a union type in kube parlance. Depending on the value for the encryptionType, | ||
| // different pointers may be used | ||
| type EncryptionAlibaba struct { | ||
| EncryptionType Encryption `json:"encryptionType"` |
There was a problem hiding this comment.
nvmd. These are native types, right? Not CRDs.
| type EncryptionAlibaba struct { | ||
| EncryptionType Encryption `json:"encryptionType"` | ||
|
|
||
| KMSEncryptionAlibaba *KMSEncryptionAlibaba `json:"kms"` |
There was a problem hiding this comment.
It's convenient when field names match their json names. So I'd recommend
KMS *KMSEncryptionAlibaba `json:"kms,omitempty"`
| // EncryptionAlibaba this a union type in kube parlance. Depending on the value for the encryptionType, | ||
| // different pointers may be used | ||
| type EncryptionAlibaba struct { | ||
| EncryptionType Encryption `json:"encryptionType"` |
There was a problem hiding this comment.
doc this field and the valid values
| } | ||
|
|
||
| type KMSEncryptionAlibaba struct { | ||
| KeyID string `json:"keyID"` |
There was a problem hiding this comment.
doc this field (key id of what/from where?)
| // +optional | ||
| EndpointAccessibility EndpointAccessibility `json:"endpointAccessibility,omitempty"` | ||
| // encrypt specifies whether you would like your data encrypted on the server side. Defaults to false if not specified. | ||
| // Optional, defaults to AES256. |
There was a problem hiding this comment.
this says "defaults to false" and then "defaults to aes256". Since it's not a boolean, I assume "defaults to false" is not accurate.
| // encrypt specifies whether you would like your data encrypted on the server side. Defaults to false if not specified. | ||
| // Optional, defaults to AES256. | ||
| // +optional | ||
| // More details, you can look cat the [official documentation](https://www.alibabacloud.com/help/doc-detail/117914.htm) |
There was a problem hiding this comment.
| // More details, you can look cat the [official documentation](https://www.alibabacloud.com/help/doc-detail/117914.htm) | |
| // More details, you can look at the [official documentation](https://www.alibabacloud.com/help/doc-detail/117914.htm) |
| } | ||
|
|
||
| // ImageRegistryConfigStorageAlibabaOSS holds Alibaba Cloud OSS configuration. | ||
| // the registry to use Alibaba Cloud Object Storage Service for backend storage. |
There was a problem hiding this comment.
| // the registry to use Alibaba Cloud Object Storage Service for backend storage. | |
| // Configures the registry to use Alibaba Cloud Object Storage Service for backend storage. |
?
| // bucket is the bucket name in which you want to store the registry's | ||
| // data. | ||
| // Optional, will be generated if not provided. | ||
| // +optional |
There was a problem hiding this comment.
shouldn't this come after the comment?
| Bucket string `json:"bucket,omitempty"` | ||
| // region is the Alibaba Cloud Region in which your bucket exists. | ||
| // Optional, will be set based on the installed Alibaba Cloud Region. | ||
| // +optional |
There was a problem hiding this comment.
shouldn't this come after the comment?
| EndpointAccessibility EndpointAccessibility `json:"endpointAccessibility,omitempty"` | ||
| // encrypt specifies whether you would like your data encrypted on the server side. Defaults to false if not specified. | ||
| // Optional, defaults to AES256. | ||
| // +optional |
There was a problem hiding this comment.
shouldn't this come after the comment?
| // EncryptionAlibaba this a union type in kube parlance. Depending on the value for the encryptionType, | ||
| // different pointers may be used | ||
| type EncryptionAlibaba struct { | ||
| EncryptionType Encryption `json:"encryptionType"` |
There was a problem hiding this comment.
So it'll look like
encrypt:
encryptionType: KMS
kms:
keyID: ...Maybe it's better to name it as
encryption:
type: KMS
kms:
keyID: ...?
There was a problem hiding this comment.
I will update to type. This reduces verbiage and reads more clearly.
| // 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. |
There was a problem hiding this comment.
These comments will be visible by customers and should contain YAML names, so
| // OSS represents configuration that uses Alibaba Cloud Object Storage Service. | |
| // oss represents configuration that uses Alibaba Cloud Object Storage Service. |
| // Optional, defaults to AES256. | ||
| // +optional | ||
| // More details, you can look cat the [official documentation](https://www.alibabacloud.com/help/doc-detail/117914.htm) | ||
| Encrypt EncryptionAlibaba `json:"encrypt,omitempty"` |
There was a problem hiding this comment.
omitempty + non-point struct does not work.
You probably want a pointer to the struct.
| // EndpointAccessibility specifies whether the registry use the OSS VPC internal endpoint | ||
| // Optional, defaults to Internal. | ||
| // +optional | ||
| EndpointAccessibility EndpointAccessibility `json:"endpointAccessibility,omitempty"` |
| // Optional, will be generated if not provided. | ||
| // +optional | ||
| // About Bucket naming, more details you can look at the [official documentation](https://www.alibabacloud.com/help/doc-detail/257087.htm) | ||
| Bucket string `json:"bucket,omitempty"` |
|
Closing this one in favor of #1082 cc @menglingwei |

No description provided.