-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
config/v1/types_infrastructure: Add AWS Region #300
config/v1/types_infrastructure: Add AWS Region #300
Conversation
40e05ca
to
532e4df
Compare
1c8501c
to
c832814
Compare
c832814
to
30a6215
Compare
/cc @deads2k regarding pointer discussion |
@adambkaplan: GitHub didn't allow me to request PR reviews from the following users: regarding, pointer, discussion. Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions 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. |
@openshift/api-reviewers ptal at the above conversation and weigh in. |
ping @deads2k @derekwaynecarr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reverting my position and am OK with pointers.
The image registry needs this so it can figure out where to create an S3 bucket for installs with cluster-provisioned infrastructure [1]. We need the registry to be happy after: $ openshift-install create cluster so we don't want to rely on the installer pushing this config in as a day-2 operation. You can extract "what AWS region am I in?" from the cloud provider, but the registry operator is not authorized to do so. With this addition, we provide a way for the cluster creator to declare a default region for new infrastructure. This field is in Status and not Spec, because we're not going to support transitioning clusters between regions by reconciling this. The cluster admin can write it once (in the manifest that goes up with the bootstrap Ignition config), and then it's read-only reality forever. I'd prefer an +optional Region property, because you only need to set it if you want the cluster to provision resources for you. For user-provided infrastructure flows, you could leave this unset. However, the registry needs the region for its S3 client [2], even if it's just to manage data in a user-provided bucket. So folks who leave the property off will have an Available:false registry until they set region or regionEndpoint via the configs.imageregistry.operator.openshift.io custom resource [3,4]. But Adam wanted it required [5], and going from required -> optional later is a non-breaking change while optional -> required would be breaking, so it's required with this commit. [1]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/clusterconfig/clusterconfig.go#L44 [2]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/storage/s3/s3.go#L53-L65 [3]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/manifests/00-crd.yaml [4]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/apis/imageregistry/v1/types.go#L179-L184 [5]: openshift#300 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@openshift/api-approvers ptal |
// PlatformStatus holds the current status specific to the underlying infrastructure provider | ||
// of the current cluster. Since these are used at status-level for the underlying cluster, it | ||
// is supposed that only one of the status structs is set. | ||
type PlatformStatus struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a discriminator field which indicates which one of the many values is going to be set. CRD discriminators are assumed to be in the same struct as the subfields I think. @sttts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the CRD it must be in the same JSON object (which in case of struct embedding might differ from "same struct"). Generators like crd-gen from controller-tools will probably require the same struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So bring
api/config/v1/types_infrastructure.go
Line 48 in a1f3bdc
Platform PlatformType `json:"platform,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...deprecate for removal in v2 in four years ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and that's not only a restriction for CRDs, but will be for native types as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...deprecate for removal in v2 in four years ;)
I think you're left with no other choice. Duplicate the value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if native API adds discriminators like
https://godoc.org/k8s.io/api/core/v1#VolumeSource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve |
/hold should this be going into master-next? |
(apparently i'm not an approver yet. working on that: #307) |
holding for clarity on whether this should be/needs to be going into 4.1 or not. |
Motivation here. Dropping cluster-config-v1 in favor of Infrastructure simplifies user-facing docs because all you need to tear down an AWS cluster is the |
I guess if you wanted to punt on this but still address rhbz#1685089 for 4.1, you could have the registry operator pull both |
/hold cancel |
@wking needs a rebase, which will wipe out any lgtm. |
The image registry needs this so it can figure out where to create an S3 bucket for installs with cluster-provisioned infrastructure [1]. We need the registry to be happy after: $ openshift-install create cluster so we don't want to rely on the installer pushing this config in as a day-2 operation. You can extract "what AWS region am I in?" from the cloud provider, but the registry operator is not authorized to do so. With this addition, we provide a way for the cluster creator to declare a default region for new infrastructure. This field is in Status and not Spec, because we're not going to support transitioning clusters between regions by reconciling this. The cluster admin can write it once (in the manifest that goes up with the bootstrap Ignition config), and then it's read-only reality forever. I'd prefer an +optional Region property, because you only need to set it if you want the cluster to provision resources for you. For user-provided infrastructure flows, you could leave this unset. However, the registry needs the region for its S3 client [2], even if it's just to manage data in a user-provided bucket. So folks who leave the property off will have an Available:false registry until they set region or regionEndpoint via the configs.imageregistry.operator.openshift.io custom resource [3,4]. But Adam wanted it required [5], and going from required -> optional later is a non-breaking change while optional -> required would be breaking, so it's required with this commit. I've pushed the type specifier down into platformStatus, deprecating the old property, because discriminator fields need to live inside the struct whose properties they discriminate [6]. It would be nice to be able to drop the old type property and rename platformStatus to platform, but it's too close to API freeze to be able to do that, so we're stuck with the old name. We'll drop the old type in v2, if we ever have a v2 of this type. [1]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/clusterconfig/clusterconfig.go#L44 [2]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/storage/s3/s3.go#L53-L65 [3]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/manifests/00-crd.yaml [4]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/apis/imageregistry/v1/types.go#L179-L184 [5]: openshift#300 (comment) [6]: openshift#300 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: adambkaplan, bparees, wking The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Pulling in openshift/api@dedfb47b1f (config/v1/types_infrastructure: Add AWS Region, 2019-04-26, openshift/api#300). Generated with: $ dep ensure -update github.com/openshift/api using: $ dep version dep: version : v0.5.1 build date : 2019-03-20 git hash : faa61893 go version : go1.10.3 go compiler : gc platform : linux/amd64 features : ImportDuringSolve=false
Using openshift/api@dedfb47b1f (config/v1/types_infrastructure: Add AWS Region, 2019-04-26, openshift/api#300) so the registry can use it as a default for their config resource [1,2]. [1]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/manifests/00-crd.yaml [2]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/apis/imageregistry/v1/types.go#L179-L184
Using openshift/api@dedfb47b1f (config/v1/types_infrastructure: Add AWS Region, 2019-04-26, openshift/api#300) so the registry can use it as a default for their config resource [1,2]. [1]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/manifests/00-crd.yaml [2]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/apis/imageregistry/v1/types.go#L179-L184
Using openshift/api@dedfb47b1f (config/v1/types_infrastructure: Add AWS Region, 2019-04-26, openshift/api#300) so the registry can use it as a default for their config resource [1,2]. [1]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/manifests/00-crd.yaml [2]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/apis/imageregistry/v1/types.go#L179-L184
Using openshift/api@dedfb47b1f (config/v1/types_infrastructure: Add AWS Region, 2019-04-26, openshift/api#300) so the registry can use it as a default for their config resource [1,2]. [1]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/manifests/00-crd.yaml [2]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/apis/imageregistry/v1/types.go#L179-L184
Pulling in openshift/api@dedfb47b1f (config/v1/types_infrastructure: Add AWS Region, 2019-04-26, openshift/api#300). Generated with: $ dep ensure -update github.com/openshift/api using: $ dep version dep: version : v0.5.1 build date : 2019-03-20 git hash : faa61893 go version : go1.10.3 go compiler : gc platform : linux/amd64 features : ImportDuringSolve=false
Using openshift/api@dedfb47b1f (config/v1/types_infrastructure: Add AWS Region, 2019-04-26, openshift/api#300) so the registry can use it as a default for their config resource [1,2]. [1]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/manifests/00-crd.yaml [2]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/apis/imageregistry/v1/types.go#L179-L184
Commit from: openshift@8b3b375 Using openshift/api@dedfb47b1f (config/v1/types_infrastructure: Add AWS Region, 2019-04-26, openshift/api#300) so the registry can use it as a default for their config resource [1,2]. NOTE: keeps the status.platformType set for all platforms compared to the source commit. [1]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/manifests/00-crd.yaml [2]: https://github.com/openshift/cluster-image-registry-operator/blob/670539cda460d97e0a3e23f077fdf9dd00d2ccdc/pkg/apis/imageregistry/v1/types.go#L179-L184
The image registry needs this so it can figure out where to create an S3 bucket for installs with cluster-provisioned infrastructure. We need the registry to be happy after:
so we don't want to rely on the installer pushing this config in as a day-2 operation. You can extract "what AWS region am I in?" from the cloud provider, but the registry operator is not authorized to do so. With this addition, we provide a way for the cluster creator to declare a default region for new infrastructure.
This field is in
Status
and notSpec
, because we're not going to support transitioning clusters between regions by reconciling this. The cluster admin can write it once (in the manifest that goes up with the bootstrap Ignition config), and then it's read-only reality forever.The field is optional[edit: not anymore], because you only need to set it if you want the cluster to provision resources for you. For user-provided infrastructure flows, you can leave this unset. However, the registry needs the region for its S3 client, even if it's just to manage data in a user-provided bucket. So folks who leave the property off will have anAvailable
:false
registry until they setregion
orregionEndpoint
via theconfigs.imageregistry.operator.openshift.io
custom resource.