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

Camel proxy dev environment #1441

Merged
merged 3 commits into from
Feb 5, 2024
Merged

Camel proxy dev environment #1441

merged 3 commits into from
Feb 5, 2024

Conversation

eguzki
Copy link
Member

@eguzki eguzki commented Feb 2, 2024

What

New development environment to test integration between APIcast and proxies built on top of Camel framework

Verification Steps

  • Build docker image from this git branch
make runtime-image IMAGE_NAME=apicast-test
  • Change the working directory to the camel dev environment directory
cd dev-environments/camel-proxy
  • Create the SSL Certificates
make certs
  • Run environment
make gateway IMAGE_NAME=apicast-test
  • Testing http_proxy use case: APIcast --> camel proxy --> upstream (plain HTTP/1.1)
curl --resolve http-proxy.example.com:8080:127.0.0.1 -v "http://http-proxy.example.com:8080/?user_key=123"

Expected result:

 Added http-proxy.example.com:8080:127.0.0.1 to DNS cache
* Hostname http-proxy.example.com was found in DNS cache
*   Trying 127.0.0.1:8080...
* Connected to http-proxy.example.com (127.0.0.1) port 8080 (#0)
> GET /?user_key=123 HTTP/1.1
> Host: http-proxy.example.com:8080
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: openresty
< Date: Fri, 02 Feb 2024 10:12:56 GMT
< Content-Type: application/json
< Content-Length: 254
< Connection: keep-alive
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Origin: *
<
{
  "ARGS": {
    "USER_KEY": "123"
  },
  "HEADERS": {
    "ACCEPT": "*/*",
    "CONNECTION": "KEEP-ALIVE",
    "HOST": "EXAMPLE.COM",
    "USER-AGENT": "CURL/7.81.0"
  },
  "ORIGIN": "172.21.0.2",
  "URL": "HTTP://EXAMPLE.COM/GET?USER_KEY=123"
}
* Connection #0 to host http-proxy.example.com left intact

Traffic between APIcast and the camel proxy can be inspected looking at logs from proxy.socat service

docker compose -p camel-proxy logs -f proxy.socat

Traffic between the camel proxy and upstream can be inspected looking at logs from example.com service

docker compose -p camel-proxy logs -f example.com

Camel proxy can be inspected looking at logs from camel.proxy service

docker compose -p camel-proxy logs -f camel.proxy
  • Testing https_proxy use case: APIcast --> camel proxy --> upstream (TLS)
curl --resolve https-proxy.example.com:8080:127.0.0.1 -v "http://https-proxy.example.com:8080/?user_key=123"

Expected result:

* Added https-proxy.example.com:8080:127.0.0.1 to DNS cache
* Hostname https-proxy.example.com was found in DNS cache
*   Trying 127.0.0.1:8080...
* Connected to https-proxy.example.com (127.0.0.1) port 8080 (#0)
> GET /?user_key=123 HTTP/1.1
> Host: https-proxy.example.com:8080
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Fri, 02 Feb 2024 10:17:33 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Connection: keep-alive
< x-envoy-upstream-service-time: 0
< vary: Origin
< x-3scale-echo-api: echo-api/1.0.3
< x-content-type-options: nosniff
< server: envoy
<
{
  "METHOD": "GET",
  "PATH": "/",
  "ARGS": "USER_KEY=123",
  "BODY": "",
  "HEADERS": {
    "HTTP_VERSION": "HTTP/1.1",
    "HTTP_HOST": "ECHO-API.3SCALE.NET:443",
    "HTTP_ACCEPT": "*/*",
    "HTTP_USER_AGENT": "CURL/7.81.0",
    "HTTP_X_FORWARDED_FOR": "81.61.128.254",
    "HTTP_X_FORWARDED_PROTO": "HTTPS",
    "HTTP_X_ENVOY_EXTERNAL_ADDRESS": "81.61.128.254",
    "HTTP_X_REQUEST_ID": "F0463914-3C0B-4CA3-9E61-5E40C01DBFD3",
    "HTTP_X_ENVOY_EXPECTED_RQ_TIMEOUT_MS": "15000"
  },
  "UUID": "500CA72C-A106-4BFB-91F5-0C2D2D78CF05"
* Connection #0 to host https-proxy.example.com left intact

Camel proxy can be inspected looking at logs from tls.camel.proxy service

docker compose -p camel-proxy logs -f tls.camel.proxy
  • Clean env
make clean

@eguzki eguzki requested a review from tkan145 February 2, 2024 09:50
@eguzki eguzki force-pushed the dev-environment-camel-proxy branch from 9f28cc9 to 82c78ca Compare February 2, 2024 10:22
@eguzki eguzki marked this pull request as ready for review February 2, 2024 10:31
@eguzki eguzki requested a review from a team as a code owner February 2, 2024 10:31
@eguzki eguzki force-pushed the dev-environment-camel-proxy branch from d0f7b2f to 5d577b1 Compare February 2, 2024 10:34
Copy link
Contributor

@tkan145 tkan145 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just some small issues

  • The verification steps provide command to the wrong folder
cd dev-environments/keycloak-env/
  • Also missing an entry in CHANGELOG file.

@eguzki
Copy link
Member Author

eguzki commented Feb 5, 2024

LGTM, just some small issues

* The verification steps provide command to the wrong folder
cd dev-environments/keycloak-env/
* Also missing an entry in CHANGELOG file.

Comments addressed.

@tkan145
Copy link
Contributor

tkan145 commented Feb 5, 2024

LGTM!

@eguzki eguzki force-pushed the dev-environment-camel-proxy branch from 4508698 to 5d9942e Compare February 5, 2024 12:39
@eguzki eguzki merged commit 49722c9 into master Feb 5, 2024
11 checks passed
@eguzki eguzki deleted the dev-environment-camel-proxy branch February 5, 2024 14:18
@@ -6,7 +6,7 @@ WORKDIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
DOCKER ?= $(shell which docker 2> /dev/null || echo "docker")

gateway: ## run gateway configured to access plain HTTP 1.1 upstream
$(DOCKER) compose -f docker-compose.yml up --attach gateway
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about this. This was not my intention. This happened because we merged #1442 before #1441 and the rebase tricked me. Actually it is my fault for not reviewing the changes after rebase and (too) quick merging.

I will create a new PR to fix this

cc @tkan145

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The revert of the revert #1444

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants