contiv / netplugin

Container networking for various use cases
Apache License 2.0
513 stars 177 forks source link

Proposal: Use Jinja template for files that need to be edited before using. #1117

Closed magic7s closed 6 years ago

magic7s commented 6 years ago

Use a common templating format for files that need to be edited with local data before running. Such as netplugin/install/k8s/contiv/contiv-base.yaml. Ansible can use this format directly and local variables can be mapped to template variables. Document each variable used near the top with comments.

Also enforce commits do not include developers local data. (i.e. netplugin/install/k8s/contiv/contiv-base.yaml:420

Jinja template information

tiewei commented 6 years ago

Thank you for raise the question @magic7s ! In fact the https://github.com/contiv/netplugin/blob/master/install/k8s/contiv/contiv-base.yaml#L420 is not the developer local data, it's the hard coded service ip so that the etcd could be reached in flat network case.

We didn't use contiv-base.yaml as template was because the intention is to make it as a file could install contiv in k8s with kubeadm, it should work without changes. However due to limitations of netplugin having, we have to use contiv-compose use-release -v 1.2.1 --k8s-api https://foo:bar contiv-base.yaml in order to make it work in most cases. The contiv-compose is used for editing the contiv-base.yaml in order to make it work in user's k8s environment, or add state_exporter, auth_proxy if they are required for services other than base components. With that described, https://github.com/contiv/netplugin/blob/master/install/k8s/cluster/k8smaster_centos.sh#L20-L23 is an example how we'd like user install contiv Also the reason not using Jinja is because it has a lot dependencies on python packages, current compose only leverage python-yaml out of standard library makes it easier to be run on user environment. Please let us know your thoughts, thank you !

magic7s commented 6 years ago

This makes a lot of sense, thank you. I didn't realize contiv-compse was an executable (maybe add .py to the file). I have been trying to automate an install with ansible and was using the old yaml files. Your recent commits have been great but I still needed to download and edit the files. Thank you for pointing contiv-compose out to me. I think the docs at netplugin/install/k8s/README.md need to be updated based on this change. Thanks!