Skip to content

inject proxy env vars into requesting workload resources#224

Merged
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
deads2k:proxy
Jul 31, 2019
Merged

inject proxy env vars into requesting workload resources#224
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
deads2k:proxy

Conversation

@deads2k
Copy link
Copy Markdown
Contributor

@deads2k deads2k commented Jul 18, 2019

set .metadata.annotations["config.openshift.io/inject-proxy"]="container1,initcontainer2"
to inject into specified container names

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 18, 2019
@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented Jul 18, 2019

@ironcladlou @bparees fyi

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 18, 2019
@bparees
Copy link
Copy Markdown
Contributor

bparees commented Jul 18, 2019

/cc @abhinavdahiya @danehans

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@bparees: GitHub didn't allow me to request PR reviews from the following users: danehans.

Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

/cc @abhinavdahiya @danehans

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.

@bparees
Copy link
Copy Markdown
Contributor

bparees commented Jul 18, 2019

also /cc @adambkaplan @dmage @cdaley as this would be relevant to the registry operator if it were implemented, since it is currently managing its own proxy env config (inconveniently).

@deads2k deads2k closed this Jul 22, 2019
@deads2k deads2k reopened this Jul 22, 2019

// if proxy injection is requested, get the proxy values and use them
// TODO You'll want a mutation helper that takes a pointer to a pod spec so you can wire it to other workload resources
if containerNamesString := deployment.Annotations["config.openshift.io/inject-proxy"]; len(containerNamesString) > 0 {
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.

Not terrible.

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.

Which operators would use this? The ones that need all of their traffic to go through the proxy, including service network (I assume status.noProxy must ALWAYS contain service network or you cause an outage?)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

auth operator for example....

the noProxy will be provided by network operator which should set these (I asked him same question during arch call ;-)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The image registry operator may use this. We already have similar logic inside of our reconciliation loop. The expectation is that noProxy covers the API server. And our operator needs to interact with external services like S3.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the noProxy will be provided by network operator which should set these

That's correct. I plan to enforce the default noProxy values as part of openshift/cluster-network-operator#245

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.

@danehans the registry operator communicates to cloud apis even when the cluster is not running on that particular cloud.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@bparees the registry operator is then responsible for augmenting the cluster-wide noProxy with additional no proxy values, correct? This is the WIP implementation of the cloud metadata ip.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@danehans I don't know if that is desirable, particularly if a customer wants their baremetal cluster to have all outbound traffic go through their proxy (and yet still use s3 or other cloud provider storage as their backend).

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.

@bparees the registry operator is then responsible for augmenting the cluster-wide noProxy with additional no proxy values, correct?

? My point is that the registry operator has a need to use the proxy configuration when it is talking to the cloudapis that exist outside the cloudprovider the cluster is running on. NoProxy is irrelevant.

@dmage was observing that the registry operator has a use for this proxy env injection. You said they didn't need it because they are talking to cloud apis, but that is incorrect. They are talking to cloudapis, but not cloudapis from the cluster's cloud provider, therefore they will need to go through the proxy (assuming the customer's network topology requires it, which would be our assumption since it's external traffic like any other).

If the customer does not want their AWS api calls going through the proxy (and assuming their network topology doesn't require it), the admin would have to add the AWS api endpoints to their NoProxy value.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't know if that is desirable, particularly if a customer wants their baremetal cluster to have all outbound traffic go through their proxy (and yet still use s3 or other cloud provider storage as their backend).

@adambkaplan the cloud metadata ip will not be set for vsphere, baremetal and non platform types.

@smarterclayton
Copy link
Copy Markdown
Contributor

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 23, 2019
@danehans
Copy link
Copy Markdown

@deads2k @sttts I'm in favor of this approach.

@danehans
Copy link
Copy Markdown

@deads2k @sttts is this PR moving forward or just a reference implementation that operators can follow?

@smarterclayton
Copy link
Copy Markdown
Contributor

@abhinavdahiya have you looked at this PR yet?

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 31, 2019
@deads2k deads2k changed the title [WIP] demonstrate proxy injection inject proxy env vars into requesting workload resources Jul 31, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 31, 2019
@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented Jul 31, 2019

We've agreed to go this route.

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 31, 2019
Comment thread lib/resourcebuilder/apps.go
@abhinavdahiya
Copy link
Copy Markdown
Contributor

How do we handle a case where an operator wants to remove the envs from it's containers as part of the update??

Comment thread lib/resourcebuilder/apps.go Outdated

"k8s.io/klog"

v1 "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1"
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.

nit configv1

Comment thread lib/resourcebuilder/podspec.go
@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented Jul 31, 2019

How do we handle a case where an operator wants to remove the envs from it's containers as part of the update??

It's hard to imagine where that's useful. We can build a special value into the annotation if it comes up.

set .metadata.annotations["config.openshift.io/inject-proxy"]="container1,initcontainer2"
to inject into specified container names
@abhinavdahiya
Copy link
Copy Markdown
Contributor

How do we handle a case where an operator wants to remove the envs from it's containers as part of the update??

It's hard to imagine where that's useful. We can build a special value into the annotation if it comes up.

sure.

I think this get's other operators unblocked for time being. i'll take a todo to add some docs and any fixes needed for 4.1 to 4.2 upgrade.

Thanks!

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

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

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 31, 2019
@abhinavdahiya
Copy link
Copy Markdown
Contributor

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 31, 2019
Comment thread lib/resourcebuilder/podspec.go
@abhinavdahiya
Copy link
Copy Markdown
Contributor

/hold cancel

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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants