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

Validate OS-kubespray cluster before provision #334

Merged
merged 2 commits into from Jul 6, 2018

Conversation

katyafervent
Copy link
Contributor

No description provided.

Ekaterina Chernova added 2 commits July 6, 2018 10:52
If there is an error in user-input data, return 400
instead of 500.
Validation is made for:
* valid image
* valid flavor
* valid avaliability zone
* valid ip for dns
* valid master node value
* valid network
And not initial string
self.meta["master_count"] = mc
self.meta["slave_count"] = self.cluster.metadata["slave_count"]

self.meta["dns"] = [validate_ip(ip) for ip in

Choose a reason for hiding this comment

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

I suggest to place it after all is None checks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why? I placed it here since it performs faster then checks below, so if error will be here, response will be sent faster

Choose a reason for hiding this comment

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

Why is it faster, I don't get it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since it doesn't send api call to the openstack

Choose a reason for hiding this comment

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

Oh, okay

Copy link
Contributor

@naumvd95 naumvd95 left a comment

Choose a reason for hiding this comment

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

commented, also i suggest to rename PR as
Validate OS-kubespray cluster before provision #334

resources = {
"masters": [],
"slaves": [],
}
network = self.c.create_network(self.stack_name)
subnet = self.c.create_subnet(network, cidr="10.1.0.0/16",
subnet_name=self.stack_name,
dns_nameservers=dns)
dns_nameservers=self.meta['dns'])
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe get() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some fields are required and some are not, let me also send 400 if required field is not provided

Copy link
Contributor

Choose a reason for hiding this comment

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

okok

router = self.c.create_router(name=self.stack_name,
ext_gateway_net_id=ext_net.id)
ext_gateway_net_id=self.meta['ext_net'].id)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe get() ?

flavor=flavor,
servers_range=range(self.meta["slave_count"]),
image=self.meta['image'],
flavor=self.meta['flavor'],
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe get() ?

@naumvd95 naumvd95 changed the title Validate before provision Validate OS-kubespray cluster before provision Jul 6, 2018
@naumvd95 naumvd95 merged commit cc3472d into master Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants