infraly / k8s-on-openstack

An opinionated way to deploy a Kubernetes cluster on top of an OpenStack cloud.
Apache License 2.0
112 stars 48 forks source link

OpenStack flavor configurable by name #32

Closed HaseHarald closed 6 years ago

HaseHarald commented 6 years ago

Hi there,

I needed the ability to specify the OpenStack flavor by name. Just giving it the amount of RAM to use was not sufficient for my project. So I implemented the ability to configure NODE_FLAVOR and MASTER_FLAVOR. If not set, it defaults to the old behavior and uses the configured amount of RAM, so it should be fully backwards compatible.

Thought maybe someone else could use this and wanted to share.

ctrlaltdel commented 6 years ago

Hi @HaseHarald,

Thanks for the contribution, looks indeed like a useful feature!

However, the code duplication doesn't look so elegant and I guess that it should be possible to achieve the same result by setting nodes_flavor_ram to default(omit) when nodes_flavor_name was specified using some jinja2 magic.

Does this sounds good to you?

HaseHarald commented 6 years ago

Hello @ctrlaltdel ,

yes that sounds very good to me. That was an initial intention when I started changing the ansible tasks. However I didn't manage to accomplish this in the first try. Thanks for the hint with the omit option. This looks much cleaner now.

I updated my code to reduce the duplication.