Skip to content
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9a6f08e
feat(standalone): support apisix-standalone for adc
AlinsRan May 29, 2025
e7b23ba
add license
AlinsRan May 29, 2025
43a46c2
add mode
AlinsRan May 29, 2025
e5b7627
fix mode
AlinsRan May 29, 2025
718c0fd
chooise 3.8
AlinsRan May 29, 2025
be65579
update v2
AlinsRan May 30, 2025
e458da5
fix clean
AlinsRan Jun 5, 2025
252cb06
Merge branch 'release-v2-dev' into feat/apisix-standalone
AlinsRan Jun 5, 2025
5e93603
Merge branch 'release-v2-dev' into feat/apisix-standalone
AlinsRan Jun 5, 2025
ea51431
fix test
AlinsRan Jun 8, 2025
80fbc45
Merge branch 'release-v2-dev' into feat/apisix-standalone
AlinsRan Jun 8, 2025
dc20951
fix test
AlinsRan Jun 9, 2025
9cdd0c9
Merge branch 'release-v2-dev' into feat/apisix-standalone
AlinsRan Jun 9, 2025
aa2ee50
fix ssl
AlinsRan Jun 9, 2025
06ee3a7
fix makefile
AlinsRan Jun 9, 2025
9be7bee
fix test
AlinsRan Jun 9, 2025
91e0d44
update Dockerfile
AlinsRan Jun 9, 2025
eccdece
fix test
AlinsRan Jun 9, 2025
47e20b7
fix ci
AlinsRan Jun 9, 2025
1e0a7d2
focus
AlinsRan Jun 9, 2025
cf03fd0
update ci
AlinsRan Jun 9, 2025
c2a54ee
fic ci
AlinsRan Jun 10, 2025
b396eb8
fix conformance test
AlinsRan Jun 10, 2025
89523a8
fix lint
AlinsRan Jun 10, 2025
f364002
add ingress
AlinsRan Jun 10, 2025
0e4a34b
fix ci
AlinsRan Jun 10, 2025
51d15d2
Merge branch 'release-v2-dev' into feat/apisix-standalone
AlinsRan Jun 11, 2025
3dbcfad
add conformance test
AlinsRan Jun 11, 2025
4ce2c5f
update conformance test
AlinsRan Jun 11, 2025
d3297cb
fix test
AlinsRan Jun 11, 2025
ede4e55
perf
AlinsRan Jun 11, 2025
36134c5
resolve comments
AlinsRan Jun 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
ARCH: amd64
ENABLE_PROXY: "false"
BASE_IMAGE_TAG: "debug"
ADC_VERSION: "dev"
run: |
echo "building images..."
make build-image
Expand All @@ -73,7 +74,7 @@ jobs:

- name: Loading Docker Image to Kind Cluster
run: |
make kind-load-images
make kind-load-ingress-image

- name: Run Conformance Test
shell: bash
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/apisix-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,35 @@ jobs:
ARCH: amd64
ENABLE_PROXY: "false"
BASE_IMAGE_TAG: "debug"
ADC_VERSION: "dev"
run: |
echo "building images..."
make build-image

- name: Extract adc binary
run: |
echo "Extracting adc binary..."
docker create --name adc-temp api7/api7-ingress-controller:dev
docker cp adc-temp:/bin/adc /usr/local/bin/adc
docker rm adc-temp
chmod +x /usr/local/bin/adc
echo "ADC binary extracted to /usr/local/bin/adc"

- name: Launch Kind Cluster
run: |
make kind-up

- name: Loading Docker Image to Kind Cluster
run: |
make kind-load-ingress-image

- name: Install Gateway API And CRDs
run: |
make install

- name: Run E2E test suite
shell: bash
env:
TEST_DIR: "./test/e2e/apisix/"
run: |
make e2e-test-standalone
make e2e-test
11 changes: 4 additions & 7 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,13 @@ jobs:
echo "building images..."
make build-image

