Skip to content

Commit

Permalink
salt: use proxies from pillar in containerd unit
Browse files Browse the repository at this point in the history
Set HTTP_PROXY, HTTPS_PROXY and NO_PROXY
environment variables in containerd systemd unit file,

Refs: #2052
  • Loading branch information
alexandre-allard committed Dec 6, 2019
1 parent 4480e5c commit 9c21044
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion buildchain/buildchain/salt_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def _get_parts(self) -> Iterator[str]:
'tls-secret.sls'),

Path('salt/metalk8s/container-engine/containerd/configured.sls'),
Path('salt/metalk8s/container-engine/containerd/files/50-metalk8s.conf'),
Path('salt/metalk8s/container-engine/containerd/files/50-metalk8s.conf.j2'),
Path('salt/metalk8s/container-engine/containerd/init.sls'),
Path('salt/metalk8s/container-engine/containerd/installed.sls'),
Path('salt/metalk8s/container-engine/init.sls'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# See https://github.com/containerd/containerd/issues/3201
# See https://github.com/containerd/containerd/pull/3202
LimitNOFILE=1048576
Environment="{{ environment }}"
16 changes: 15 additions & 1 deletion salt/metalk8s/container-engine/containerd/installed.sls
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
{%- from "metalk8s/map.jinja" import metalk8s with context %}
{%- from "metalk8s/map.jinja" import kubelet with context %}
{%- from "metalk8s/map.jinja" import repo with context %}
{%- from "metalk8s/map.jinja" import networks with context %}
{%- from "metalk8s/map.jinja" import proxies with context %}
{%- set registry_ip = metalk8s.endpoints['repositories'].ip %}
{%- set registry_port = metalk8s.endpoints['repositories'].ports.http %}
Expand Down Expand Up @@ -36,12 +38,24 @@ Install containerd:
Create containerd service drop-in:
file.managed:
- name: /etc/systemd/system/containerd.service.d/50-metalk8s.conf
- source: salt://{{ slspath }}/files/50-metalk8s.conf
- source: salt://{{ slspath }}/files/50-metalk8s.conf.j2
- template: jinja
- user: root
- group: root
- mode: 0644
- makedirs: true
- dir_mode: 0755
- context:
environment: >-
{%- if proxies %}
NO_PROXY={{ networks.values() | join(",") }}
{%- if 'http' in proxies %}
HTTP_PROXY={{ proxies.http }}
{%- endif %}
{%- if 'https' in proxies %}
HTTPS_PROXY={{ proxies.https }}
{%- endif %}
{%- endif %}
- require:
- metalk8s_package_manager: Install containerd
Expand Down

0 comments on commit 9c21044

Please sign in to comment.