8000 Change k8s ServiceTypes to be changeable by withsmilo · Pull Request #667 · ucbrise/clipper · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Change k8s ServiceTypes to be changeable #667

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

Merged

Conversation

withsmilo
Copy link
Collaborator
@withsmilo withsmilo commented Apr 4, 2019

When creating a KubernetesManager object, you could define own ServiceTypes. For example,

cm = KubernetesContainerManager(
         ....,
         service_types={
             'redis': 'NodePort',
             'management': 'LoadBalancer',
             'query': 'LoadBalancer',
             'query-rpc': 'ClusterIP',
             'metric': 'LoadBalancer'})

When creating a KubernetesManager object, you could define own ServiceTypes. For example,
cm = KubernetesContainerManager(
         ....,
         service_types={
             'redis': 'NodePort',
             'management': 'LoadBalancer',
             'query': 'LoadBalancer',
             'query-rpc': 'ClusterIP',
             'metric': 'LoadBalancer'})
@withsmilo withsmilo self-assigned this Apr 4, 2019
@withsmilo withsmilo requested a review from simon-mo April 4, 2019 04:41
@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1885/
Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1886/
Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1888/
Test FAILed.

@simon-mo
Copy link
Contributor
simon-mo commented Apr 4, 2019

@withsmilo Thanks for this patch. However, I think we also need to patch how connect() works because it currently assumes NodePort like line:

self.clipper_management_port = p.node_port

@@ -168,6 +192,18 @@ def __init__(self,
self.cluster_identifier = "{ns}-{cluster}".format(
ns=self.k8s_namespace, cluster=self.cluster_name)

self.service_types = DEFAULT_CLIPPER_SERVICE_TYPES
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why don't we make this part as a function and add some tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rkooo567 , OK. Let me refactor this part.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rkooo567 , What tests are we needed here in additional?

Copy link
Collaborator
@rkooo567 rkooo567 Apr 5, 2019

Choose a reason for hiding this comment

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

I thought just a simple unit test? Like if this function raises Exception correctly when wrong input is given and etc. I could find that the current CI fails on line 200 (when you raise ClipperException), so it can be good if we can write some unit tests inside one of integration test files.

Copy link
@wcwang07 wcwang07 Apr 5, 2019

Choose a reason for hiding this comment

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

@withsmilo @rkooo567 can we add

def set_clipper_svc_types(self, svctype, svcname):
for key in self.OFFICIAL_K8S_SERVICE_TYPE:
if(svctype.lower()==key.lower()):
self.DEFAULT_CLIPPER_SERVICE_TYPES[svcname]=key

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rkooo567 @wcwang07
Sorry about late reply. I refactored my PR entirely.

@withsmilo
Copy link
Collaborator Author

@simon-mo , I will try to add something to need.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1887/
Test FAILed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1923/
Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1924/
Test PASSed.


query_frontend_ports = self._k8s_v1.read_namespaced_service(
if self.service_types['management'] in [CLUSTER_IP, NODE_PORT]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why don't we read service_types from our Kubernetes definitions (yaml file) in the connect function? Otherwise we should always specify the correct self.service_types whenever we initiate KubernetesContainerManager.

It shouldn't matter when we initiate KubernetesContainerManager for the first time for start_clipper. But, let's say we already started clipper and just wanted to connect to the cluster using ClipperConnection(KubernetesContainerManager()).connect(). If you forget to write service_types, it will be set to be None and this part might be broken.

Copy link
Collaborator Author
@withsmilo withsmilo May 3, 2019

Choose a reason for hiding this comment

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

@rkooo567 You're right. Thank you for your kind advice. I will fix it as soon as possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rkooo567 : According to your advice, I added a new mechanism to read/write service_types from/to a yaml file. You can connect to the executing Clipper cluster easily with service_types(None), which will be loaded automatically from a yaml file saved when we started it. If you call 'stop_all()', the yaml file will be removed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you! Everything looks good to me :)

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1925/
Test PASSed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1926/
Test FAILed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1927/
Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1929/
Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1928/
Test PASSed.

@withsmilo
Copy link
Collaborator Author

@simon-mo : Please review this PR. Can we use 'LoadBalancer' service type with Travis CI?

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1933/
Test PASSed.

@rkooo567
Copy link
Collaborator

This PR looks good to me. But since it is not a simple PR, I will wait for @simon-mo's approval.

Copy link
Contributor
@simon-mo simon-mo left a comment

Choose a reason for hiding this comment

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

lgtm

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1961/
Test PASSed.

@simon-mo simon-mo merged commit 1bf0aa8 into ucbrise:develop May 14, 2019
@withsmilo withsmilo deleted the modify_service_type_to_be_changeable branch May 14, 2019 22:14
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.

5 participants
0