Skip to content

aws_platform_service_location: add a controller that sync user specified service endpoints to status#119

Merged
openshift-merge-robot merged 3 commits intoopenshift:masterfrom
abhinavdahiya:aws_sevice_endpoints
Apr 17, 2020
Merged

aws_platform_service_location: add a controller that sync user specified service endpoints to status#119
openshift-merge-robot merged 3 commits intoopenshift:masterfrom
abhinavdahiya:aws_sevice_endpoints

Conversation

@abhinavdahiya
Copy link
Copy Markdown
Contributor

The controller only works for AWS platform
The service endpoints are validated before syncing to the the status,

  • no duplicates should be specified for a service
  • the URL must be hostname or a valid URI without any request paths
    If the service endpoints are not allowed or valid, the status service endpoints are not modified.

depends on openshift/api#599

if pstatus := currentInfra.Status.PlatformStatus; pstatus != nil {
platformName = pstatus.Type
}
if platformName == "" {
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.

kube canonical is len() == 0

Comment thread pkg/operator/aws_platform_service_location/controller.go
return nil // nothing to do here
}

services := currentInfra.Spec.PlatformSpec.AWS.ServiceEndpoints
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.

deep copy please

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

@deads2k deads2k Apr 14, 2020

Choose a reason for hiding this comment

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

d957d96#diff-51a3ce64d08707b029401c01f6a81ac0R61

already deepcopies.

Given the assignment to status later and the update usage, I'd prefer not to shallow copy this. I think it's just .DeepCopy, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ServiceEndpoints is a slice, so no DeepCopy.

i could DeepCopy the entire currentInfra again..
currentInfra.DeepCopy().Spec.PlatformSpec.AWS.ServiceEndpoints ?? @deads2k

Can you provide a little background on why you think deepcopy here would be necessary?

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.

ServiceEndpoints is a slice, so no DeepCopy.

i could DeepCopy the entire currentInfra again..
currentInfra.DeepCopy().Spec.PlatformSpec.AWS.ServiceEndpoints ?? @deads2k

Can you provide a little background on why you think deepcopy here would be necessary?

mutating the input means that if you later use it or diff it somewhere, it won't be what you expect it to be. Makes it hard for me to reason about it's state during this review.

@deads2k
Copy link
Copy Markdown
Contributor

deads2k commented Apr 13, 2020

needs owners file

@openshift-ci-robot openshift-ci-robot added the do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. label Apr 13, 2020
Copy link
Copy Markdown

@openshift-ci-robot openshift-ci-robot left a comment

Choose a reason for hiding this comment

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

@abhinavdahiya: 1 invalid OWNERS file

Details

In response to this:

The controller only works for AWS platform
The service endpoints are validated before syncing to the the status,

  • no duplicates should be specified for a service
  • the URL must be hostname or a valid URI without any request paths
    If the service endpoints are not allowed or valid, the status service endpoints are not modified.

depends on openshift/api#599

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.

Comment thread pkg/operator/aws_platform_service_location/OWNERS
Copy link
Copy Markdown

@openshift-ci-robot openshift-ci-robot left a comment

Choose a reason for hiding this comment

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

@abhinavdahiya: 1 invalid OWNERS file

Details

In response to this:

The controller only works for AWS platform
The service endpoints are validated before syncing to the the status,

  • no duplicates should be specified for a service
  • the URL must be hostname or a valid URI without any request paths
    If the service endpoints are not allowed or valid, the status service endpoints are not modified.

depends on openshift/api#599

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.

Comment thread pkg/operator/aws_platform_service_location/OWNERS
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. label Apr 13, 2020
@abhinavdahiya
Copy link
Copy Markdown
Contributor Author

/retest


func validateServiceURL(uri string) error {
endpoint := uri
if !schemeRE.MatchString(endpoint) {
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.

This should really be a parseable URL or it shouldn't. The sometimes API seems "nicer" but it ultimately makes for complication. Let's do a straight url.Parse and then have a list of schemes we allow. I don't think empty should be allowed and I would require https until we have a reason not to.

Comment thread pkg/operator/aws_platform_service_location/controller.go
@deads2k
Copy link
Copy Markdown
Contributor

deads2k commented Apr 15, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 15, 2020
abhinavdahiya and others added 3 commits April 16, 2020 07:41
…ied service endpoints to status

The controller only works for AWS platform
THe service endpoints are validated before syncing to the the status,
- no duplicates should be specified for a service
- the URL must be hostname or a valid URI without any request paths
If the service endpoints are not allowed or valid, the status service endpoints are not modified.
@openshift-ci-robot openshift-ci-robot removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 16, 2020
@fabianofranz
Copy link
Copy Markdown

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 16, 2020
@openshift-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavdahiya, deads2k, fabianofranz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@abhinavdahiya
Copy link
Copy Markdown
Contributor Author

/retest

2 similar comments
@abhinavdahiya
Copy link
Copy Markdown
Contributor Author

/retest

@abhinavdahiya
Copy link
Copy Markdown
Contributor Author

/retest

@openshift-merge-robot openshift-merge-robot merged commit d6f34a3 into openshift:master Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants