Skip to content
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

Bug 1706576: Eliminate ec2 metadata dependency #238

Conversation

ironcladlou
Copy link
Contributor

Access to ec2 metadata will soon be restricted
(openshift/origin#22826). Eliminate the ec2 metadata
dependency by discovering AWS region information from cluster config. This
commit uses the deprecated install config for metatadata; once
openshift/installer#1725 merges, supported cluster
config will provide the region information and the code can be refactored.

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 14, 2019
@ironcladlou
Copy link
Contributor Author

This is an alternative to #235.

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 14, 2019
Access to ec2 metadata will soon be restricted
(openshift/origin#22826). Eliminate the ec2 metadata
dependency by discovering AWS region information from cluster config. This
commit uses the deprecated install config for metatadata; once
openshift/installer#1725 merges, supported cluster
config will provide the region information and the code can be refactored.
@@ -122,6 +138,7 @@ func createDNSManager(cl client.Client, operatorConfig operatorconfig.Config, in
AccessID: string(awsCreds.Data["aws_access_key_id"]),
AccessKey: string(awsCreds.Data["aws_secret_access_key"]),
DNS: dnsConfig,
Region: installConfig.Platform.AWS.Region,
Copy link
Contributor

Choose a reason for hiding this comment

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

We get the cloud provider from infraConfig and the aws region from installConfig. Is it possible to get the cloud provider from the installConfig too and do away with infraConfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You may be missing some context here — the kube-system/cluster-config-v1 ConfigMap is deprecated, and all its usages have (for the most part) been replaced by versioned public config API (e.g. configv1.Infrastructure). In that respect, this PR is actually a regression as we had already finished the API migration and now we're once again using the deprecated stuff (because ingress didn't need region in the public API until today when metadata became off-limits).

So, when region lands in the public API, we need a followup to revert this PR and switch to the new public API version.

Copy link
Contributor

@Miciah Miciah left a comment

Choose a reason for hiding this comment

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

Looks good.

region = config.Region
log.Info("using region from operator config", "region name", region)
}
if len(region) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think of using a switch with three cases (case len(aws.StringValue(sess.Config.Region)) > 0:, case len(config.Region) > 0:, and default:)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Worth another CI run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(related: might be able to remove sess.Config.Region support entirely and eliminate the branching — unless someone can remember why it's useful)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(in a followup)

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably not.

@ironcladlou
Copy link
Contributor Author

@openshift/sig-network-edge PTAL.

@Miciah
Copy link
Contributor

Miciah commented May 15, 2019

/lgtm

1 similar comment
@knobunc
Copy link

knobunc commented May 15, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 15, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ironcladlou, knobunc, Miciah

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:
  • OWNERS [Miciah,ironcladlou,knobunc]

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

@ironcladlou
Copy link
Contributor Author

/cherrypick release-4.1

@openshift-cherrypick-robot

@ironcladlou: once the present PR merges, I will cherry-pick it on top of release-4.1 in a new PR and assign it to you.

In response to this:

/cherrypick release-4.1

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.

@ironcladlou ironcladlou changed the title Eliminate ec2 metadata dependency Bug 1706576: Eliminate ec2 metadata dependency May 15, 2019
@openshift-merge-robot openshift-merge-robot merged commit c75352e into openshift:master May 15, 2019
@openshift-cherrypick-robot

@ironcladlou: new pull request created: #239

In response to this:

/cherrypick release-4.1

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.

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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants