Skip to content

Add proxy support for virtual_lab #2

New issue

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

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

Already on GitHub? Sign in to your account

Open
tmonguillon opened this issue Feb 5, 2025 · 2 comments
Open

Add proxy support for virtual_lab #2

tmonguillon opened this issue Feb 5, 2025 · 2 comments

Comments

@tmonguillon
Copy link

Hi,

I tried to follow the Quick start guide (AOI) but I'm behind a corporate proxy. Is it possible to add proxy support for the virtual_lab (at least for K0S) ?

Regard,
Thomas

@tmonguillon
Copy link
Author

Hi,

Additionnal info toward the settings I had to add to be able to move on the deployment behin a proxy:

  • Regarding the installation of k0s service, it needs to be configured with systemd env vars to set the proxy configuration
root@rockoon:/home/ubuntu/rockoon/virtual_lab# grep -rnis proxy /etc/systemd/system/k0scontroller.service 
23:Environment="HTTP_PROXY=http://<my.proxy.corp>:<port>"
24:Environment="HTTPS_PROXY=http://<my.proxy.corp>:<port>"
25:Environment="NO_PROXY=localhost,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,registry.it.just.works,.svc"
root@rockoon:/home/ubuntu/rockoon/virtual_lab# 
  • Similar to the previous point the docker client configuration need similar configuration:
root@rockoon:/home/ubuntu/rockoon/virtual_lab# grep -rnis proxy /lib/systemd/system/docker.service
47:Environment="HTTP_PROXY=http://<my.proxy.corp>:<port>/"
48:Environment="HTTPS_PROXY=http://<my.proxy.corp>:<port>/"
49:Environment="NO_PROXY=localhost,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,registry.it.just.works,.svc"
root@rockoon:/home/ubuntu/rockoon/virtual_lab# 
  • In addition we need to export the proxy settings also in the containers themselves like this:
ubuntu@rockoon:~/rockoon/virtual_lab$ cat ~/.docker/config.json 
{
  "proxies":
  {
    "default":
    {
      "httpProxy": "http://<my.proxy.corp>:<port>",
      "httpsProxy": "http://<my.proxy.corp>:<port>",
      "noProxy": "localhost,127.0.0.1/8,172.31.0.0/16,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,registry.it.just.works,.svc"
    }
  }
}

ubuntu@rockoon:~/rockoon/virtual_lab$ 
  • During the containers building phase, the need to explicitely set the use of proxy configuration:
diff --git a/virtual_lab/ansible/roles/rvl/tasks/images/rockoon.yaml b/virtual_lab/ansible/roles/rvl/tasks/images/rockoon.yaml
index 278c8f1..76e09c6 100644
--- a/virtual_lab/ansible/roles/rvl/tasks/images/rockoon.yaml
+++ b/virtual_lab/ansible/roles/rvl/tasks/images/rockoon.yaml
@@ -7,6 +7,8 @@
 - name: Build oc image
   community.docker.docker_image:
     build:
+      use_config_proxy: true
       path: "{{ rvl_directory }}"
       args:
         FROM: "{{ rvl_images_ubuntu_base }}"

  • And last point, we need to override the values of the Rockoon helm chart to add on the configuration the proxy setttings:
global:
  proxy:
    env_vars:
      HTTP_PROXY: http://<my.proxy.corp>:<port>
      HTTPS_PROXY: http://<my.proxy.corp>:<port>
      NO_PROXY:
        - "localhost"
        - "127.0.0.1"
        - "127.0.0.0/8"
        - "10.0.0.0/8"
        - "172.16.0.0/12"
        - "192.168.0.0/16"

Regard,
Thomas

@jumpojoy
Copy link
Collaborator

@tmonguillon thank for the issue, sounds like a good improvement will you be able to prepare a pull request with required changes to ansible part?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants