diff --git a/docs/proxy.md b/docs/proxy.md index 19a197641..e41a6e329 100644 --- a/docs/proxy.md +++ b/docs/proxy.md @@ -173,3 +173,152 @@ spec: - name: secrets-rhdh # --- TRUNCATED --- ``` + +# Testing on OpenShift + +2. Create a separate proxy project, and deploy a [Squid](https://www.squid-cache.org/)-based proxy application there. The full URL to access the proxy server from within the cluster would be `http://squid-service.proxy.svc.cluster.local:3128`. + +```shell +oc new-project proxy + +cat < proxy settings can be used to overcome this. +kind: NetworkPolicy +apiVersion: networking.k8s.io/v1 +metadata: + name: default-deny-egress-with-exceptions +spec: + podSelector: {} + policyTypes: + - Egress + egress: + # allow DNS resolution (we need this allowed, otherwise we won't be able to resolve the DNS name of the Squid proxy service) + - to: + - podSelector: {} + namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: openshift-dns + ports: + - port: 53 + protocol: UDP + - port: 53 + protocol: TCP + # allow traffic to Squid proxy + - to: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: proxy + ports: + - port: 3128 + protocol: TCP + +--- +kind: NetworkPolicy +apiVersion: networking.k8s.io/v1 +metadata: + name: allow-same-namespace +spec: + podSelector: {} + ingress: + - from: + - podSelector: {} + egress: + - to: + - podSelector: {} +--- +# allow incoming connections from Ingress controller (to make Route and Ingress work) +kind: NetworkPolicy +apiVersion: networking.k8s.io/v1 +metadata: + name: allow-from-openshift-ingress +spec: + podSelector: {} + ingress: + - from: + - namespaceSelector: + matchLabels: + network.openshift.io/policy-group: ingress + policyTypes: + - Ingress + +EOF +``` + +5. Follow the instructions to add the proxy environment variables for an [Operator-based](../showcase-docs/corporate-proxy.md#operator-deployment) or [Helm-based](../showcase-docs/corporate-proxy.md#helm-deployment) deployment. + +Example with a Custom Resource: + +```yaml +apiVersion: rhdh.redhat.com/v1alpha1 +kind: Backstage +metadata: + name: my-rhdh +spec: + application: + appConfig: + configMaps: + - name: app-config-rhdh + dynamicPluginsConfigMapName: dynamic-plugins-rhdh + extraEnvs: + envs: + - name: HTTP_PROXY + value: 'http://squid-service.proxy.svc.cluster.local:3128' + - name: HTTPS_PROXY + value: 'http://squid-service.proxy.svc.cluster.local:3128' + - name: NO_PROXY + value: 'localhost' + - name: ROARR_LOG + # Logs from global-agent (to inspect proxy settings) + value: 'true' + secrets: + - name: secrets-rhdh +# --- TRUNCATED --- +```