Skip to content
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

Bug 1822127 - Create secret with proxy config if setting present #294

Merged
merged 4 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion roles/migrationcontroller/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ configmap_secret: ""
controller_state: absent
deprecated_cors_configuration: false
cors_origins: []
proxy_secret_generate_name: "migration-proxy-"
http_proxy: "{{ lookup( 'env', 'HTTP_PROXY') }}"
https_proxy: "{{ lookup( 'env', 'HTTPS_PROXY') }}"
no_proxy: "{{ lookup( 'env', 'NO_PROXY') }}"
image_pull_policy: Always
mig_controller_image: "{{ registry }}/{{ project }}/{{ mig_controller_repo }}"
mig_controller_limits_cpu: "100m"
Expand Down Expand Up @@ -35,7 +37,6 @@ migration_registry_image: "{{ registry }}/{{ project }}/{{ migration_registry_re
migration_registry_repo: "{{ lookup( 'env', 'MIGRATION_REGISTRY_REPO') }}"
migration_registry_version: "{{ lookup( 'env', 'MIGRATION_REGISTRY_TAG') }}"
migration_registry_image_fqin: "{{ migration_registry_image }}:{{ migration_registry_version }}"
no_proxy: "{{ lookup( 'env', 'NO_PROXY') }}"
olm_managed: false
registry: "{{ lookup( 'env', 'REGISTRY') }}"
project: "{{ lookup( 'env', 'PROJECT') }}"
Expand Down
8 changes: 7 additions & 1 deletion roles/migrationcontroller/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,13 @@
k8s:
state: "{{ velero_state }}"
definition: "{{ lookup('template', 'velero_supporting.yml.j2') }}"


- name: "Create proxy configuration secret if proxy is configured"
k8s:
state: "present"
definition: "{{ lookup('template', 'proxy_secret.yml.j2') }}"
when: http_proxy != "" or https_proxy != "" or no_proxy != ""

- name: "Set up velero controller"
k8s:
state: "{{ velero_state }}"
Expand Down
19 changes: 19 additions & 0 deletions roles/migrationcontroller/templates/proxy_secret.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
apiVersion: v1
kind: Secret
metadata:
generateName: {{ proxy_secret_generate_name }}
namespace: {{ mig_namespace }}
labels:
migration-proxy-config: true
type: Opaque
data:
{% if http_proxy|length >0 %}
http_proxy: {{ http_proxy|b64encode }}
{% endif %}
{% if https_proxy|length >0 %}
https_proxy: {{ https_proxy|b64encode }}
{% endif %}
{% if no_proxy|length >0 %}
no_proxy: {{ no_proxy|b64encode }}
{% endif %}