jusbrasil / kube-render Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Problem: What happens if I want to use multiple templates sources?
Reply: I can't
Solution: Make -u and -t be the same command as --template-source
and add multiple of them behavior an alias or priority declaration (we regex it for identify if it's a git path or local path
-t
or --template-source
multiple times passing alias source_path
something like: -t kube-templates ssh:github....
-t ssh://
or t /users/....
default.
aliasAlias approach could improve user experience if he wants to use multiple templates like:
-p default.deployment local.service something.hpa
I think that improve docs and change something on command interface could improve a lot of experience with kube-render, but here some tips that could help :)
Basically, we could identify if it is a github or local path, more improvement tips here (#17)
Once that we have -c
to add yml context files we don't need to specify a "workdir", we could only pass a full path on -c
and it's easier.
If you give a kube-render
it throws an error, we could only call --help instead.
Problem: What happens if I don't provide a -t or -u?
Reply: Errors haha
Solution: Get templates from a default folder (set by the user using an env-var like DEFAULT_KUBE_RENDER_TEMPLATE_DIR
)
We're experiencing failures on builds on images (for example, ubuntu) with python 3.10.
The output could be seen below:
2022-11-23T17:45:06.1240888Z Defaulting to user installation because normal site-packages is not writeable
2022-11-23T17:45:06.9680677Z Collecting kuberender
2022-11-23T17:45:07.0755784Z Downloading kuberender-0.3.6.tar.gz (5.7 kB)
2022-11-23T17:45:07.0829849Z Preparing metadata (setup.py): started
2022-11-23T17:45:08.3557812Z Preparing metadata (setup.py): finished with status 'done'
2022-11-23T17:45:08.3937555Z Collecting Jinja2==2.9.6
2022-11-23T17:45:08.4046276Z Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340 kB)
2022-11-23T17:45:08.4681899Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 340.7/340.7 KB 6.0 MB/s eta 0:00:00
2022-11-23T17:45:08.5690042Z Collecting MarkupSafe==1.1.1
2022-11-23T17:45:08.5779650Z Downloading MarkupSafe-1.1.1.tar.gz (19 kB)
2022-11-23T17:45:08.5859576Z Preparing metadata (setup.py): started
2022-11-23T17:45:08.7421951Z Preparing metadata (setup.py): finished with status 'done'
2022-11-23T17:45:08.8095910Z Collecting PyYAML==5.1
2022-11-23T17:45:08.8192631Z Downloading PyYAML-5.1.tar.gz (274 kB)
2022-11-23T17:45:08.8473941Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 274.2/274.2 KB 10.3 MB/s eta 0:00:00
2022-11-23T17:45:08.9406165Z Preparing metadata (setup.py): started
2022-11-23T17:45:09.1383262Z Preparing metadata (setup.py): finished with status 'done'
2022-11-23T17:45:09.1733720Z Collecting click==6.7
2022-11-23T17:45:09.1815550Z Downloading click-6.7-py2.py3-none-any.whl (71 kB)
2022-11-23T17:45:09.1911915Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 71.2/71.2 KB 8.6 MB/s eta 0:00:00
2022-11-23T17:45:09.2156245Z Collecting dpath==1.4.0
2022-11-23T17:45:09.2320908Z Downloading dpath-1.4.0.tar.gz (13 kB)
2022-11-23T17:45:09.2385978Z Preparing metadata (setup.py): started
2022-11-23T17:45:09.4499000Z Preparing metadata (setup.py): finished with status 'error'
2022-11-23T17:45:09.4558651Z error: subprocess-exited-with-error
2022-11-23T17:45:09.4559170Z
2022-11-23T17:45:09.4559801Z × python setup.py egg_info did not run successfully.
2022-11-23T17:45:09.4560382Z │ exit code: 1
2022-11-23T17:45:09.4560895Z ╰─> [12 lines of output]
2022-11-23T17:45:09.4561387Z Traceback (most recent call last):
2022-11-23T17:45:09.4561909Z File "<string>", line 2, in <module>
2022-11-23T17:45:09.4562542Z File "<pip-setuptools-caller>", line 34, in <module>
2022-11-23T17:45:09.4563944Z File "/tmp/pip-install-zoukdvi7/dpath_eadffa1845b0445692e407f3c2cfafb8/setup.py", line 2, in <module>
2022-11-23T17:45:09.4564779Z import dpath.version
2022-11-23T17:45:09.4565633Z File "/tmp/pip-install-zoukdvi7/dpath_eadffa1845b0445692e407f3c2cfafb8/dpath/__init__.py", line 13, in <module>
2022-11-23T17:45:09.4566430Z from .util import *
2022-11-23T17:45:09.4567252Z File "/tmp/pip-install-zoukdvi7/dpath_eadffa1845b0445692e407f3c2cfafb8/dpath/util.py", line 1, in <module>
2022-11-23T17:45:09.4567906Z import dpath.path
2022-11-23T17:45:09.4568706Z File "/tmp/pip-install-zoukdvi7/dpath_eadffa1845b0445692e407f3c2cfafb8/dpath/path.py", line 9, in <module>
2022-11-23T17:45:09.4569450Z from collections import MutableSequence, MutableMapping
2022-11-23T17:45:09.4570359Z ImportError: cannot import name 'MutableSequence' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
2022-11-23T17:45:09.4571021Z [end of output]
2022-11-23T17:45:09.4571455Z
Problems:
Solution:
-p
/ --pipe
to kube-render
this will allow user to send me what files they want to compile in a sequencedocs
kube-render -t xxxx -c xxxx -p deployment service --verbose --apply
Just trying this tool as I was about to write the same thing (or very similar).
Noticed straight away that its missing one of the deps:
(kube-render) ➜ example git:(master) kube-render -h
Traceback (most recent call last):
File "/Users/pfiddes/PythonProjects/kube-render/bin/kube-render", line 7, in <module>
from kuberender import cli_render
File "/Users/pfiddes/PythonProjects/kube-render/lib/python3.6/site-packages/kuberender/__init__.py", line 1, in <module>
from kuberender import render
File "/Users/pfiddes/PythonProjects/kube-render/lib/python3.6/site-packages/kuberender/render.py", line 12, in <module>
from .utils import load_yaml_file, make_template_path, merge_dicts
File "/Users/pfiddes/PythonProjects/kube-render/lib/python3.6/site-packages/kuberender/utils.py", line 2, in <module>
from urlparse import urlparse
ModuleNotFoundError: No module named 'urlparse'
(kube-render) ➜ example git:(master) pip3 list
Package Version
---------- -------
click 6.7
dpath 1.4.0
Jinja2 2.9.6
kuberender 0.2.7
libvcs 0.2.3
MarkupSafe 1.0
pip 9.0.1
PyYAML 3.12
setuptools 38.4.0
wheel 0.30.0
(kube-render) ➜ kube-render git:(master) grep -nr 'urlparse' *
kuberender/utils.py:2:from urlparse import urlparse
kuberender/utils.py:41: parse_result = urlparse(repo_url)
(kube-render) ➜ kube-render git:(master) pip search urlparse
bfurlparser (1.0.3) - A blazing fast Python URL parser
giturlparse.py (0.0.5) - A Git URL parsing module (supports parsing and rewriting)
murl (0.5.1) - murl is a tiny wrapper for the Python module urlparse.
uritools (2.1.0) - RFC 3986 compliant, Unicode-aware, scheme-agnostic replacement for urlparse
urlparse2 (1.1.1) - urlparse for humans.
urlparse3 (1.1) - urlparse3 is simple and powerful url parsing tool
urlparse4 (0.1.3) - Performance-focused replacement for Python's urlparse module
(kube-render) ➜ kube-render git:(master) pip3 install urlparse
Collecting urlparse
Could not find a version that satisfies the requirement urlparse (from versions: )
No matching distribution found for urlparse
As its not available as simply urlparse
, is there any chance you can update to pull in the correct dependency when installed from pip3?
Or I got it running (for now) by changing this to:
from urllib.parse import urlparse
Using python3 and clean virtualenv:
(kube-render) ➜ kube-render git:(master) python3 --version
Python 3.6.4
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.