- name: Build Dockerfile.dev and extract adc binary
- name: Extract adc binary
run: |
echo "Building Dockerfile.dev..."
docker build -f Dockerfile.dev -t adc-builder:latest .
echo "Extracting adc binary..."
docker run --name adc-temp --entrypoint="" adc-builder:latest /bin/true
docker cp adc-temp:/bin/adc ./bin/adc
docker create --name adc-temp api7/api7-ingress-controller:dev
docker cp adc-temp:/bin/adc /usr/local/bin/adc
docker rm adc-temp
chmod +x ./bin/adc
mv ./bin/adc /usr/local/bin/adc
chmod +x /usr/local/bin/adc
echo "ADC binary extracted to /usr/local/bin/adc"

- name: Launch Kind Cluster
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ apisix-ingress-controller-conformance-report.yaml
.env

charts/api7ee3
docs/api
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
ARG ENABLE_PROXY=false
ARG BASE_IMAGE_TAG=nonroot

FROM debian:bullseye-slim AS deps
WORKDIR /workspace

ARG ADC_VERSION=0.19.0
ARG TARGETARCH
ARG ADC_VERSION

RUN apt update \
&& apt install -y wget \
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ ARG ENABLE_PROXY=false
FROM node:22 AS node_builder

ARG TARGETARCH
ARG ADC_COMMIT=e948079ed0576dbac29320ebfa01c9b7a298924c

WORKDIR /app

RUN apt update \
&& apt install -y git \
&& git clone --branch main https://github.com/api7/adc.git \
&& cd adc \
&& git checkout ${ADC_COMMIT} \
&& corepack enable pnpm \
&& pnpm install \
&& NODE_ENV=production npx nx build cli \
Expand Down
28 changes: 17 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ IMAGE_TAG ?= dev
IMG ?= api7/api7-ingress-controller:$(IMAGE_TAG)
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.30.0

KIND_NAME ?= apisix-ingress-cluster
GATEAY_API_VERSION ?= v1.2.0

GATEAY_API_VERSION ?= v1.2.0
DASHBOARD_VERSION ?= dev
ADC_VERSION ?= 0.19.0

TEST_TIMEOUT ?= 60m
TEST_DIR ?= ./test/e2e/

# CRD Reference Documentation
CRD_REF_DOCS_VERSION ?= v0.1.0
Expand Down Expand Up @@ -109,12 +111,7 @@ kind-e2e-test: kind-up build-image kind-load-images e2e-test
.PHONY: e2e-test
e2e-test:
@kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG
DASHBOARD_VERSION=$(DASHBOARD_VERSION) go test ./test/e2e/ -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)"

.PHONY: e2e-test-standalone
e2e-test-standalone:
@kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG
go test ./test/e2e/apisix/ -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)"
DASHBOARD_VERSION=$(DASHBOARD_VERSION) go test $(TEST_DIR) -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)"

.PHONY: download-api7ee3-chart
download-api7ee3-chart:
Expand Down Expand Up @@ -195,6 +192,10 @@ linux-build:
.PHONY: build-image
build-image: docker-build

.PHONY: build-image-with-adc-dev
build-image-with-adc-dev: build
$(CONTAINER_TOOL) build -t ${IMG} -f Dockerfile.dev .

.PHONY: build-push-image
build-push-image: docker-build
@docker push ${IMG}
Expand All @@ -207,11 +208,11 @@ build-multi-arch:
.PHONY: build-multi-arch-image
build-multi-arch-image: build-multi-arch
# daemon.json: "features":{"containerd-snapshotter": true}
@docker buildx build --load --platform linux/amd64,linux/arm64 -t $(IMG) .
@docker buildx build --load --platform linux/amd64,linux/arm64 --build-arg ADC_VERSION=$(ADC_VERSION) -t $(IMG) .

