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

Generic service type handler for kompose #277

Merged
merged 1 commit into from
Nov 21, 2016

Conversation

surajssd
Copy link
Member

@surajssd surajssd commented Nov 9, 2016

Moved label handling code from Transformer to loader, to make it generic to handle creating service types.

Added new attribute to ServiceConfig which gets populated in loader.

Fixes #273

@surajssd
Copy link
Member Author

surajssd commented Nov 9, 2016

@cdrage I would like your view on the test function being modified and moved to new place, with less checks? Jump to https://github.com/kubernetes-incubator/kompose/pull/277/files#diff-8aba3d6a079386eaab47ed176d32d43cR23

@@ -207,6 +207,15 @@ func (c *Compose) LoadFile(file string) kobject.KomposeObject {
}
}

// canonical custom label handler
Copy link
Member

Choose a reason for hiding this comment

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

mind adding another comment as to what this actually does, other than "custom label handler"? example?

switch strings.ToLower(ServiceType) {
case "nodeport":
return string(api.ServiceTypeNodePort)
case "", "clusterip":
Copy link
Member

Choose a reason for hiding this comment

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

this should be first since it has "". (clusterip, nodeport then loadbalancer)

case "loadbalancer":
return string(api.ServiceTypeLoadBalancer)
default:
logrus.Fatalf("Unknown value '%s', supported values are 'NodePort, ClusterIP and LoadBalancer' ", ServiceType)
Copy link
Member

Choose a reason for hiding this comment

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

or, not and. Should be: NodePort, ClusterIP or LoadBalancer

t.Errorf("Expected %q, got %q", tt.serviceType, result)
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

👍

}
}

svc.Spec.Type = api.ServiceType(service.ServiceType)
Copy link
Member

Choose a reason for hiding this comment

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

👍

Moved label handling code from Transformer to loader,
to make it generic to handle creating service types.

Added new attribute to ServiceConfig which gets populated
in loader.

Fixes kubernetes#273
@surajssd surajssd force-pushed the generic-service-type branch from e12bf09 to bb9e4fb Compare November 16, 2016 16:31
@surajssd
Copy link
Member Author

@cdrage addressed all your concerns!

@surajssd
Copy link
Member Author

@ngtuna @kadel need your say on this PR as well to merge it!

@kadel kadel merged commit 04b1d00 into kubernetes:master Nov 21, 2016
@surajssd
Copy link
Member Author

@kadel thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants