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

Initial refactors to bootstrap self-contained translator #1101

Merged
merged 2 commits into from
May 27, 2020

Conversation

rramkumar1
Copy link
Contributor

@rramkumar1 rramkumar1 commented May 12, 2020

This is simply moving code around for now. As this translator package evolves, it will become much more self-contained and there will only be a single interaction point (e.g ToCompositeUrlMap will be no longer exported).

This PR has two commits which implements the simplest refactors.

/assign @bowei


This change is Reviewable

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 12, 2020
@k8s-ci-robot k8s-ci-robot requested review from MrHohn and thockin May 12, 2020 18:45
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rramkumar1

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 12, 2020
@rramkumar1
Copy link
Contributor Author

cc @skmatti @spencerhance

@rramkumar1 rramkumar1 force-pushed the translator-refactor branch 4 times, most recently from 4cef680 to ccebf6e Compare May 12, 2020 19:29
limitations under the License.
*/

package translator
Copy link
Contributor

@skmatti skmatti May 12, 2020

Choose a reason for hiding this comment

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

There is a translator package under pkg/controller

Do we want to use a single package for all the translator methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is eventually where I want to get to, yes. I am slowly going to move more and more stuff from pkg/controller/translator to pkg/translator.

@rramkumar1 rramkumar1 force-pushed the translator-refactor branch from ccebf6e to a8e6007 Compare May 12, 2020 23:06
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 12, 2020
@rramkumar1 rramkumar1 changed the title Move function which generated composite URLMap to translator pkg Initial refactors to bootstrap self-contained translator May 12, 2020
@rramkumar1 rramkumar1 force-pushed the translator-refactor branch 2 times, most recently from 227efb7 to 86f2835 Compare May 13, 2020 17:46
}

// TLSCertsFromSecretsLoader loads TLS certs from kubernetes secrets.
type TLSCertsFromSecretsLoader struct {
noOPValidator
Client kubernetes.Interface
}

// Ensure that TLSCertsFromSecretsLoader implements TlsLoader interface.
var _ TlsLoader = &TLSCertsFromSecretsLoader{}

func (t *TLSCertsFromSecretsLoader) Load(ing *v1beta1.Ingress) ([]*loadbalancers.TLSCerts, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: this code does not have unit tests right now. I plan on adding some in a follow up PR.

Copy link
Contributor

@spencerhance spencerhance left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@skmatti skmatti left a comment

Choose a reason for hiding this comment

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

lgtm small nits

@rramkumar1 rramkumar1 force-pushed the translator-refactor branch from 7dff98a to fb59808 Compare May 27, 2020 13:40
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 27, 2020
@rramkumar1 rramkumar1 force-pushed the translator-refactor branch from fb59808 to 34f0947 Compare May 27, 2020 13:43
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 27, 2020
@rramkumar1 rramkumar1 merged commit 85f7e0f into kubernetes:master May 27, 2020
// NewEnv returns an Env for the given Ingress.
func NewEnv(ing *v1beta1.Ingress, client kubernetes.Interface) (*Env, error) {
ret := &Env{Ing: ing, SecretsMap: make(map[string]*api_v1.Secret)}
secrets, err := client.CoreV1().Secrets(ing.Namespace).List(context.TODO(), meta_v1.ListOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

this changes from requiring get access only to the secrets referenced in the ingress to list access on all secrets in the namespace. this PR claimed to just be a refactor, I would not expect it to change secret access to list and require expanded permissions.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

opened #1188 to revert to previous behavior

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants