Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Propagate kubernetes custom metadata annotations to sub-services #3767

Merged
merged 3 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ sky/clouds/service_catalog/data_fetchers/*.csv
.vscode/
.idea/
.env

# For editor files
*.swp
3 changes: 3 additions & 0 deletions sky/provision/kubernetes/network_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,16 @@ def fill_loadbalancer_template(namespace: str, service_name: str,

with open(template_path, 'r', encoding='utf-8') as fin:
template = fin.read()
annotations = skypilot_config.get_nested(
romilbhardwaj marked this conversation as resolved.
Show resolved Hide resolved
('kubernetes', 'custom_metadata', 'annotations'), {})
romilbhardwaj marked this conversation as resolved.
Show resolved Hide resolved
j2_template = jinja2.Template(template)
cont = j2_template.render(
namespace=namespace,
service_name=service_name,
ports=ports,
selector_key=selector_key,
selector_value=selector_value,
annotations=annotations,
)
content = yaml.safe_load(cont)
return content
Expand Down
4 changes: 4 additions & 0 deletions sky/templates/kubernetes-loadbalancer.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ service_spec:
name: {{ service_name }}
labels:
parent: skypilot
annotations:
{%- for key, value in annotations.items() %}
{{ key }}: {{ value|tojson }}
{%- endfor %}
spec:
type: LoadBalancer
selector:
Expand Down
Loading