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

Add Istio upstream tests #9463

Merged
merged 115 commits into from May 16, 2024
Merged

Add Istio upstream tests #9463

merged 115 commits into from May 16, 2024

Conversation

npolshakova
Copy link
Contributor

@npolshakova npolshakova commented May 8, 2024

Description

Adds Istio integration tests with Upstreams.

Upgrade/downgrade doc for Istio automtls integration: https://docs.google.com/document/d/1QmapbTCVb6BIrgkmgeL60lSwL5KLLIn_MN2KiRLW-is/edit?usp=sharing

Code changes

This introduces the following net new tests:

  • Override test for Istio integration with Upstream and automtls disabled for k8s Gateway resources (validated with disabled peer auth policy)
  • Override test for Istio integration with Upstream and automtls disabled for Edge Gateway resources (validated with disabled peer auth policy)
  • sslConfig based strict peer auth test for Gloo Gateway API resources
  • Upgrade test for Istio Integration with Upstream with sslConfig -> automtls for Edge Gateway resources
  • Downgrade test Istio Integration with Upstream with automtls -> sslConfig on Upstream for Edge Gateway resources

These can be added if we decide they are worthwhile:

  • Adding the SSL config via cli with glooctl istio enable-mtls --upstream httpbin-upstream, removing the SSL config with glooctl istio disable-mtls --upstream httpbin-upstream. Currently the tests directly apply the Upstream with sslConfig since discovery is disabled on the Istio tests. The original Istio regression tests were using discovery and editing the Upstream through the cli. This can cause flakes when updating the Upstream resource.

Manual validation:

  1. Install gloo with automtls enabled. Setup initial resources that use sslConfig on Upstream:
apiVersion: gateway.solo.io/v1
kind: VirtualService
metadata:
  name: httpbin-vs
  namespace: automtls-istio-edge-api-test
spec:
  virtualHost:
    domains:
    - httpbin
    routes:
    - matchers:
      - prefix: /
      routeAction:
        single:
          upstream:
            name: httpbin-upstream
            namespace: automtls-istio-edge-api-test
---
apiVersion: gloo.solo.io/v1
kind: Upstream
metadata:
  name: httpbin-upstream
  namespace: automtls-istio-edge-api-test
spec:
  kube:
    selector:
      app: httpbin
    serviceName: httpbin
    serviceNamespace: httpbin
    servicePort: 8000
  sslConfig:
    alpnProtocols:
    - istio
    sds:
      certificatesSecretName: istio_server_cert
      clusterName: gateway_proxy_sds
      targetUri: 127.0.0.1:8234
      validationContextName: istio_validation_context
  1. Port-forward gateway:
k port-forward deploy/gateway-proxy -n automtls-istio-edge-api-test 8080:8080
  1. Send constant traffic to check headers
for i in {1..1000}
do
  curl localhost:8080/headers -H "host: httpbin" -v
  echo "Request $i sent"
done

I checked the X-Forwarded-Client-Cert was present by grepping the response:

for i in {1..1000}; do echo "Request $i:"; response=$(curl -s -H "host: httpbin" "http://localhost:8080/headers"); echo "$response" | grep -q "X-Forwarded-Client-Cert" && echo "Header found" || echo "Error: Header not found"; done
  1. Update to Upstream to remove sslConfig
apiVersion: gloo.solo.io/v1
kind: Upstream
metadata:
  name: httpbin-upstream
  namespace: automtls-istio-edge-api-test
spec:
  kube:
    selector:
      app: httpbin
    serviceName: httpbin
    serviceNamespace: httpbin
    servicePort: 8000

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

npolshakova and others added 30 commits April 29, 2024 11:24
Copy link

github-actions bot commented May 13, 2024

Visit the preview URL for this PR (updated for commit 93dad84):

https://gloo-edge--pr9463-npolshak-add-istio-u-pbs2lyjw.web.app

(expires Thu, 23 May 2024 16:01:56 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 77c2b86e287749579b7ff9cadb81e099042ef677

sam-heilbron
sam-heilbron previously approved these changes May 15, 2024
test/kubernetes/e2e/test.go Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
jbohanon
jbohanon previously approved these changes May 16, 2024
@npolshakova npolshakova requested a review from jbohanon May 16, 2024 16:22
@npolshakova npolshakova merged commit ee86498 into main May 16, 2024
25 checks passed
@npolshakova npolshakova deleted the npolshak/add-istio-upstream-tests branch May 16, 2024 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep pr updated signals bulldozer to keep pr up to date with base branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants