Skip to content

Commit 51d15d2

Browse files
committed
Merge branch 'release-v2-dev' into feat/apisix-standalone
2 parents 0e4a34b + e365525 commit 51d15d2

File tree

61 files changed

+6690
-276
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+6690
-276
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: APISIX Conformance Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release-v2-dev
8+
pull_request:
9+
branches:
10+
- master
11+
- release-v2-dev
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
prepare:
19+
name: Prepare
20+
runs-on: buildjet-2vcpu-ubuntu-2204
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Go Env
26+
id: go
27+
uses: actions/setup-go@v4
28+
with:
29+
go-version: "1.22"
30+
31+
- name: Install kind
32+
run: |
33+
go install sigs.k8s.io/[email protected]
34+
35+
conformance-test:
36+
timeout-minutes: 60
37+
needs:
38+
- prepare
39+
runs-on: buildjet-2vcpu-ubuntu-2204
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
with:
44+
submodules: recursive
45+
46+
- name: Setup Go Env
47+
uses: actions/setup-go@v4
48+
with:
49+
go-version: "1.22"
50+
51+
- name: Build images
52+
env:
53+
TAG: dev
54+
ARCH: amd64
55+
ENABLE_PROXY: "false"
56+
BASE_IMAGE_TAG: "debug"
57+
run: |
58+
echo "building images..."
59+
make build-image
60+
61+
- name: Launch Kind Cluster
62+
run: |
63+
make kind-up
64+
65+
- name: Install And Run Cloud Provider KIND
66+
run: |
67+
go install sigs.k8s.io/cloud-provider-kind@latest
68+
nohup cloud-provider-kind > /tmp/kind-loadbalancer.log 2>&1 &
69+
70+
- name: Install Gateway API And CRDs
71+
run: |
72+
make install
73+
74+
- name: Loading Docker Image to Kind Cluster
75+
run: |
76+
make kind-load-images
77+
78+
- name: Run Conformance Test
79+
shell: bash
80+
continue-on-error: true
81+
run: |
82+
make conformance-test-standalone
83+
84+
- name: Get Logs from api7-ingress-controller
85+
shell: bash
86+
run: |
87+
export KUBECONFIG=/tmp/apisix-ingress-cluster.kubeconfig
88+
kubectl logs -n apisix-conformance-test -l app=apisix-ingress-controller
89+
90+
- name: Upload Gateway API Conformance Report
91+
if: ${{ github.event_name == 'push' }}
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: apisix-ingress-controller-conformance-report.yaml
95+
path: apisix-ingress-controller-conformance-report.yaml
96+
97+
- name: Format Conformance Test Report
98+
if: ${{ github.event_name == 'pull_request' }}
99+
run: |
100+
echo '# conformance test report' > report.md
101+
echo '```yaml' >> report.md
102+
cat apisix-ingress-controller-conformance-report.yaml >> report.md
103+
echo '```' >> report.md
104+
105+
- name: Report Conformance Test Result to PR Comment
106+
if: ${{ github.event_name == 'pull_request' }}
107+
uses: mshick/add-pr-comment@v2
108+
with:
109+
message-id: '${{ matrix.target }}'
110+
message-path: |
111+
report.md

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ download-api7ee3-chart:
124124
conformance-test:
125125
DASHBOARD_VERSION=$(DASHBOARD_VERSION) go test -v ./test/conformance -tags=conformance -timeout 60m
126126

127+
.PHONY: conformance-test-standalone
128+
conformance-test-standalone:
129+
@kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG
130+
go test -v ./test/conformance/apisix -tags=conformance -timeout 60m
131+
127132
.PHONY: lint
128133
lint: sort-import golangci-lint ## Run golangci-lint linter
129134
$(GOLANGCI_LINT) run
@@ -299,7 +304,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
299304

300305
## Tool Versions
301306
KUSTOMIZE_VERSION ?= v5.4.2
302-
CONTROLLER_TOOLS_VERSION ?= v0.15.0
307+
CONTROLLER_TOOLS_VERSION ?= v0.17.2
303308
ENVTEST_VERSION ?= release-0.18
304309
GOLANGCI_LINT_VERSION ?= v2.1.5
305310

PROJECT

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,57 @@ resources:
3434
kind: HTTPRoutePolicy
3535
path: github.com/apache/apisix-ingress-controller/api/v1alpha1
3636
version: v1alpha1
37+
- api:
38+
crdVersion: v1
39+
namespaced: true
40+
controller: true
41+
domain: github.com
42+
group: apisix.apache.org
43+
kind: ApisixRoute
44+
path: github.com/apache/apisix-ingress-controller/api/v2
45+
version: v2
46+
- api:
47+
crdVersion: v1
48+
namespaced: true
49+
controller: true
50+
domain: github.com
51+
group: apisix.apache.org
52+
kind: ApisixConsumer
53+
path: github.com/apache/apisix-ingress-controller/api/v2
54+
version: v2
55+
- api:
56+
crdVersion: v1
57+
namespaced: true
58+
controller: true
59+
domain: github.com
60+
group: apisix.apache.org
61+
kind: ApisixGlobalRule
62+
path: github.com/apache/apisix-ingress-controller/api/v2
63+
version: v2
64+
- api:
65+
crdVersion: v1
66+
namespaced: true
67+
controller: true
68+
domain: github.com
69+
group: apisix.apache.org
70+
kind: ApisixTls
71+
path: github.com/apache/apisix-ingress-controller/api/v2
72+
version: v2
73+
- api:
74+
crdVersion: v1
75+
namespaced: true
76+
controller: true
77+
domain: github.com
78+
group: apisix.apache.org
79+
kind: ApisixUpstream
80+
path: github.com/apache/apisix-ingress-controller/api/v2
81+
version: v2
82+
- api:
83+
crdVersion: v1
84+
namespaced: true
85+
domain: github.com
86+
group: apisix.apache.org
87+
kind: ApisixPluginConfig
88+
path: github.com/apache/apisix-ingress-controller/api/v2
89+
version: v2
3790
version: "3"

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v2/apisixconsumer_types.go

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
13+
package v2
14+
15+
import (
16+
corev1 "k8s.io/api/core/v1"
17+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
18+
)
19+
20+
// ApisixConsumerSpec defines the desired state of ApisixConsumer.
21+
type ApisixConsumerSpec struct {
22+
// IngressClassName is the name of an IngressClass cluster resource.
23+
// controller implementations use this field to know whether they should be
24+
// serving this ApisixConsumer resource, by a transitive connection
25+
// (controller -> IngressClass -> ApisixConsumer resource).
26+
IngressClassName string `json:"ingressClassName,omitempty" yaml:"ingressClassName,omitempty"`
27+
28+
AuthParameter ApisixConsumerAuthParameter `json:"authParameter" yaml:"authParameter"`
29+
}
30+
31+
// ApisixConsumerStatus defines the observed state of ApisixConsumer.
32+
type ApisixConsumerStatus = ApisixStatus
33+
34+
// +kubebuilder:object:root=true
35+
// +kubebuilder:subresource:status
36+
37+
// ApisixConsumer is the Schema for the apisixconsumers API.
38+
type ApisixConsumer struct {
39+
metav1.TypeMeta `json:",inline"`
40+
metav1.ObjectMeta `json:"metadata,omitempty"`
41+
42+
Spec ApisixConsumerSpec `json:"spec,omitempty"`
43+
Status ApisixConsumerStatus `json:"status,omitempty"`
44+
}
45+
46+
// +kubebuilder:object:root=true
47+
48+
// ApisixConsumerList contains a list of ApisixConsumer.
49+
type ApisixConsumerList struct {
50+
metav1.TypeMeta `json:",inline"`
51+
metav1.ListMeta `json:"metadata,omitempty"`
52+
Items []ApisixConsumer `json:"items"`
53+
}
54+
55+
type ApisixConsumerAuthParameter struct {
56+
BasicAuth *ApisixConsumerBasicAuth `json:"basicAuth,omitempty" yaml:"basicAuth"`
57+
KeyAuth *ApisixConsumerKeyAuth `json:"keyAuth,omitempty" yaml:"keyAuth"`
58+
WolfRBAC *ApisixConsumerWolfRBAC `json:"wolfRBAC,omitempty" yaml:"wolfRBAC"`
59+
JwtAuth *ApisixConsumerJwtAuth `json:"jwtAuth,omitempty" yaml:"jwtAuth"`
60+
HMACAuth *ApisixConsumerHMACAuth `json:"hmacAuth,omitempty" yaml:"hmacAuth"`
61+
LDAPAuth *ApisixConsumerLDAPAuth `json:"ldapAuth,omitempty" yaml:"ldapAuth"`
62+
}
63+
64+
// ApisixConsumerBasicAuth defines the configuration for basic auth.
65+
type ApisixConsumerBasicAuth struct {
66+
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty" yaml:"secretRef,omitempty"`
67+
Value *ApisixConsumerBasicAuthValue `json:"value,omitempty" yaml:"value,omitempty"`
68+
}
69+
70+
// ApisixConsumerBasicAuthValue defines the in-place username and password configuration for basic auth.
71+
type ApisixConsumerBasicAuthValue struct {
72+
Username string `json:"username" yaml:"username"`
73+
Password string `json:"password" yaml:"password"`
74+
}
75+
76+
// ApisixConsumerKeyAuth defines the configuration for the key auth.
77+
type ApisixConsumerKeyAuth struct {
78+
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty" yaml:"secretRef,omitempty"`
79+
Value *ApisixConsumerKeyAuthValue `json:"value,omitempty" yaml:"value,omitempty"`
80+
}
81+
82+
// ApisixConsumerKeyAuthValue defines the in-place configuration for basic auth.
83+
type ApisixConsumerKeyAuthValue struct {
84+
Key string `json:"key" yaml:"key"`
85+
}
86+
87+
// ApisixConsumerWolfRBAC defines the configuration for the wolf-rbac auth.
88+
type ApisixConsumerWolfRBAC struct {
89+
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty" yaml:"secretRef,omitempty"`
90+
Value *ApisixConsumerWolfRBACValue `json:"value,omitempty" yaml:"value,omitempty"`
91+
}
92+
93+
// ApisixConsumerWolfRBAC defines the in-place server and appid and header_prefix configuration for wolf-rbac auth.
94+
type ApisixConsumerWolfRBACValue struct {
95+
Server string `json:"server,omitempty" yaml:"server,omitempty"`
96+
Appid string `json:"appid,omitempty" yaml:"appid,omitempty"`
97+
HeaderPrefix string `json:"header_prefix,omitempty" yaml:"header_prefix,omitempty"`
98+
}
99+
100+
// ApisixConsumerJwtAuth defines the configuration for the jwt auth.
101+
type ApisixConsumerJwtAuth struct {
102+
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty" yaml:"secretRef,omitempty"`
103+
Value *ApisixConsumerJwtAuthValue `json:"value,omitempty" yaml:"value,omitempty"`
104+
}
105+
106+
// ApisixConsumerJwtAuthValue defines the in-place configuration for jwt auth.
107+
type ApisixConsumerJwtAuthValue struct {
108+
Key string `json:"key" yaml:"key"`
109+
Secret string `json:"secret,omitempty" yaml:"secret,omitempty"`
110+
PublicKey string `json:"public_key,omitempty" yaml:"public_key,omitempty"`
111+
PrivateKey string `json:"private_key" yaml:"private_key,omitempty"`
112+
Algorithm string `json:"algorithm,omitempty" yaml:"algorithm,omitempty"`
113+
Exp int64 `json:"exp,omitempty" yaml:"exp,omitempty"`
114+
Base64Secret bool `json:"base64_secret,omitempty" yaml:"base64_secret,omitempty"`
115+
LifetimeGracePeriod int64 `json:"lifetime_grace_period,omitempty" yaml:"lifetime_grace_period,omitempty"`
116+
}
117+
118+
// ApisixConsumerHMACAuth defines the configuration for the hmac auth.
119+
type ApisixConsumerHMACAuth struct {
120+
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty" yaml:"secretRef,omitempty"`
121+
Value *ApisixConsumerHMACAuthValue `json:"value,omitempty" yaml:"value,omitempty"`
122+
}
123+
124+
// ApisixConsumerHMACAuthValue defines the in-place configuration for hmac auth.
125+
type ApisixConsumerHMACAuthValue struct {
126+
AccessKey string `json:"access_key" yaml:"access_key"`
127+
SecretKey string `json:"secret_key" yaml:"secret_key"`
128+
Algorithm string `json:"algorithm,omitempty" yaml:"algorithm,omitempty"`
129+
ClockSkew int64 `json:"clock_skew,omitempty" yaml:"clock_skew,omitempty"`
130+
SignedHeaders []string `json:"signed_headers,omitempty" yaml:"signed_headers,omitempty"`
131+
KeepHeaders bool `json:"keep_headers,omitempty" yaml:"keep_headers,omitempty"`
132+
EncodeURIParams bool `json:"encode_uri_params,omitempty" yaml:"encode_uri_params,omitempty"`
133+
ValidateRequestBody bool `json:"validate_request_body,omitempty" yaml:"validate_request_body,omitempty"`
134+
MaxReqBody int64 `json:"max_req_body,omitempty" yaml:"max_req_body,omitempty"`
135+
}
136+
137+
// ApisixConsumerLDAPAuth defines the configuration for the ldap auth.
138+
type ApisixConsumerLDAPAuth struct {
139+
SecretRef *corev1.LocalObjectReference `json:"secretRef" yaml:"secret"`
140+
Value *ApisixConsumerLDAPAuthValue `json:"value,omitempty" yaml:"value,omitempty"`
141+
}
142+
143+
// ApisixConsumerLDAPAuthValue defines the in-place configuration for ldap auth.
144+
type ApisixConsumerLDAPAuthValue struct {
145+
UserDN string `json:"user_dn" yaml:"user_dn"`
146+
}
147+
148+
func init() {
149+
SchemeBuilder.Register(&ApisixConsumer{}, &ApisixConsumerList{})
150+
}

0 commit comments

Comments
 (0)