Skip to content

Commit 40c2b93

Browse files
committed
Merge branch 'release-v2-dev' into refactor/adc
2 parents 6e101bb + 34fb324 commit 40c2b93

28 files changed

+381
-67
lines changed

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ GATEAY_API_VERSION ?= v1.1.0
1515
DASHBOARD_VERSION ?= dev
1616
TEST_TIMEOUT ?= 30m
1717

18+
export KUBECONFIG = /tmp/$(KIND_NAME).kubeconfig
19+
1820
# go
1921
VERSYM="github.com/api7/api7-ingress-controller/internal/version._buildVersion"
2022
GITSHASYM="github.com/api7/api7-ingress-controller/internal/version._buildGitRevision"
@@ -87,6 +89,7 @@ kind-e2e-test: kind-up build-image kind-load-images e2e-test
8789
# Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
8890
.PHONY: e2e-test
8991
e2e-test:
92+
@kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG
9093
DASHBOARD_VERSION=$(DASHBOARD_VERSION) go test ./test/e2e/ -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)"
9194

9295
.PHONY: conformance-test
@@ -106,6 +109,7 @@ kind-up:
106109
@kind get clusters 2>&1 | grep -v $(KIND_NAME) \
107110
&& kind create cluster --name $(KIND_NAME) \
108111
|| echo "kind cluster already exists"
112+
@kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG
109113
kubectl wait --for=condition=Ready nodes --all
110114

111115
.PHONY: kind-down
@@ -255,6 +259,11 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
255259
$(GOLANGCI_LINT): $(LOCALBIN)
256260
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
257261

262+
gofmt: ## Apply go fmt
263+
@gofmt -w -r 'interface{} -> any' .
264+
@go fmt ./...
265+
.PHONY: gofmt
266+
258267
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
259268
# $1 - target path with name of binary
260269
# $2 - package url which can be installed
@@ -270,6 +279,3 @@ mv $(1) $(1)-$(3) ;\
270279
} ;\
271280
ln -sf $(1)-$(3) $(1)
272281
endef
273-
274-
275-

PROJECT

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
domain: github.com
66
layout:
77
- go.kubebuilder.io/v4
8-
projectName: api7-ingress
9-
repo: github.com/api7/api7-ingress
8+
projectName: api7-ingress-controller
9+
repo: github.com/api7/api7-ingress-controller
1010
resources:
1111
- api:
1212
crdVersion: v1
@@ -17,4 +17,13 @@ resources:
1717
kind: Guestbook
1818
path: github.com/api7/api7-ingress-controller/api/v1alpha1
1919
version: v1alpha1
20+
- api:
21+
crdVersion: v1
22+
namespaced: true
23+
controller: true
24+
domain: github.com
25+
group: gateway.apisix.io
26+
kind: GatewayProxy
27+
path: github.com/api7/api7-ingress-controller/api/v1alpha1
28+
version: v1alpha1
2029
version: "3"

api/dashboard/v1/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func (s *StringOrSlice) UnmarshalJSON(p []byte) error {
237237
return err
238238
}
239239

240-
type Plugins map[string]interface{}
240+
type Plugins map[string]any
241241

242242
func (p *Plugins) DeepCopyInto(out *Plugins) {
243243
b, _ := json.Marshal(&p)

api/v1alpha1/gatewayproxy_types.go

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
Copyright 2024.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
21+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
)
23+
24+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
25+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
26+
27+
// GatewayProxySpec defines the desired state of GatewayProxy
28+
type GatewayProxySpec struct {
29+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
30+
// Important: Run "make" to regenerate code after modifying this file
31+
32+
Plugins []GatewayProxyPlugin `json:"plugins,omitempty"`
33+
PluginMetadata map[string]apiextensionsv1.JSON `json:"pluginMetadata,omitempty"`
34+
}
35+
36+
// +kubebuilder:object:root=true
37+
// GatewayProxy is the Schema for the gatewayproxies API
38+
type GatewayProxy struct {
39+
metav1.TypeMeta `json:",inline"`
40+
metav1.ObjectMeta `json:"metadata,omitempty"`
41+
42+
Spec GatewayProxySpec `json:"spec,omitempty"`
43+
}
44+
45+
// +kubebuilder:object:root=true
46+
// GatewayProxyList contains a list of GatewayProxy
47+
type GatewayProxyList struct {
48+
metav1.TypeMeta `json:",inline"`
49+
metav1.ListMeta `json:"metadata,omitempty"`
50+
Items []GatewayProxy `json:"items"`
51+
}
52+
53+
type GatewayProxyPlugin struct {
54+
Name string `json:"name,omitempty"`
55+
Enabled bool `json:"enabled,omitempty"`
56+
Config apiextensionsv1.JSON `json:"config,omitempty"`
57+
}
58+
59+
func init() {
60+
SchemeBuilder.Register(&GatewayProxy{}, &GatewayProxyList{})
61+
}

