Skip to content

Commit

Permalink
feat: added support for http proxy credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
anaik91 committed Nov 10, 2023
1 parent 9d6f5b6 commit 5d6d5d3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
18 changes: 18 additions & 0 deletions roles/apigee-hybrid-overrides/templates/http_proxy.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% macro proxy_settings(enabled, host, port, scheme, username, password) %}
{% if enabled -%}
httpProxy:
host: {{ host }}
port: {{ port }}
scheme: {{ scheme }}
{{ creds(username, password) }}
{%- endif %}
{% endmacro %}



{% macro creds(username, password) %}
{% if username != "" -%}
username: {{ username }}
password: {{ password }}
{%- endif %}
{% endmacro %}
12 changes: 4 additions & 8 deletions roles/apigee-hybrid-overrides/templates/overrides.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% from 'images.j2' import container_image %}
{% from 'service_account.j2' import svc_account %}
{% from 'http_proxy.j2' import proxy_settings %}
namespace: apigee
gcp:
region: {{ overrides.gcp.region }}
Expand All @@ -19,13 +20,7 @@ imagePullSecrets:
- name: {{ overrides.imagePullSecrets }}
{%- endif %}

{% if overrides.httpProxy|default(false) -%}
httpProxy:
host: {{ overrides.httpProxy.host }}
port: {{ overrides.httpProxy.port }}
scheme: {{ overrides.httpProxy.scheme|default('HTTPS') }}
{%- endif %}

{{ proxy_settings(overrides.httpProxy|default(false), overrides.httpProxy.host, overrides.httpProxy.port, overrides.httpProxy.scheme|default('HTTPS'), overrides.httpProxy.username|default(''), overrides.httpProxy.password|default('')) }}

{% if overrides.nodeSelector.requiredForScheduling != "" -%}
nodeSelector:
Expand Down Expand Up @@ -84,6 +79,7 @@ envs:
synchronizer: {{ svc_account(create_service_account, deployment_environment,'synchronizer', overrides.synchronizer.serviceAccountRef) | indent( width=4)}}
udca: {{ svc_account(create_service_account, deployment_environment,'udca', overrides.udca.serviceAccountRef) | indent( width=4)}}
runtime: {{ svc_account(create_service_account, deployment_environment,'runtime', overrides.runtime.serviceAccountRef) | indent( width=4)}}
{{ proxy_settings(each_env.httpProxy|default(false), each_env.httpProxy.host, each_env.httpProxy.port, each_env.httpProxy.scheme|default('HTTPS'), each_env.httpProxy.username|default(''), each_env.httpProxy.password|default(''))| indent( width=2) }}
{% endfor %}

mart:
Expand Down Expand Up @@ -194,7 +190,7 @@ metrics:
sdSidecar:
{{ container_image(overrides.metrics.sdSidecar.image.url,overrides.metrics.sdSidecar.image.tag,overrides.metrics.sdSidecar.image.pullPolicy,) | indent( width=4)}}
serviceAccountRef: {{ svc_account(create_service_account, deployment_environment,'metrics', overrides.metrics.serviceAccountRef) | indent( width=2)}}
{% if overrides.logger.metrics|default('',true) != '' -%}
{% if overrides.metrics.proxyURL|default('',true) != '' -%}
proxyURL: {{ overrides.metrics.proxyURL }}
{%- endif %}

Expand Down
22 changes: 15 additions & 7 deletions vars/vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,19 @@ overrides:
#
imagePullSecrets:

# httpProxy:
# host: 172.23.3.99
# port: 8080
# scheme: HTTP
httpProxy:
host: 172.23.3.99
port: 8080
scheme: HTTP
# username: test
# password: test1


nodeSelector:
requiredForScheduling: true
apigeeRuntime:
key: "cloud.google.com/gke-nodepool"
value: "apigee-runtime"
value: "apigee-runtime1"
apigeeData:
key: "cloud.google.com/gke-nodepool"
value: "apigee-data"
Expand Down Expand Up @@ -169,6 +171,12 @@ overrides:
replicaCountMax: 4
runtime:
replicaCountMax: 3
# httpProxy:
# host: 172.23.3.99
# port: 8080
# scheme: HTTP
# username: testenv
# password: testenv1

- name: test2

Expand Down Expand Up @@ -313,7 +321,7 @@ overrides:
requests:
cpu: 100m
memory: 250Mi
proxyURL:
# proxyURL: http://172.23.3.99:8080
#
# Apigee Metrics.
#
Expand Down Expand Up @@ -352,7 +360,7 @@ overrides:
url: "gcr.io/apigee-release/hybrid/apigee-stackdriver-prometheus-sidecar"
tag: "0.9.0"
pullPolicy: IfNotPresent
proxyURL:
# proxyURL: http://172.23.3.99:8080
# Apigee Connect Agent
connectAgent:
serviceAccountRef: apigee-hybrid-secret
Expand Down

0 comments on commit 5d6d5d3

Please sign in to comment.