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 Refactor of TargetProxy to Translator Package #1168

Merged
merged 1 commit into from
Jul 9, 2020

Conversation

spencerhance
Copy link
Contributor

Refactors TargetHttp/Https Proxy to Translator package, including SSL Policy.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 24, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @spencerhance. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 24, 2020
@spencerhance spencerhance changed the title Refactor TargetProxy to Translator Package Initial Refactor of TargetProxy to Translator Package Jun 24, 2020
@k8s-ci-robot k8s-ci-robot requested review from freehan and MrHohn June 24, 2020 19:54
@spencerhance
Copy link
Contributor Author

/assign @rramkumar1

@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 Jun 24, 2020
@spencerhance
Copy link
Contributor Author

@rramkumar1 I added another commit to handle sslPolicy. It gets a bit tricky since we the proxy only holds a string, but we use a pointer to hold all three states. We currently don't update the policy if the user deletes the FC or sets the policy to nil.

I'm not sure if there's a better way to handle this, or if the original commit makes more sense for now until we have a general solution for backendconfig/frontendconfig. Ideally in the future we should delete the policy if the FC is deleted.

@rramkumar1
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 8, 2020
@@ -37,6 +39,8 @@ import (
type Env struct {
// Ing is the Ingress we are translating.
Ing *v1beta1.Ingress
// FrontendConfig is the frontendconfig associated with the Ingress
FrontendConfig *frontendconfigv1beta1.FrontendConfig
Copy link
Contributor

Choose a reason for hiding this comment

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

Add TODO that this should eventually be a map of FrontendConfigs (similar to Secret)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// 1) policy is nil -> this returns nil
// 2) policy is an empty string -> this returns an empty string
// 3) policy is non-empty -> this constructs the resource path and returns it
func getSslPolicyLink(env *Env) (*string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove get

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}

for _, tc := range testCases {
env := &Env{FrontendConfig: tc.fc}
Copy link
Contributor

Choose a reason for hiding this comment

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

use t.Run and pass the description there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@spencerhance spencerhance force-pushed the translator-target-proxy branch from 6398ab1 to e97e46a Compare July 8, 2020 21:18
}

if !reflect.DeepEqual(result, tc.want) {
t.Errorf("desc: %q, l7.getSslPolicyLink() = %v, want %+v", tc.desc, result, tc.want)
Copy link
Contributor

Choose a reason for hiding this comment

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

don't need this anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops. Fixed that and the rest of the error

@spencerhance spencerhance force-pushed the translator-target-proxy branch from e97e46a to 67f5cc7 Compare July 9, 2020 04:32
@rramkumar1
Copy link
Contributor

/lgtm

@rramkumar1 rramkumar1 merged commit 4ac4fbf into kubernetes:master Jul 9, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 9, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rramkumar1, spencerhance

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 Jul 9, 2020
@spencerhance spencerhance deleted the translator-target-proxy branch July 9, 2020 19:14
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

3 participants