Bug 2002196
| Summary: | Pass down proxy env to operands failed for ansible type operator | ||
|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | Fan Jia <jfan> |
| Component: | Operator SDK | Assignee: | amacdona <austin> |
| Status: | CLOSED ERRATA | QA Contact: | Fan Jia <jfan> |
| Severity: | urgent | Docs Contact: | |
| Priority: | urgent | ||
| Version: | 4.9 | CC: | aos-bugs, jesusr, marobrie |
| Target Milestone: | --- | ||
| Target Release: | 4.9.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-10-18 17:51:28 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Fan Jia
2021-09-08 08:31:01 UTC
heres an example with instructions https://github.com/asmacdo/ansible-operator-proxy-demo verified.
test env:
1. operator-sdk version: "v1.10.1-ocp", commit: "972fd59bb3a4cdb2e5102fc37fc3afa32f6c066f", kubernetes version: "v1.21", go version: "go1.16.5", GOOS: "linux", GOARCH: "amd64"
2. cv:4.9.0-0.nightly-2021-09-09-145014
3.. add the http_proxy message to the ansible operator task
1)$task/main.yaml
---
- name: start memcached
community.kubernetes.k8s:
......
spec:
......
env:
- Name: HTTP_PROXY:
Value: "{{ lookup('env', 'HTTP_PROXY') | default('', True) }}"
- Name: http_proxy:
Value: "{{ lookup('env', 'HTTP_PROXY') | default('', True) }}"
2)$Makefile
deploy: kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | CLUSTER_PROXY=$(shell kubectl get proxies.config.openshift.io cluster -o json | jq '.spec.httpProxy') envsubst | kubectl apply -f -
3)$config/manager/manager.yaml
spec:
......
spec:
securityContext:
runAsNonRoot: true
containers:
...........
env:
- name: ANSIBLE_GATHERING
value: explicit
- name: HTTP_PROXY
value: $CLUSTER_PROXY
test result:
CR created success and env is passed to operand
1)$ oc create -f config/samples/cache1_v1_blacklist.yaml
blacklist.cache1.blacklist.com/blacklist-sample created
2)$oc get deployment blacklist-sample-blacklist -o=jsonpath={.spec.template.spec.containers[0].env}
[{"name":"HTTP_PROXY","value":"http://proxy-user1:JYgU8qRZV4xxxxxxxxxxxxx@xxxxx-141-199-xx.us-xxxx-2.compute.amazonaws.com:3128"},{"name":"http_proxy","value":"http://proxy-user1:JYgU8qRZV4xxxxxxxxxxxxx@xxxxx-141-199-xx.us-xxxx-2.compute.amazonaws.com:3128"}]
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: OpenShift Container Platform 4.9.0 bug fix and security update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2021:3759 |