.PHONY: build-push-multi-arch-image
build-push-multi-arch-image: build-multi-arch
@docker buildx build --push --platform linux/amd64,linux/arm64 -t $(IMG) .
@docker buildx build --push --platform linux/amd64,linux/arm64 --build-arg ADC_VERSION=$(ADC_VERSION) -t $(IMG) .

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
Expand All @@ -222,7 +223,12 @@ run: manifests generate fmt vet ## Run a controller from your host.
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
.PHONY: docker-build
docker-build: set-e2e-goos build ## Build docker image with the manager.
$(CONTAINER_TOOL) build -t ${IMG} -f Dockerfile .
@echo "Building with ADC_VERSION=$(ADC_VERSION)"
@if [ "$(strip $(ADC_VERSION))" = "dev" ]; then \
$(CONTAINER_TOOL) build -t ${IMG} -f Dockerfile.dev . ; \
else \
$(CONTAINER_TOOL) build --build-arg ADC_VERSION=${ADC_VERSION} -t ${IMG} -f Dockerfile . ; \
fi

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
Expand Down
7 changes: 5 additions & 2 deletions api/v1alpha1/consumer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ type Consumer struct {

// ConsumerSpec defines the configuration for a consumer, including consumer name,
// authentication credentials, and plugin settings.
Spec ConsumerSpec `json:"spec,omitempty"`
Status Status `json:"status,omitempty"`
Spec ConsumerSpec `json:"spec,omitempty"`
Status ConsumerStatus `json:"status,omitempty"`
}

type ConsumerStatus struct {
Status `json:",inline"`
}
type ConsumerSpec struct {
// GatewayRef specifies the gateway details.
GatewayRef GatewayRef `json:"gatewayRef,omitempty"`
Expand Down
9 changes: 9 additions & 0 deletions api/v1alpha1/gatewayproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ type ControlPlaneProvider struct {
// +kubebuilder:validation:MinItems=1
Endpoints []string `json:"endpoints"`

Service *ProviderService `json:"service,omitempty"`
// TlsVerify specifies whether to verify the TLS certificate of the control plane.
// +optional
TlsVerify *bool `json:"tlsVerify,omitempty"`
Expand All @@ -126,6 +127,14 @@ type ControlPlaneProvider struct {
Auth ControlPlaneAuth `json:"auth"`
}

type ProviderService struct {
Name string `json:"name"`

// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
Port int32 `json:"port,omitempty"`
}

// +kubebuilder:object:root=true
// GatewayProxy is the Schema for the gatewayproxies API.
type GatewayProxy struct {
Expand Down
36 changes: 36 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions config/crd/bases/apisix.apache.org_gatewayproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ spec:
type: string
minItems: 1
type: array
service:
properties:
name:
type: string
port:
format: int32
maximum: 65535
minimum: 1
type: integer
required:
- name
type: object
tlsVerify:
description: TlsVerify specifies whether to verify the TLS
certificate of the control plane.
Expand Down
2 changes: 2 additions & 0 deletions config/samples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ exec_adc_timeout: 15s # The timeout for the ADC to execute.
# The default value is 15 seconds.

provider:
type: "api7ee"

sync_period: 0s
# The period between two consecutive syncs.
# The default value is 0 seconds, which means the controller will not sync.
Expand Down
32 changes: 32 additions & 0 deletions docs/crd/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ _Appears in:_
_Appears in:_
- [Consumer](#consumer)



#### ControlPlaneAuth


Expand All @@ -228,6 +230,7 @@ ControlPlaneProvider defines the configuration for control plane provider.
| Field | Description |
| --- | --- |
| `endpoints` _string array_ | Endpoints specifies the list of control plane endpoints. |
| `service` _[ProviderService](#providerservice)_ | |
| `tlsVerify` _boolean_ | TlsVerify specifies whether to verify the TLS certificate of the control plane. |
| `auth` _[ControlPlaneAuth](#controlplaneauth)_ | Auth specifies the authentication configurations. |

Expand Down Expand Up @@ -403,6 +406,22 @@ _Appears in:_



#### ProviderService






| Field | Description |
| --- | --- |
| `name` _string_ | |
| `port` _integer_ | |


_Appears in:_
- [ControlPlaneProvider](#controlplaneprovider)

#### ProviderType
_Base type:_ `string`

Expand Down Expand Up @@ -447,8 +466,21 @@ _Appears in:_
_Appears in:_
- [Credential](#credential)

#### Status






| Field | Description |
| --- | --- |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#condition-v1-meta) array_ | |


_Appears in:_
- [ConsumerStatus](#consumerstatus)

#### Timeout


Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ require (
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/net v0.28.0
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1
helm.sh/helm/v3 v3.15.4
k8s.io/api v0.31.1
Expand Down Expand Up @@ -201,7 +202,6 @@ require (
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/grpc v1.66.2 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand Down
Loading
Loading