-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7d528a
commit 1734384
Showing
5 changed files
with
260 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
.github/workflows/api-gateway-conformance/actions/goenv/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
name: "Setup Go Environment" | ||
description: "Setup a go environment with caching" | ||
inputs: | ||
go-version: | ||
description: "Go version to install" | ||
required: true | ||
gotestsum-version: | ||
description: "gotestsum version to install" | ||
required: false | ||
default: 1.7.0 | ||
outputs: | ||
go-build-cache: | ||
description: "go build cache path" | ||
value: ${{ steps.go-cache-paths.outputs.go-build-cache }} | ||
go-mod-cache: | ||
description: "go mod cache path" | ||
value: ${{ steps.go-cache-paths.outputs.go-mod-cache }} | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: Setup gotestsum | ||
shell: bash | ||
run: | | ||
url=https://github.com/gotestyourself/gotestsum/releases/download | ||
curl -sSL "${url}/v${{ inputs.gotestsum-version }}/gotestsum_${{ inputs.gotestsum-version }}_linux_amd64.tar.gz" | \ | ||
tar -xz --overwrite -C /usr/local/bin gotestsum | ||
gotestsum --version | ||
- id: go-cache-paths | ||
name: Setup Go Cache paths | ||
shell: bash | ||
run: | | ||
echo "::set-output name=go-build-cache::$(go env GOCACHE)" | ||
echo "::set-output name=go-mod-cache::$(go env GOMODCACHE)" | ||
- name: Go Build Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-build-cache }} | ||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: Go Mod Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-mod-cache }} | ||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} |
39 changes: 39 additions & 0 deletions
39
.github/workflows/api-gateway-conformance/actions/setup-kind/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
name: "Setup Kind" | ||
description: "Setup a Kind cluster with MetalLB for ingress" | ||
inputs: | ||
cluster-name: | ||
description: "The name to assign to the Kind cluster" | ||
required: false | ||
default: "consul-api-gateway-test" | ||
load-docker-image: | ||
description: "A Docker image to load into Kind cluster, if any" | ||
required: false | ||
default: "" | ||
metallb-config-path: | ||
description: "The path to a config file for MetalLB" | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Create Kind cluster | ||
uses: helm/kind-action@9e8295d178de23cbfbd8fa16cf844eec1d773a07 | ||
with: | ||
cluster_name: ${{ inputs.cluster-name }} | ||
kubectl_version: "v1.22.0" | ||
node_image: "kindest/node:v1.24.6@sha256:97e8d00bc37a7598a0b32d1fabd155a96355c49fa0d4d4790aab0f161bf31be1" | ||
|
||
- name: Install MetalLB | ||
shell: bash | ||
run: | | ||
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/namespace.yaml | ||
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/metallb.yaml | ||
kubectl apply -f ${{ inputs.metallb-config-path }} | ||
kubectl wait --for=condition=Ready --timeout=60s --namespace=metallb-system pods --all | ||
- name: Load Docker image | ||
if: inputs.load-docker-image != '' | ||
shell: bash | ||
run: kind load docker-image ${{ inputs.load-docker-image }} --name ${{ inputs.cluster-name }} |
14 changes: 14 additions & 0 deletions
14
.github/workflows/api-gateway-conformance/consul-config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
global: | ||
tls: | ||
enabled: true | ||
server: | ||
replicas: 1 | ||
connectInject: | ||
enabled: true | ||
default: true | ||
controller: | ||
enabled: true | ||
logLevel: info |
15 changes: 15 additions & 0 deletions
15
.github/workflows/api-gateway-conformance/metallb-config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
namespace: metallb-system | ||
name: config | ||
data: | ||
config: | | ||
address-pools: | ||
- name: default | ||
protocol: layer2 | ||
addresses: | ||
- 172.18.255.200-172.18.255.250 |
138 changes: 138 additions & 0 deletions
138
.github/workflows/api_gateway_conformance_tests_with_build.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
name: Conformance (Build) | ||
|
||
on: | ||
pull_request: | ||
types: ["opened", "reopened", "synchronize", "labeled"] | ||
|
||
push: | ||
branches: ["conformance/*"] | ||
|
||
workflow_dispatch: | ||
inputs: | ||
debug_enabled: | ||
description: 'Start tmate session if any step fails' | ||
required: false | ||
type: boolean | ||
default: false # GitHub parses this value to string, see https://github.com/actions/runner/issues/1483 | ||
debug_timeout_minutes: | ||
description: 'How many minutes should the tmate session close itself after?' | ||
required: false | ||
type: string # No support for numeric value | ||
default: '10' | ||
|
||
env: | ||
GO_VERSION: "1.19" | ||
|
||
jobs: | ||
run-on-kind: | ||
# Run on PR only if there is a `pr/api-gateway-conformance` label | ||
if: "github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'pr/api-gateway-conformance')" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
config: | ||
# - name: "consul@v1.12 + consul-k8s@v0.49.1" | ||
# consul-image: "hashicorp/consul:1.12" | ||
# envoy-image: "envoyproxy/envoy:v1.22-latest" | ||
# consul-k8s-version: "consul-k8s-control-plane-dev" | ||
# envoy-field: "global.imageEnvoy" | ||
# - name: "consul@v1.13 + consul-k8s@v0.49.1" | ||
# consul-image: "hashicorp/consul:1.13" | ||
# envoy-image: "envoyproxy/envoy:v1.22-latest" | ||
# consul-k8s-version: "consul-k8s-control-plane-dev" | ||
# envoy-field: "global.imageEnvoy" | ||
# - name: "consul@v1.14 + consul-k8s@v1.0.1" | ||
# api-gateway-image: "consul-api-gateway:local-build" | ||
# consul-image: "hashicorp/consul:1.14" | ||
# envoy-image: "envoyproxy/envoy:v1.24-latest" | ||
# consul-k8s-version: "consul-k8s-control-plane-dev" | ||
# envoy-field: "apiGateway.imageEnvoy" | ||
- name: "consul@v1.15 + consul-k8s@v1.0.1" | ||
consul-image: "hashicorp/consul:1.15" | ||
envoy-image: "envoyproxy/envoy:v1.24-latest" | ||
consul-k8s-version: "consul-k8s-control-plane-dev" | ||
envoy-field: "apiGateway.imageEnvoy" | ||
fail-fast: false | ||
name: "${{ matrix.config.name }}" | ||
|
||
steps: | ||
# Clone repos side-by-side: | ||
# GITHUB_WORKSPACE/ | ||
# consul-k8s/ | ||
# gateway-api/ | ||
- name: Checkout consul-k8s | ||
uses: actions/checkout@v2 | ||
with: | ||
path: "consul-k8s" | ||
|
||
|
||
# #Previously we were running these tests against multiple released versions of consul-k8s, but | ||
# # now that we're integrated, do we still want to do this? | ||
# - name: Clone consul-k8s | ||
# uses: actions/checkout@v2 | ||
# with: | ||
# repository: "hashicorp/consul-k8s" | ||
# ref: ${{ matrix.config.consul-k8s-version }} | ||
# path: "consul-k8s" | ||
|
||
- name: Clone gateway-api | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: "hashicorp/gateway-api" | ||
ref: "conformance/v0.5.1-skipped-tests" | ||
path: "gateway-api" | ||
|
||
- name: Setup Goenv | ||
uses: ./consul-k8s/.github/workflows/api-gateway-conformance/actions/goenv | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
# - name: Build binary | ||
# env: | ||
# CGO_ENABLED: "0" | ||
# GOARCH: "amd64" | ||
# GOOS: "linux" | ||
# working-directory: "consul-k8s" | ||
# run: make control-plane-dev | ||
|
||
- name: Build docker image | ||
env: | ||
CGO_ENABLED: "0" | ||
GOARCH: "amd64" | ||
GOOS: "linux" | ||
working-directory: "consul-k8s" | ||
run: make control-plane-dev-docker | ||
|
||
|
||
- name: Setup Kind cluster | ||
uses: ./consul-k8s/.github/workflows/api-gateway-conformance/actions/setup-kind | ||
with: | ||
load-docker-image: ${{ matrix.config.consul-k8s-version}} | ||
metallb-config-path: "consul-k8s/.github/workflows/api-gateway-conformance/metallb-config.yaml" | ||
|
||
#TODO I'm not sure if we still need this since I think Thomas wrapped the crd installs into the helm install | ||
- name: Install Consul CRDs | ||
working-directory: "consul-k8s" | ||
run: kubectl apply --kustomize="./charts/consul/crds" | ||
|
||
- name: Install Consul | ||
working-directory: "consul-k8s/.github/workflows/api-gateway-conformance" | ||
run: | | ||
helm install --values ./consul-config.yaml consul $GITHUB_WORKSPACE/consul-k8s/charts/consul --set global.imageK8S=${{ matrix.config.consul-k8s-version }} --set global.image=${{ matrix.config.consul-image }} --set ${{ matrix.config.envoy-field }}=${{ matrix.config.envoy-image }} --create-namespace --namespace=consul | ||
kubectl wait --for=condition=Ready --timeout=60s --namespace=consul pods --all | ||
- name: Patch testing resources | ||
working-directory: "consul-k8s/.github/workflows/api-gateway-conformance" | ||
run: | | ||
cp kustomization.yaml proxydefaults.yaml $GITHUB_WORKSPACE/gateway-api/conformance/ | ||
cd $GITHUB_WORKSPACE/gateway-api/conformance/ | ||
kubectl kustomize ./ --output ./base/manifests.yaml | ||
- name: Run tests | ||
working-directory: "gateway-api/conformance" | ||
run: go test -v -timeout 10m ./ --gateway-class=consul-api-gateway | ||
|
||
- name: Setup tmate session | ||
uses: mxschmitt/action-tmate@v3 | ||
if: failure() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' | ||
timeout-minutes: ${{ fromJSON(github.event.inputs.debug_timeout_minutes) }} |