-
Notifications
You must be signed in to change notification settings - Fork 18
Feat/kmesh waypoint integration #139
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
base: main
Are you sure you want to change the base?
Changes from all commits
18f0b3c
3b14535
b1778e4
dc97aad
ad9576c
11cd5c7
3525ca0
4fddde3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| FROM ubuntu:24.04 | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| ca-certificates \ | ||
| libssl3 \ | ||
| gettext-base \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN useradd -m -u 1337 -s /bin/bash istio-proxy && \ | ||
| mkdir -p /var/log/orion /etc/orion && \ | ||
| chown -R istio-proxy:istio-proxy /var/log/orion /etc/orion | ||
|
|
||
| WORKDIR /home/istio-proxy | ||
|
|
||
| COPY orion /usr/local/bin/orion | ||
| RUN chmod +x /usr/local/bin/orion | ||
|
|
||
| COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
| RUN chmod +x /usr/local/bin/entrypoint.sh | ||
|
|
||
| COPY config/orion-waypoint.yaml /etc/orion/config.yaml | ||
|
|
||
| USER istio-proxy | ||
|
|
||
| # Expose ports | ||
| # 15000: Admin interface | ||
| # 15006: Inbound traffic | ||
| # 15008: HBONE tunnel | ||
| # 15020: Health check | ||
| # 15021: Status port | ||
| # 15090: Prometheus metrics | ||
| EXPOSE 15000 15006 15008 15020 15021 15090 | ||
|
|
||
| ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,99 @@ | ||||||
| # Orion as Kmesh Waypoint | ||||||
|
|
||||||
| ## Directory Structure | ||||||
|
|
||||||
| ``` | ||||||
| kmesh-integration/ | ||||||
| ├── README.md # This file | ||||||
| ├── Dockerfile # Orion waypoint container image | ||||||
| ├── orion # Pre-built Orion binary | ||||||
| ├── entrypoint.sh # Container entrypoint script | ||||||
| ├── config/ | ||||||
| │ └── orion-waypoint.yaml # Orion configuration | ||||||
| ├── docs/ | ||||||
| │ └── KMESH-FULL-INTEGRATION.md # Complete verification & architecture | ||||||
|
||||||
| │ └── KMESH-FULL-INTEGRATION.md # Complete verification & architecture | |
| │ └── commands.md # Complete verification & architecture |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| --- | ||
|
|
||
| runtime: | ||
| num_cpus: 2 | ||
| num_runtimes: 2 | ||
|
|
||
| logging: | ||
| log_level: "info" | ||
|
|
||
| envoy_bootstrap: | ||
| node: | ||
| id: "${NODE_ID}" | ||
| cluster: "waypoint.${NAMESPACE}" | ||
| metadata: | ||
| NAMESPACE: "${NAMESPACE}" | ||
| NODE_NAME: "${NODE_NAME}" | ||
| ENABLE_HBONE: "true" | ||
| LABELS: | ||
| gateway.networking.k8s.io/gateway-name: "orion-waypoint" | ||
| istio.io/dataplane-mode: "none" | ||
| service.istio.io/canonical-name: "orion-waypoint" | ||
| sidecar.istio.io/inject: "false" | ||
| gateway.istio.io/managed: "istio.io-mesh-controller" | ||
| INSTANCE_IPS: "${POD_IP}" | ||
| METADATA_DISCOVERY: "true" | ||
| SERVICE_ACCOUNT: "${SERVICE_ACCOUNT}" | ||
| CLUSTER_ID: "Kubernetes" | ||
| NAME: "${POD_NAME}" | ||
| MESH_ID: "cluster.local" | ||
| WORKLOAD_NAME: "orion-waypoint" | ||
| ISTIO_VERSION: "1.27.3" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Istio version is hardcoded. This can become outdated and lead to inconsistencies if the actual Istio version in the cluster is different. It would be more robust to pass this value via an environment variable from the Kubernetes deployment, where it can be managed more centrally. ISTIO_VERSION: "${ISTIO_VERSION:-1.27.3}" |
||
| INTERCEPTION_MODE: "REDIRECT" | ||
| ENVOY_STATUS_PORT: 15021 | ||
| ENVOY_PROMETHEUS_PORT: 15090 | ||
| PILOT_SAN: | ||
| - "istiod.istio-system.svc" | ||
|
|
||
| dynamic_resources: | ||
| ads_config: | ||
| api_type: GRPC | ||
| transport_api_version: V3 | ||
| grpc_services: | ||
| - envoy_grpc: | ||
| cluster_name: xds_cluster | ||
|
|
||
| static_resources: | ||
| clusters: | ||
| - name: xds_cluster | ||
| connect_timeout: 0.25s | ||
| type: STRICT_DNS | ||
| lb_policy: ROUND_ROBIN | ||
| typed_extension_protocol_options: | ||
| envoy.extensions.upstreams.http.v3.HttpProtocolOptions: | ||
| "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions | ||
| explicit_http_config: | ||
| http2_protocol_options: {} | ||
| load_assignment: | ||
| cluster_name: xds_cluster | ||
| endpoints: | ||
| - lb_endpoints: | ||
| - endpoint: | ||
| address: | ||
| socket_address: | ||
| address: istiod.istio-system.svc.cluster.local | ||
| port_value: 15010 | ||
|
|
||
| listeners: | ||
| - name: health_check | ||
| address: | ||
| socket_address: | ||
| address: 0.0.0.0 | ||
| port_value: 15021 | ||
| filter_chains: | ||
| - filters: | ||
| - name: envoy.filters.network.http_connection_manager | ||
| typed_config: | ||
| "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
| stat_prefix: health | ||
| route_config: | ||
| name: health_route | ||
| virtual_hosts: | ||
| - name: health | ||
| domains: ["*"] | ||
| routes: | ||
| - match: | ||
| prefix: "/healthz" | ||
| direct_response: | ||
| status: 200 | ||
| body: | ||
| inline_string: "OK" | ||
| http_filters: | ||
| - name: envoy.filters.http.router | ||
| typed_config: | ||
| "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| # Kmesh Integration Setup Guide | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Navigate to the kmesh-integration directory: | ||
|
|
||
| ```bash | ||
| cd kmesh-integration | ||
| ``` | ||
|
|
||
| ## Setup Steps | ||
|
|
||
| ### 1. Setup Kmesh Kind Cluster (Optional) | ||
|
|
||
| If you don't want to enter commands manually, run the setup script: | ||
|
|
||
| ```bash | ||
| ./scripts/setup-kmesh-kind.sh | ||
| ``` | ||
|
|
||
| ### 2. Configure Kubernetes Context | ||
|
|
||
| ```bash | ||
| kubectl config use-context kind-kind | ||
| ``` | ||
|
|
||
| ### 3. Enable Kmesh Dataplane Mode | ||
|
|
||
| Label the bookinfo namespace to use Kmesh: | ||
|
|
||
| ```bash | ||
| kubectl label namespace bookinfo istio.io/dataplane-mode=Kmesh --overwrite | ||
| ``` | ||
|
|
||
| ### 4. Build and Load Orion Waypoint Image | ||
|
|
||
| Build the Docker image: | ||
|
|
||
| ```bash | ||
| docker build -t orion-waypoint:latest . | ||
| ``` | ||
|
|
||
| Load the image into the kind cluster: | ||
|
|
||
| ```bash | ||
| kind load docker-image orion-waypoint:latest | ||
| ``` | ||
|
|
||
| ### 5. Deploy Orion Waypoint | ||
|
|
||
| Apply the deployment configuration: | ||
|
|
||
| ```bash | ||
| kubectl apply -f yamls/orion-deployment.yaml -n bookinfo | ||
| ``` | ||
|
|
||
| Apply the service configuration: | ||
|
|
||
| ```bash | ||
| kubectl apply -f yamls/orion-service.yaml -n bookinfo | ||
| ``` | ||
|
|
||
| Wait for the pods to be ready: | ||
|
|
||
| ```bash | ||
| kubectl wait --for=condition=ready pod -l app=orion-waypoint -n bookinfo --timeout=60s | ||
| ``` | ||
|
|
||
| ### 6. Configure Waypoint for ProductPage | ||
|
|
||
| Label the productpage service to use the orion-waypoint: | ||
|
|
||
| ```bash | ||
| kubectl label service productpage -n bookinfo istio.io/use-waypoint=orion-waypoint --overwrite | ||
| ``` | ||
|
|
||
| ## Verification | ||
|
|
||
| ### Check Kmesh Redirection | ||
|
|
||
| Verify the Kmesh redirection annotation on the productpage pod: | ||
|
|
||
| ```bash | ||
| kubectl get pod -n bookinfo -l app=productpage -o jsonpath='{.items[0].metadata.annotations.kmesh\.net/redirection}' && echo | ||
| ``` | ||
|
|
||
| ### Test HTTP Connection | ||
|
|
||
| Check if the productpage is accessible and returns a successful status code: | ||
|
|
||
| ```bash | ||
| echo "Status code: $(kubectl exec -n bookinfo deploy/sleep -- curl -s -o /dev/null -w "%{http_code}" http://productpage:9080/productpage)" | ||
| ``` | ||
|
|
||
| Expected output: `Status code: 200` | ||
|
|
||
| ### Check Orion Waypoint Logs | ||
|
|
||
| View the logs to confirm the waypoint is running: | ||
|
|
||
| ```bash | ||
| kubectl logs -n bookinfo -l app=orion-waypoint | grep "Started version" | ||
| ``` | ||
|
|
||
| ## Full Testing | ||
|
|
||
| For comprehensive testing, run the full test script: | ||
|
|
||
| ```bash | ||
| ./scripts/test-kmesh-full.sh | ||
| ``` |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||
| #!/bin/bash | ||||||
| # Orion startup script that substitutes environment variables in config | ||||||
|
|
||||||
| set -e | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For more robust shell scripting, it's recommended to use
Suggested change
|
||||||
|
|
||||||
| if [ -z "${NODE_ID}" ]; then | ||||||
| export NODE_ID="waypoint~${POD_IP}~${POD_NAME}.${NAMESPACE}~${NAMESPACE}.svc.cluster.local" | ||||||
| fi | ||||||
|
|
||||||
| echo "Starting Orion with NODE_ID: ${NODE_ID}" | ||||||
|
|
||||||
| envsubst < /etc/orion/config.yaml > /tmp/orion-config-processed.yaml | ||||||
|
|
||||||
| exec /usr/local/bin/orion --config /tmp/orion-config-processed.yaml | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reduce the Docker image size, it's a good practice to use
--no-install-recommendswithapt-get install. This prevents the installation of packages that are only recommended, not strictly required, by the packages you are installing.