Skip to content

Added EnableIPTargetType feature gate to controller #9

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

Conversation

thejasn
Copy link

@thejasn thejasn commented Apr 7, 2022

Signed-off-by: thejasn [email protected]

Issue

Fixes: kubernetes-sigs#2559

Description

Added a controller flag to toggle AWS VPC CNI dependent features. Currently, can be used to enforce the correct target-type annotation on Ingress type resources.

-->

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@thejasn thejasn changed the title added DisableAWSVpcCNI feature gate to controller Added DisableAWSVpcCNI feature gate to controller Apr 7, 2022
@openshift-ci openshift-ci bot requested review from arjunrn and Miciah April 7, 2022 13:01
@thejasn thejasn force-pushed the ocp/feature/toggle-vpc-cni-options branch from 403bdb1 to 53d630b Compare April 7, 2022 14:06
@arjunrn
Copy link

arjunrn commented Apr 7, 2022

/assign @alebedev87
/lgtm
/retest

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 7, 2022
@arjunrn
Copy link

arjunrn commented Apr 7, 2022

/retest

@@ -14,6 +14,7 @@ const (
WeightedTargetGroups Feature = "WeightedTargetGroups"
ServiceTypeLoadBalancerOnly Feature = "ServiceTypeLoadBalancerOnly"
EndpointsFailOpen Feature = "EndpointsFailOpen"
DisableAWSVpcCNI Feature = "DisableAWSVpcCNI"

Choose a reason for hiding this comment

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

Doesn't it sound a little misleading? Like if ALBC would have a power to disable the CNI.
Also, it mentions the CNI plugin name, I didn't see any other CNI plugins which would have the directly accessible POD IPs but maybe there are some in the wild (or will come).

How about EnableIPTargetType similar the service controller feature gate from another PR?

Copy link
Author

Choose a reason for hiding this comment

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

I agree the name sounds misleading. Basically, we wanted to introduce a flag that toggles all features dependent on AWS VPC CNI, currently it's just ip target-type. How about AWSVpcCNIAvailable?

Copy link

Choose a reason for hiding this comment

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

I think EnableIPTargetType is a more appropriate name. That fact that it is dependent on the VPC CNI being available is an internal detail.

@@ -40,7 +40,8 @@ func NewDefaultModelBuilder(k8sClient client.Client, eventRecorder record.EventR
authConfigBuilder AuthConfigBuilder, enhancedBackendBuilder EnhancedBackendBuilder,
trackingProvider tracking.Provider, elbv2TaggingManager elbv2deploy.TaggingManager,
vpcID string, clusterName string, defaultTags map[string]string, externalManagedTags []string, defaultSSLPolicy string,
backendSGProvider networkingpkg.BackendSGProvider, enableBackendSG bool, disableRestrictedSGRules bool, logger logr.Logger) *defaultModelBuilder {
backendSGProvider networkingpkg.BackendSGProvider, enableBackendSG bool, disableRestrictedSGRules bool, disableAWSVpcCNIflag bool,
logger logr.Logger) *defaultModelBuilder {

Choose a reason for hiding this comment

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

I don't see the change in the ingress group reconcile which is supposed to pass the boolean from the feature gate.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed, had missed that commit.

@@ -214,6 +214,9 @@ func (t *defaultModelBuildTask) buildTargetGroupTargetType(_ context.Context, sv
case string(elbv2model.TargetTypeInstance):
return elbv2model.TargetTypeInstance, nil
case string(elbv2model.TargetTypeIP):
if t.disableAWSVpcCNIFlag {

Choose a reason for hiding this comment

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

Why the feature gate is only applicable for Ingresses? The service type can also have IP target type.

Copy link
Author

Choose a reason for hiding this comment

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

This was a miss from my side, fixed it.

@openshift-ci openshift-ci bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm Indicates that a PR is ready to be merged. labels Apr 9, 2022
@thejasn thejasn force-pushed the ocp/feature/toggle-vpc-cni-options branch from 9aa7f82 to 8cfec35 Compare April 11, 2022 05:15
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 11, 2022
@thejasn thejasn force-pushed the ocp/feature/toggle-vpc-cni-options branch 3 times, most recently from 8c03fb8 to 8038108 Compare April 13, 2022 07:48
},
},
},
wantErr: errors.New("ingress: ns-1/ing-1: unsupported targetType: ip when enableIPTargetType is false"),
Copy link

Choose a reason for hiding this comment

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

Suggested change
wantErr: errors.New("ingress: ns-1/ing-1: unsupported targetType: ip when enableIPTargetType is false"),
wantErr: errors.New("ingress: ns-1/ing-1: unsupported targetType: ip when EnableIPTargetType is false"),

@@ -339,6 +339,9 @@ func (t *defaultModelBuildTask) buildTargetType(_ context.Context, port corev1.S
var lbTargetType string
lbTargetType = string(t.defaultTargetType)
_ = t.annotationParser.ParseStringAnnotation(annotations.SvcLBSuffixTargetType, &lbTargetType, t.service.Annotations)
if lbTargetType == LoadBalancerTargetTypeIP && !t.enableIPTargetType {
return "", errors.Errorf("unsupported targetType: %v when enableIPTargetType is %v", lbTargetType, t.enableIPTargetType)
Copy link

Choose a reason for hiding this comment

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

Suggested change
return "", errors.Errorf("unsupported targetType: %v when enableIPTargetType is %v", lbTargetType, t.enableIPTargetType)
return "", errors.Errorf("unsupported targetType: %v when EnableIPTargetType is %v", lbTargetType, t.enableIPTargetType)

@thejasn thejasn changed the title Added DisableAWSVpcCNI feature gate to controller Added EnableIPTargetType feature gate to controller Apr 13, 2022
review changes and tests

Signed-off-by: thejasn <[email protected]>
@thejasn thejasn force-pushed the ocp/feature/toggle-vpc-cni-options branch from 8038108 to be3bcd3 Compare April 13, 2022 10:10
@alebedev87
Copy link

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 21, 2022
@alebedev87
Copy link

/approve

@openshift-ci
Copy link

openshift-ci bot commented Apr 22, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alebedev87, thejasn

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 22, 2022
@thejasn
Copy link
Author

thejasn commented Apr 22, 2022

/label docs-approved
/label qe-approved
/label px-approved

@openshift-ci openshift-ci bot added docs-approved Signifies that Docs has signed off on this PR qe-approved Signifies that QE has signed off on this PR labels Apr 22, 2022
@openshift-ci openshift-ci bot added the px-approved Signifies that Product Support has signed off on this PR label Apr 22, 2022
@openshift-ci
Copy link

openshift-ci bot commented Apr 22, 2022

@thejasn: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit d943007 into openshift:main Apr 22, 2022
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. docs-approved Signifies that Docs has signed off on this PR lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide an easy way to enable/disable AWS VPC CNI dependent features/flags
4 participants