api/v1alpha1/zz_generated.deepcopy.go

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

cmd/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ limitations under the License.
1717
package main
1818

1919
import (
20-
"github.com/api7/api7-ingress-controller/cmd/root"
2120
"github.com/spf13/cobra"
21+
22+
"github.com/api7/api7-ingress-controller/cmd/root"
2223
)
2324

2425
func main() {
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.15.0
7+
name: gatewayproxies.gateway.apisix.io
8+
spec:
9+
group: gateway.apisix.io
10+
names:
11+
kind: GatewayProxy
12+
listKind: GatewayProxyList
13+
plural: gatewayproxies
14+
singular: gatewayproxy
15+
scope: Namespaced
16+
versions:
17+
- name: v1alpha1
18+
schema:
19+
openAPIV3Schema:
20+
description: GatewayProxy is the Schema for the gatewayproxies API
21+
properties:
22+
apiVersion:
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
28+
type: string
29+
kind:
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
36+
type: string
37+
metadata:
38+
type: object
39+
spec:
40+
description: GatewayProxySpec defines the desired state of GatewayProxy
41+
properties:
42+
pluginMetadata:
43+
additionalProperties:
44+
x-kubernetes-preserve-unknown-fields: true
45+
type: object
46+
plugins:
47+
items:
48+
properties:
49+
config:
50+
x-kubernetes-preserve-unknown-fields: true
51+
enabled:
52+
type: boolean
53+
name:
54+
type: string
55+
type: object
56+
type: array
57+
type: object
58+
type: object
59+
served: true
60+
storage: true

config/crd/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
# It should be run by config/default
44
resources:
55
- bases/gateway.apisix.io_pluginconfigs.yaml
6+
- bases/gateway.apisix.io_gatewayproxies.yaml
67
# +kubebuilder:scaffold:crdkustomizeresource
78

89
patches:
910
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
1011
# patches here are for enabling the conversion webhook for each CRD
12+
#- path: patches/webhook_in_gatewayproxies.yaml
1113
# +kubebuilder:scaffold:crdkustomizewebhookpatch
1214

1315
# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
1416
# patches here are for enabling the CA injection for each CRD
1517
#- path: patches/cainjection_in_guestbooks.yaml
18+
#- path: patches/cainjection_in_gatewayproxies.yaml
1619
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
1720

1821
# [WEBHOOK] To enable webhook, uncomment the following section
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# permissions for end users to edit gatewayproxies.
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
labels:
6+
app.kubernetes.io/name: clusterrole
7+
app.kubernetes.io/instance: gatewayproxy-editor-role
8+
app.kubernetes.io/component: rbac
9+
app.kubernetes.io/created-by: api7-ingress-controller
10+
app.kubernetes.io/part-of: api7-ingress-controller
11+
app.kubernetes.io/managed-by: kustomize
12+
name: gatewayproxy-editor-role
13+
rules:
14+
- apiGroups:
15+
- gateway.apisix.io.github.com
16+
resources:
17+
- gatewayproxies
18+
verbs:
19+
- create
20+
- delete
21+
- get
22+
- list
23+
- patch
24+
- update
25+
- watch
26+
- apiGroups:
27+
- gateway.apisix.io.github.com
28+
resources:
29+
- gatewayproxies/status
30+
verbs:
31+
- get

0 commit comments

Comments
 (0)