-
Notifications
You must be signed in to change notification settings - Fork 299
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
merge Ingress NEG annotation and Expose NEG annotation #350
Conversation
7dc2bd4
to
d672649
Compare
/assign freehan |
/ok-to-test |
pkg/annotations/service.go
Outdated
// ExposeNEGAnnotationKey key, and maps ServicePort to attributes of the NEG that should be | ||
// NegAnnotation is the format of the annotation associated with the | ||
// NEGAnnotationKey key. | ||
// Ingress indicates whether or not the Service backs an Ingress. If yes, then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to the "ingress" key
"ingress" indicates whether to enable NEG feature for Ingress referencing the service. Each NEG correspond to a service port. NEGs will be created and managed under the following conditions:
1. Service is referenced by ingress
2. "ingress" is set to "true". Default to "false"
When the above conditions are satisfied, Ingress will create load balancer and target corresponding NEGs as backends. Service Nodeport is no longer required.
pkg/annotations/service.go
Outdated
type ExposeNegAnnotation map[int32]NegAttributes | ||
type NegAnnotation struct { | ||
Ingress bool `json:"ingress,omitempty"` | ||
ExposedPorts map[int32]NegAttributes `json:"exposed_ports,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comment:
ExposedPorts specifies the service ports to be exposed as stand-alone NEG. The exposed NEGs will be created and managed by NEG controller.
d672649
to
bae2424
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall
pkg/annotations/service.go
Outdated
// ExposeNEGAnnotationKey key, and maps ServicePort to attributes of the NEG that should be | ||
// NegAnnotation is the format of the annotation associated with the | ||
// NEGAnnotationKey key. | ||
// WARNING: The feature will NOT be effective in the following circumstances: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this WARNING
pkg/annotations/service.go
Outdated
// WARNING: The feature will NOT be effective in the following circumstances: | ||
// 1. Service is not referenced in any ingress. | ||
// 2. Adding this annotation on ingress. | ||
// ExposedPorts maps ServicePort to attributes of the NEG that should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to the top of ExposedPorts Attribute
74d28a0
to
9435da4
Compare
9435da4
to
0db5cca
Compare
pkg/neg/controller.go
Outdated
service, err = svcClient.Update(service) | ||
if err != nil { | ||
return err | ||
} | ||
return c.serviceLister.Update(service) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to Update serviceLister
pkg/neg/controller.go
Outdated
service, err = svcClient.Update(service) | ||
if err != nil { | ||
return err | ||
} | ||
return c.serviceLister.Update(service) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to Update serviceLister
pkg/neg/controller.go
Outdated
|
||
// Remove NEG Status Annotation when no NEG is needed | ||
if len(portMap) == 0 { | ||
if _, ok := service.Annotations[annotations.NEGStatusKey]; ok { | ||
// TODO: use PATCH to remove annotation | ||
delete(service.Annotations, annotations.NEGStatusKey) | ||
glog.V(2).Infof("Removing expose NEG annotation from service: %s/%s", namespace, name) | ||
service, err = svcClient.Update(service) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to track service, just return err
0db5cca
to
1e78753
Compare
/lgtm |
Automatic merge from submit-queue (batch tested with PRs 65338, 64535). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. [GCE] e2e test for expose neg on gce ingress **What this PR does / why we need it**: - Adds e2e test for the expose NEG annotation (which allows for standalone NEGs) **Special notes for your reviewer**: Note, kubernetes/ingress-gce#350 must be merged first before this is merged. `[Unreleased]` tag is on this PR because it depends on code from kubernetes/ingress-gce#350 and kubernetes/ingress-gce#284 being in an Ingress release. Will update this test and test-infra once this is released in the next Ingress. **Release note**: ```release-note NONE ```
Follow-up to #284 .
{"ingress": true,"exposed_ports":{"3000":{},"4000":{}}}