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

Endpoints controller can print sensitive pod info when errors occur #3729

Merged
merged 1 commit into from
Jan 22, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/service/endpoints_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ func (e *EndpointController) SyncServiceEndpoints() error {
continue
}

glog.V(3).Infof("About to update endpoints for service %v", service.Name)
glog.V(5).Infof("About to update endpoints for service %s/%s", service.Namespace, service.Name)
Copy link
Member

Choose a reason for hiding this comment

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

We should land on one syntax for printing namespace and name (for all sorts of objects) "namespace/name" vs "name.namespace" vs other.

namepsace/name has an advantage when both name and namespace are DNS subdomains: "foo.bar/quux.zorb" is clear, while "quux.zorb.foo.bar" is ambiguous.

If we all agree, we should start enforcing it in code reviews and fixing it up when we find it.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe write a util.JoinName(namespace, name string) string function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also UID and ResourceVersion

----- Original Message -----

@@ -56,10 +56,10 @@ func (e *EndpointController) SyncServiceEndpoints()
error {
continue
}

  •   glog.V(3).Infof("About to update endpoints for service %v",
    
    service.Name)
  •   glog.V(5).Infof("About to update endpoints for service %s/%s",
    
    service.Namespace, service.Name)

We should land on one syntax for printing namespace and name (for all sorts
of objects) "namespace/name" vs "name.namespace" vs other.

namepsace/name has an advantage when both name and namespace are DNS
subdomains: "foo.bar/quux.zorb" is clear, while "quux.zorb.foo.bar" is
ambiguous.

If we all agree, we should start enforcing it in code reviews and fixing it
up when we find it.


Reply to this email directly or view it on GitHub:
https://github.com/GoogleCloudPlatform/kubernetes/pull/3729/files#r23407088

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking maybe meta.Identify(runtime.Object) or something. We need to be able to crack the object efficiently and work for runtime.Unknown as well.

----- Original Message -----

@@ -56,10 +56,10 @@ func (e *EndpointController) SyncServiceEndpoints()
error {
continue
}

  •   glog.V(3).Infof("About to update endpoints for service %v",
    
    service.Name)
  •   glog.V(5).Infof("About to update endpoints for service %s/%s",
    
    service.Namespace, service.Name)

Maybe write a util.JoinName(namespace, name string) string function?


Reply to this email directly or view it on GitHub:
https://github.com/GoogleCloudPlatform/kubernetes/pull/3729/files#r23407127

pods, err := e.client.Pods(service.Namespace).List(labels.Set(service.Spec.Selector).AsSelector())
if err != nil {
glog.Errorf("Error syncing service: %#v, skipping.", service)
glog.Errorf("Error syncing service: %s/%s, skipping", service.Namespace, service.Name)
resultErr = err
continue
}
Expand All @@ -68,11 +68,11 @@ func (e *EndpointController) SyncServiceEndpoints() error {
for _, pod := range pods.Items {
port, err := findPort(&pod, service.Spec.ContainerPort)
if err != nil {
glog.Errorf("Failed to find port for service: %v, %v", service, err)
glog.Errorf("Failed to find port for service %s/%s: %v", service.Namespace, service.Name, err)
continue
}
if len(pod.Status.PodIP) == 0 {
glog.Errorf("Failed to find an IP for pod: %v", pod)
glog.Errorf("Failed to find an IP for pod %s/%s", pod.Namespace, pod.Name)
continue
}
endpoints = append(endpoints, net.JoinHostPort(pod.Status.PodIP, strconv.Itoa(port)))
Expand Down Expand Up @@ -100,7 +100,7 @@ func (e *EndpointController) SyncServiceEndpoints() error {
} else {
// Pre-existing
if endpointsEqual(currentEndpoints, endpoints) {
glog.V(3).Infof("endpoints are equal for %s, skipping update", service.Name)
glog.V(5).Infof("endpoints are equal for %s/%s, skipping update", service.Namespace, service.Name)
continue
}
_, err = e.client.Endpoints(service.Namespace).Update(newEndpoints)
Expand Down