You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by to...@apache.org on 2020/12/29 10:40:30 UTC
[apisix-ingress-controller] branch master updated: chore: integrate
api7/types. (#134)
This is an automated email from the ASF dual-hosted git repository.
tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git
The following commit(s) were added to refs/heads/master by this push:
new 782730a chore: integrate api7/types. (#134)
782730a is described below
commit 782730aeb3d6362796e2299d12abe190cbb38569
Author: Alex Zhang <zc...@gmail.com>
AuthorDate: Tue Dec 29 18:40:20 2020 +0800
chore: integrate api7/types. (#134)
---
.actions/ASF-Release.cfg | 3 +
go.mod | 1 -
go.sum | 2 -
pkg/ingress/apisix/annotation.go | 3 +-
pkg/ingress/apisix/route.go | 2 +-
pkg/ingress/apisix/service.go | 2 +-
pkg/ingress/apisix/tls.go | 4 +-
pkg/ingress/apisix/tls_test.go | 9 +-
pkg/ingress/apisix/upstream.go | 2 +-
pkg/ingress/apisix/upstream_test.go | 3 +-
pkg/ingress/controller/apisix_route.go | 7 +-
pkg/ingress/controller/endpoint.go | 19 +-
pkg/ingress/controller/watch.go | 10 +-
pkg/ingress/endpoint/ep.go | 5 +-
pkg/seven/apisix/route.go | 3 +-
pkg/seven/apisix/service.go | 2 +-
pkg/seven/apisix/ssl.go | 2 +-
pkg/seven/apisix/upstream.go | 2 +-
pkg/seven/db/route.go | 3 +-
pkg/seven/db/service.go | 3 +-
pkg/seven/db/upstream.go | 4 +-
pkg/seven/state/builder.go | 2 +-
pkg/seven/state/event.go | 2 +-
pkg/seven/state/route_worker.go | 4 +-
pkg/seven/state/service_worker.go | 2 +-
pkg/seven/state/solver.go | 3 +-
pkg/seven/state/upstream_worker.go | 4 +-
.../upstream_worker.go => types/apisix/v1/doc.go} | 10 +-
pkg/types/apisix/v1/types.go | 99 +++++++
pkg/types/apisix/v1/zz_generated.deepcopy.go | 322 +++++++++++++++++++++
30 files changed, 481 insertions(+), 58 deletions(-)
diff --git a/.actions/ASF-Release.cfg b/.actions/ASF-Release.cfg
index bcae9d6..2afe1df 100644
--- a/.actions/ASF-Release.cfg
+++ b/.actions/ASF-Release.cfg
@@ -65,6 +65,9 @@ ASFLicenseHeaderMarkdown.txt
.pydevproject
.rat-excludes
.tox
+# zz_generated.deepcopy.go is generated by tool, which has different license
+# header format.
+zz_generated.deepcopy.go
# Exclude Apache standard legal files
CREDITS.txt
diff --git a/go.mod b/go.mod
index 906ec2b..821dab1 100644
--- a/go.mod
+++ b/go.mod
@@ -7,7 +7,6 @@ require (
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/gxthrj/apisix-ingress-types v0.1.3
- github.com/gxthrj/apisix-types v0.1.3
github.com/hashicorp/go-memdb v1.0.4
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
github.com/mattn/go-colorable v0.1.4 // indirect
diff --git a/go.sum b/go.sum
index 096a026..41f38a7 100644
--- a/go.sum
+++ b/go.sum
@@ -20,8 +20,6 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/api7/ingress-types v0.1.3 h1:euvLySusNeOjzOjnpZl+J3Ve5ZcWoby/lm3lPmH4xTI=
github.com/api7/ingress-types v0.1.3/go.mod h1:xWuHLSHGN4/JZjz9b0ftKgtE3yZ7NehkJAiTyZ+KoPA=
-github.com/api7/types v0.1.3 h1:AuDAM1a5N+b7ovBduomIVMXlGlPa6EDCSj7XZon0AzY=
-github.com/api7/types v0.1.3/go.mod h1:STdHATWxqIeJhUEXt6dZTd6z0To0qO70K/1mnfBtlC0=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
diff --git a/pkg/ingress/apisix/annotation.go b/pkg/ingress/apisix/annotation.go
index 0bf0459..e7b62e2 100644
--- a/pkg/ingress/apisix/annotation.go
+++ b/pkg/ingress/apisix/annotation.go
@@ -17,9 +17,8 @@ package apisix
import (
"strconv"
- apisix "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
-
seven "github.com/api7/ingress-controller/pkg/seven/apisix"
+ apisix "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
// BuildAnnotation return plugins and group
diff --git a/pkg/ingress/apisix/route.go b/pkg/ingress/apisix/route.go
index d40734a..ce5aec9 100644
--- a/pkg/ingress/apisix/route.go
+++ b/pkg/ingress/apisix/route.go
@@ -18,10 +18,10 @@ import (
"strconv"
ingress "github.com/gxthrj/apisix-ingress-types/pkg/apis/config/v1"
- apisix "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/api7/ingress-controller/pkg/ingress/endpoint"
"github.com/api7/ingress-controller/pkg/seven/conf"
+ apisix "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
const (
diff --git a/pkg/ingress/apisix/service.go b/pkg/ingress/apisix/service.go
index 62d11e4..a3660bc 100644
--- a/pkg/ingress/apisix/service.go
+++ b/pkg/ingress/apisix/service.go
@@ -18,10 +18,10 @@ import (
"strconv"
ingress "github.com/gxthrj/apisix-ingress-types/pkg/apis/config/v1"
- apisix "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/api7/ingress-controller/pkg/ingress/endpoint"
"github.com/api7/ingress-controller/pkg/seven/conf"
+ apisix "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
const (
diff --git a/pkg/ingress/apisix/tls.go b/pkg/ingress/apisix/tls.go
index 10c3201..49cd73c 100644
--- a/pkg/ingress/apisix/tls.go
+++ b/pkg/ingress/apisix/tls.go
@@ -16,12 +16,12 @@ package apisix
import (
ingress "github.com/gxthrj/apisix-ingress-types/pkg/apis/config/v1"
- apisix "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
- "k8s.io/api/core/v1"
+ v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
ingressConf "github.com/api7/ingress-controller/pkg/kube"
"github.com/api7/ingress-controller/pkg/seven/conf"
+ apisix "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
const (
diff --git a/pkg/ingress/apisix/tls_test.go b/pkg/ingress/apisix/tls_test.go
index e5c9ade..5eb0661 100644
--- a/pkg/ingress/apisix/tls_test.go
+++ b/pkg/ingress/apisix/tls_test.go
@@ -19,10 +19,11 @@ import (
"fmt"
"testing"
- a6Type "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v2"
- "k8s.io/api/core/v1"
+ v1 "k8s.io/api/core/v1"
+
+ apisix "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
func TestConvert(t *testing.T) {
@@ -46,7 +47,7 @@ spec:
cert := "root"
key := "123456"
group := ""
- sslExpect := &a6Type.Ssl{
+ sslExpect := &apisix.Ssl{
ID: &id,
Snis: snis,
Cert: &cert,
@@ -89,7 +90,7 @@ spec:
cert := "root"
key := "123456"
group := "127.0.0.1:9080"
- sslExpect := &a6Type.Ssl{
+ sslExpect := &apisix.Ssl{
ID: &id,
Snis: snis,
Cert: &cert,
diff --git a/pkg/ingress/apisix/upstream.go b/pkg/ingress/apisix/upstream.go
index 358ff81..03e6edf 100644
--- a/pkg/ingress/apisix/upstream.go
+++ b/pkg/ingress/apisix/upstream.go
@@ -18,10 +18,10 @@ import (
"strconv"
ingress "github.com/gxthrj/apisix-ingress-types/pkg/apis/config/v1"
- apisix "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/api7/ingress-controller/pkg/ingress/endpoint"
"github.com/api7/ingress-controller/pkg/seven/conf"
+ apisix "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
const (
diff --git a/pkg/ingress/apisix/upstream_test.go b/pkg/ingress/apisix/upstream_test.go
index 7edf234..df0e045 100644
--- a/pkg/ingress/apisix/upstream_test.go
+++ b/pkg/ingress/apisix/upstream_test.go
@@ -19,9 +19,10 @@ import (
"testing"
ingress "github.com/gxthrj/apisix-ingress-types/pkg/apis/config/v1"
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v2"
+
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
func TestApisixUpstreamCRD_Convert(t *testing.T) {
diff --git a/pkg/ingress/controller/apisix_route.go b/pkg/ingress/controller/apisix_route.go
index 0759f20..adafe4e 100644
--- a/pkg/ingress/controller/apisix_route.go
+++ b/pkg/ingress/controller/apisix_route.go
@@ -16,12 +16,13 @@ package controller
import (
"fmt"
+ "time"
+
api6V1 "github.com/gxthrj/apisix-ingress-types/pkg/apis/config/v1"
clientSet "github.com/gxthrj/apisix-ingress-types/pkg/client/clientset/versioned"
api6Scheme "github.com/gxthrj/apisix-ingress-types/pkg/client/clientset/versioned/scheme"
api6Informers "github.com/gxthrj/apisix-ingress-types/pkg/client/informers/externalversions/config/v1"
- "github.com/gxthrj/apisix-ingress-types/pkg/client/listers/config/v1"
- apisixV1 "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
+ v1 "github.com/gxthrj/apisix-ingress-types/pkg/client/listers/config/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
@@ -29,11 +30,11 @@ import (
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
- "time"
"github.com/api7/ingress-controller/pkg/ingress/apisix"
"github.com/api7/ingress-controller/pkg/log"
"github.com/api7/ingress-controller/pkg/seven/state"
+ apisixV1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
type ApisixRouteController struct {
diff --git a/pkg/ingress/controller/endpoint.go b/pkg/ingress/controller/endpoint.go
index b21cfbf..03504ca 100644
--- a/pkg/ingress/controller/endpoint.go
+++ b/pkg/ingress/controller/endpoint.go
@@ -16,8 +16,10 @@ package controller
import (
"fmt"
+ "strconv"
+ "time"
+
"github.com/golang/glog"
- apisixType "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
CoreV1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/util/runtime"
@@ -26,14 +28,13 @@ import (
CoreListerV1 "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
- "strconv"
- "time"
"github.com/api7/ingress-controller/pkg/kube"
"github.com/api7/ingress-controller/pkg/log"
"github.com/api7/ingress-controller/pkg/seven/apisix"
sevenConf "github.com/api7/ingress-controller/pkg/seven/conf"
"github.com/api7/ingress-controller/pkg/seven/state"
+ apisixv1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
type EndpointController struct {
@@ -150,12 +151,12 @@ func (c *EndpointController) process(ep *CoreV1.Endpoints) {
//if err == nil {
// for _, upstream := range upstreams {
// if *(upstream.Name) == upstreamName {
- // nodes := make([]*apisixType.Node, 0)
+ // nodes := make([]*apisixv1.Node, 0)
// for _, ip := range ips {
// ipAddress := ip
// p := int(port.Port)
// weight := 100
- // node := &apisixType.Node{IP: &ipAddress, Port: &p, Weight: &weight}
+ // node := &apisixv1.Node{IP: &ipAddress, Port: &p, Weight: &weight}
// nodes = append(nodes, node)
// }
// upstream.Nodes = nodes
@@ -164,7 +165,7 @@ func (c *EndpointController) process(ep *CoreV1.Endpoints) {
// //apisix.UpdateUpstream(upstream)
// fromKind := WatchFromKind
// upstream.FromKind = &fromKind
- // upstreams := []*apisixType.Upstream{upstream}
+ // upstreams := []*apisixv1.Upstream{upstream}
// comb := state.ApisixCombination{Routes: nil, Services: nil, Upstreams: upstreams}
// if _, err = comb.Solver(); err != nil {
// glog.Errorf(err.Error())
@@ -183,12 +184,12 @@ func syncWithGroup(group, upstreamName string, ips []string, port CoreV1.Endpoin
if err == nil {
for _, upstream := range upstreams {
if *(upstream.Name) == upstreamName {
- nodes := make([]*apisixType.Node, 0)
+ nodes := make([]*apisixv1.Node, 0)
for _, ip := range ips {
ipAddress := ip
p := int(port.Port)
weight := 100
- node := &apisixType.Node{IP: &ipAddress, Port: &p, Weight: &weight}
+ node := &apisixv1.Node{IP: &ipAddress, Port: &p, Weight: &weight}
nodes = append(nodes, node)
}
upstream.Nodes = nodes
@@ -197,7 +198,7 @@ func syncWithGroup(group, upstreamName string, ips []string, port CoreV1.Endpoin
//apisix.UpdateUpstream(upstream)
fromKind := WatchFromKind
upstream.FromKind = &fromKind
- upstreams := []*apisixType.Upstream{upstream}
+ upstreams := []*apisixv1.Upstream{upstream}
comb := state.ApisixCombination{Routes: nil, Services: nil, Upstreams: upstreams}
if _, err = comb.Solver(); err != nil {
glog.Errorf(err.Error())
diff --git a/pkg/ingress/controller/watch.go b/pkg/ingress/controller/watch.go
index 6738e19..dfcd06d 100644
--- a/pkg/ingress/controller/watch.go
+++ b/pkg/ingress/controller/watch.go
@@ -19,12 +19,12 @@ import (
"github.com/api7/ingress-controller/pkg/kube"
"github.com/golang/glog"
- apisixType "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
- "k8s.io/api/core/v1"
+ v1 "k8s.io/api/core/v1"
"github.com/api7/ingress-controller/pkg/seven/apisix"
sevenConf "github.com/api7/ingress-controller/pkg/seven/conf"
"github.com/api7/ingress-controller/pkg/seven/state"
+ apisixv1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
const (
@@ -75,12 +75,12 @@ func (c *controller) process(obj interface{}) {
if err == nil {
for _, upstream := range upstreams {
if *(upstream.Name) == upstreamName {
- nodes := make([]*apisixType.Node, 0)
+ nodes := make([]*apisixv1.Node, 0)
for _, ip := range ips {
ipAddress := ip
p := int(port.Port)
weight := 100
- node := &apisixType.Node{IP: &ipAddress, Port: &p, Weight: &weight}
+ node := &apisixv1.Node{IP: &ipAddress, Port: &p, Weight: &weight}
nodes = append(nodes, node)
}
upstream.Nodes = nodes
@@ -89,7 +89,7 @@ func (c *controller) process(obj interface{}) {
//apisix.UpdateUpstream(upstream)
fromKind := WatchFromKind
upstream.FromKind = &fromKind
- upstreams := []*apisixType.Upstream{upstream}
+ upstreams := []*apisixv1.Upstream{upstream}
comb := state.ApisixCombination{Routes: nil, Services: nil, Upstreams: upstreams}
if _, err = comb.Solver(); err != nil {
glog.Errorf(err.Error())
diff --git a/pkg/ingress/endpoint/ep.go b/pkg/ingress/endpoint/ep.go
index ad77d4a..32eee37 100644
--- a/pkg/ingress/endpoint/ep.go
+++ b/pkg/ingress/endpoint/ep.go
@@ -15,9 +15,10 @@
package endpoint
import (
- "github.com/api7/ingress-controller/pkg/kube"
"github.com/golang/glog"
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
+
+ "github.com/api7/ingress-controller/pkg/kube"
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
type Endpoint interface {
diff --git a/pkg/seven/apisix/route.go b/pkg/seven/apisix/route.go
index 3ad709f..711bd6a 100644
--- a/pkg/seven/apisix/route.go
+++ b/pkg/seven/apisix/route.go
@@ -20,11 +20,10 @@ import (
"fmt"
"strings"
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
-
"github.com/api7/ingress-controller/pkg/seven/conf"
sevendb "github.com/api7/ingress-controller/pkg/seven/db"
"github.com/api7/ingress-controller/pkg/seven/utils"
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
// FindCurrentRoute find current route in memDB
diff --git a/pkg/seven/apisix/service.go b/pkg/seven/apisix/service.go
index a036e8e..7e11222 100644
--- a/pkg/seven/apisix/service.go
+++ b/pkg/seven/apisix/service.go
@@ -21,11 +21,11 @@ import (
"strings"
"github.com/golang/glog"
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/api7/ingress-controller/pkg/seven/conf"
sevendb "github.com/api7/ingress-controller/pkg/seven/db"
"github.com/api7/ingress-controller/pkg/seven/utils"
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
// FindCurrentService find service from memDB,
diff --git a/pkg/seven/apisix/ssl.go b/pkg/seven/apisix/ssl.go
index 4933f80..deadbb6 100644
--- a/pkg/seven/apisix/ssl.go
+++ b/pkg/seven/apisix/ssl.go
@@ -21,10 +21,10 @@ import (
"strings"
"github.com/golang/glog"
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/api7/ingress-controller/pkg/seven/conf"
"github.com/api7/ingress-controller/pkg/seven/utils"
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
// ListSsl list ssl from etcd , convert to v1.Upstream
diff --git a/pkg/seven/apisix/upstream.go b/pkg/seven/apisix/upstream.go
index 5d9b372..ac0dfdf 100644
--- a/pkg/seven/apisix/upstream.go
+++ b/pkg/seven/apisix/upstream.go
@@ -22,11 +22,11 @@ import (
"strings"
"github.com/golang/glog"
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/api7/ingress-controller/pkg/seven/conf"
"github.com/api7/ingress-controller/pkg/seven/db"
"github.com/api7/ingress-controller/pkg/seven/utils"
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
// FindCurrentUpstream find upstream from memDB,
diff --git a/pkg/seven/db/route.go b/pkg/seven/db/route.go
index d6c143e..5c1b1bc 100644
--- a/pkg/seven/db/route.go
+++ b/pkg/seven/db/route.go
@@ -17,8 +17,9 @@ package db
import (
"fmt"
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/hashicorp/go-memdb"
+
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
const (
diff --git a/pkg/seven/db/service.go b/pkg/seven/db/service.go
index d47bd29..aa287ab 100644
--- a/pkg/seven/db/service.go
+++ b/pkg/seven/db/service.go
@@ -17,8 +17,9 @@ package db
import (
"fmt"
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/hashicorp/go-memdb"
+
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
const (
diff --git a/pkg/seven/db/upstream.go b/pkg/seven/db/upstream.go
index 361565c..93bac65 100644
--- a/pkg/seven/db/upstream.go
+++ b/pkg/seven/db/upstream.go
@@ -16,8 +16,10 @@ package db
import (
"fmt"
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
+
"github.com/hashicorp/go-memdb"
+
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
const (
diff --git a/pkg/seven/state/builder.go b/pkg/seven/state/builder.go
index a300b55..f72c17b 100644
--- a/pkg/seven/state/builder.go
+++ b/pkg/seven/state/builder.go
@@ -19,11 +19,11 @@ import (
"strings"
"github.com/golang/glog"
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/api7/ingress-controller/pkg/seven/apisix"
"github.com/api7/ingress-controller/pkg/seven/db"
"github.com/api7/ingress-controller/pkg/seven/utils"
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
const (
diff --git a/pkg/seven/state/event.go b/pkg/seven/state/event.go
index 026b99e..e48b1d4 100644
--- a/pkg/seven/state/event.go
+++ b/pkg/seven/state/event.go
@@ -15,7 +15,7 @@
package state
import (
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
type ApisixCombination struct {
diff --git a/pkg/seven/state/route_worker.go b/pkg/seven/state/route_worker.go
index 1ee0c31..ff84f3a 100644
--- a/pkg/seven/state/route_worker.go
+++ b/pkg/seven/state/route_worker.go
@@ -14,7 +14,9 @@
// limitations under the License.
package state
-import "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
+import (
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
+)
type routeWorker struct {
*v1.Route
diff --git a/pkg/seven/state/service_worker.go b/pkg/seven/state/service_worker.go
index 20e173f..8b34965 100644
--- a/pkg/seven/state/service_worker.go
+++ b/pkg/seven/state/service_worker.go
@@ -19,11 +19,11 @@ import (
"strings"
"github.com/golang/glog"
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
"github.com/api7/ingress-controller/pkg/seven/apisix"
"github.com/api7/ingress-controller/pkg/seven/db"
"github.com/api7/ingress-controller/pkg/seven/utils"
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
const ApisixService = "ApisixService"
diff --git a/pkg/seven/state/solver.go b/pkg/seven/state/solver.go
index 392680a..820222b 100644
--- a/pkg/seven/state/solver.go
+++ b/pkg/seven/state/solver.go
@@ -15,10 +15,9 @@
package state
import (
- "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
-
"github.com/api7/ingress-controller/pkg/seven/apisix"
"github.com/api7/ingress-controller/pkg/seven/db"
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
)
var UpstreamQueue chan UpstreamQueueObj
diff --git a/pkg/seven/state/upstream_worker.go b/pkg/seven/state/upstream_worker.go
index 3f33ce6..33818eb 100644
--- a/pkg/seven/state/upstream_worker.go
+++ b/pkg/seven/state/upstream_worker.go
@@ -14,7 +14,9 @@
// limitations under the License.
package state
-import "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
+import (
+ v1 "github.com/api7/ingress-controller/pkg/types/apisix/v1"
+)
type upstreamWorker struct {
*v1.Upstream
diff --git a/pkg/seven/state/upstream_worker.go b/pkg/types/apisix/v1/doc.go
similarity index 83%
copy from pkg/seven/state/upstream_worker.go
copy to pkg/types/apisix/v1/doc.go
index 3f33ce6..18c85e7 100644
--- a/pkg/seven/state/upstream_worker.go
+++ b/pkg/types/apisix/v1/doc.go
@@ -12,12 +12,4 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-package state
-
-import "github.com/gxthrj/apisix-types/pkg/apis/apisix/v1"
-
-type upstreamWorker struct {
- *v1.Upstream
- Event chan Event
- Quit chan Quit
-}
+package v1
diff --git a/pkg/types/apisix/v1/types.go b/pkg/types/apisix/v1/types.go
new file mode 100644
index 0000000..694b9e2
--- /dev/null
+++ b/pkg/types/apisix/v1/types.go
@@ -0,0 +1,99 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package v1
+
+import "encoding/json"
+
+// Route apisix route object
+// +k8s:deepcopy-gen=true
+type Route struct {
+ ID *string `json:"id,omitempty" yaml:"id,omitempty"`
+ Group *string `json:"group,omitempty" yaml:"group,omitempty"`
+ FullName *string `json:"full_name,omitempty" yaml:"full_name,omitempty"`
+ ResourceVersion *string `json:"resource_version,omitempty" yaml:"resource_version,omitempty"`
+ Host *string `json:"host,omitempty" yaml:"host,omitempty"`
+ Path *string `json:"path,omitempty" yaml:"path,omitempty"`
+ Name *string `json:"name,omitempty" yaml:"name,omitempty"`
+ Methods []*string `json:"methods,omitempty" yaml:"methods,omitempty"`
+ ServiceId *string `json:"service_id,omitempty" yaml:"service_id,omitempty"`
+ ServiceName *string `json:"service_name,omitempty" yaml:"service_name,omitempty"`
+ UpstreamId *string `json:"upstream_id,omitempty" yaml:"upstream_id,omitempty"`
+ UpstreamName *string `json:"upstream_name,omitempty" yaml:"upstream_name,omitempty"`
+ Plugins *Plugins `json:"plugins,omitempty" yaml:"plugins,omitempty"`
+}
+
+type Plugins map[string]interface{}
+
+func (p *Plugins) DeepCopyInto(out *Plugins) {
+ b, _ := json.Marshal(&p)
+ _ = json.Unmarshal(b, out)
+}
+
+func (p *Plugins) DeepCopy() *Plugins {
+ if p == nil {
+ return nil
+ }
+ out := new(Plugins)
+ p.DeepCopyInto(out)
+ return out
+}
+
+// Service apisix service
+// +k8s:deepcopy-gen=true
+type Service struct {
+ ID *string `json:"id,omitempty" yaml:"id,omitempty"`
+ FullName *string `json:"full_name,omitempty" yaml:"full_name,omitempty"`
+ Group *string `json:"group,omitempty" yaml:"group,omitempty"`
+ ResourceVersion *string `json:"resource_version,omitempty" yaml:"resource_version,omitempty"`
+ Name *string `json:"name,omitempty" yaml:"name,omitempty"`
+ UpstreamId *string `json:"upstream_id,omitempty" yaml:"upstream_id,omitempty"`
+ UpstreamName *string `json:"upstream_name,omitempty" yaml:"upstream_name,omitempty"`
+ Plugins *Plugins `json:"plugins,omitempty" yaml:"plugins,omitempty"`
+ FromKind *string `json:"from_kind,omitempty" yaml:"from_kind,omitempty"`
+}
+
+// Upstream apisix upstream
+// +k8s:deepcopy-gen=true
+type Upstream struct {
+ ID *string `json:"id,omitempty" yaml:"id,omitempty"`
+ FullName *string `json:"full_name,omitempty" yaml:"full_name,omitempty"`
+ Group *string `json:"group,omitempty" yaml:"group,omitempty"`
+ ResourceVersion *string `json:"resource_version,omitempty" yaml:"resource_version,omitempty"`
+ Name *string `json:"name,omitempty" yaml:"name,omitempty"`
+ Type *string `json:"type,omitempty" yaml:"type,omitempty"`
+ HashOn *string `json:"hash_on,omitemtpy" yaml:"hash_on,omitempty"`
+ Key *string `json:"key,omitempty" yaml:"key,omitempty"`
+ Nodes []*Node `json:"nodes,omitempty" yaml:"nodes,omitempty"`
+ FromKind *string `json:"from_kind,omitempty" yaml:"from_kind,omitempty"`
+}
+
+// Node the node in upstream
+// +k8s:deepcopy-gen=true
+type Node struct {
+ IP *string `json:"ip,omitempty" yaml:"ip,omitempty"`
+ Port *int `json:"port,omitempty" yaml:"port,omitempty"`
+ Weight *int `json:"weight,omitempty" yaml:"weight,omitempty"`
+}
+
+// Ssl apisix ssl object
+// +k8s:deepcopy-gen=true
+type Ssl struct {
+ ID *string `json:"id,omitempty" yaml:"id,omitempty"`
+ Snis []*string `json:"snis,omitempty" yaml:"snis,omitempty"`
+ Cert *string `json:"cert,omitempty" yaml:"cert,omitempty"`
+ Key *string `json:"key,omitempty" yaml:"key,omitempty"`
+ Status *int `json:"status,omitempty" yaml:"status,omitempty"`
+ Group *string `json:"group,omitempty" yaml:"group,omitempty"`
+}
diff --git a/pkg/types/apisix/v1/zz_generated.deepcopy.go b/pkg/types/apisix/v1/zz_generated.deepcopy.go
new file mode 100644
index 0000000..5e7e655
--- /dev/null
+++ b/pkg/types/apisix/v1/zz_generated.deepcopy.go
@@ -0,0 +1,322 @@
+// +build !ignore_autogenerated
+
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by deepcopy-gen. DO NOT EDIT.
+
+package v1
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Node) DeepCopyInto(out *Node) {
+ *out = *in
+ if in.IP != nil {
+ in, out := &in.IP, &out.IP
+ *out = new(string)
+ **out = **in
+ }
+ if in.Port != nil {
+ in, out := &in.Port, &out.Port
+ *out = new(int)
+ **out = **in
+ }
+ if in.Weight != nil {
+ in, out := &in.Weight, &out.Weight
+ *out = new(int)
+ **out = **in
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node.
+func (in *Node) DeepCopy() *Node {
+ if in == nil {
+ return nil
+ }
+ out := new(Node)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Route) DeepCopyInto(out *Route) {
+ *out = *in
+ if in.ID != nil {
+ in, out := &in.ID, &out.ID
+ *out = new(string)
+ **out = **in
+ }
+ if in.Group != nil {
+ in, out := &in.Group, &out.Group
+ *out = new(string)
+ **out = **in
+ }
+ if in.FullName != nil {
+ in, out := &in.FullName, &out.FullName
+ *out = new(string)
+ **out = **in
+ }
+ if in.ResourceVersion != nil {
+ in, out := &in.ResourceVersion, &out.ResourceVersion
+ *out = new(string)
+ **out = **in
+ }
+ if in.Host != nil {
+ in, out := &in.Host, &out.Host
+ *out = new(string)
+ **out = **in
+ }
+ if in.Path != nil {
+ in, out := &in.Path, &out.Path
+ *out = new(string)
+ **out = **in
+ }
+ if in.Name != nil {
+ in, out := &in.Name, &out.Name
+ *out = new(string)
+ **out = **in
+ }
+ if in.Methods != nil {
+ in, out := &in.Methods, &out.Methods
+ *out = make([]*string, len(*in))
+ for i := range *in {
+ if (*in)[i] != nil {
+ in, out := &(*in)[i], &(*out)[i]
+ *out = new(string)
+ **out = **in
+ }
+ }
+ }
+ if in.ServiceId != nil {
+ in, out := &in.ServiceId, &out.ServiceId
+ *out = new(string)
+ **out = **in
+ }
+ if in.ServiceName != nil {
+ in, out := &in.ServiceName, &out.ServiceName
+ *out = new(string)
+ **out = **in
+ }
+ if in.UpstreamId != nil {
+ in, out := &in.UpstreamId, &out.UpstreamId
+ *out = new(string)
+ **out = **in
+ }
+ if in.UpstreamName != nil {
+ in, out := &in.UpstreamName, &out.UpstreamName
+ *out = new(string)
+ **out = **in
+ }
+ if in.Plugins != nil {
+ in, out := &in.Plugins, &out.Plugins
+ *out = (*in).DeepCopy()
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route.
+func (in *Route) DeepCopy() *Route {
+ if in == nil {
+ return nil
+ }
+ out := new(Route)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Service) DeepCopyInto(out *Service) {
+ *out = *in
+ if in.ID != nil {
+ in, out := &in.ID, &out.ID
+ *out = new(string)
+ **out = **in
+ }
+ if in.FullName != nil {
+ in, out := &in.FullName, &out.FullName
+ *out = new(string)
+ **out = **in
+ }
+ if in.Group != nil {
+ in, out := &in.Group, &out.Group
+ *out = new(string)
+ **out = **in
+ }
+ if in.ResourceVersion != nil {
+ in, out := &in.ResourceVersion, &out.ResourceVersion
+ *out = new(string)
+ **out = **in
+ }
+ if in.Name != nil {
+ in, out := &in.Name, &out.Name
+ *out = new(string)
+ **out = **in
+ }
+ if in.UpstreamId != nil {
+ in, out := &in.UpstreamId, &out.UpstreamId
+ *out = new(string)
+ **out = **in
+ }
+ if in.UpstreamName != nil {
+ in, out := &in.UpstreamName, &out.UpstreamName
+ *out = new(string)
+ **out = **in
+ }
+ if in.Plugins != nil {
+ in, out := &in.Plugins, &out.Plugins
+ *out = (*in).DeepCopy()
+ }
+ if in.FromKind != nil {
+ in, out := &in.FromKind, &out.FromKind
+ *out = new(string)
+ **out = **in
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service.
+func (in *Service) DeepCopy() *Service {
+ if in == nil {
+ return nil
+ }
+ out := new(Service)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Ssl) DeepCopyInto(out *Ssl) {
+ *out = *in
+ if in.ID != nil {
+ in, out := &in.ID, &out.ID
+ *out = new(string)
+ **out = **in
+ }
+ if in.Snis != nil {
+ in, out := &in.Snis, &out.Snis
+ *out = make([]*string, len(*in))
+ for i := range *in {
+ if (*in)[i] != nil {
+ in, out := &(*in)[i], &(*out)[i]
+ *out = new(string)
+ **out = **in
+ }
+ }
+ }
+ if in.Cert != nil {
+ in, out := &in.Cert, &out.Cert
+ *out = new(string)
+ **out = **in
+ }
+ if in.Key != nil {
+ in, out := &in.Key, &out.Key
+ *out = new(string)
+ **out = **in
+ }
+ if in.Status != nil {
+ in, out := &in.Status, &out.Status
+ *out = new(int)
+ **out = **in
+ }
+ if in.Group != nil {
+ in, out := &in.Group, &out.Group
+ *out = new(string)
+ **out = **in
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Ssl.
+func (in *Ssl) DeepCopy() *Ssl {
+ if in == nil {
+ return nil
+ }
+ out := new(Ssl)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Upstream) DeepCopyInto(out *Upstream) {
+ *out = *in
+ if in.ID != nil {
+ in, out := &in.ID, &out.ID
+ *out = new(string)
+ **out = **in
+ }
+ if in.FullName != nil {
+ in, out := &in.FullName, &out.FullName
+ *out = new(string)
+ **out = **in
+ }
+ if in.Group != nil {
+ in, out := &in.Group, &out.Group
+ *out = new(string)
+ **out = **in
+ }
+ if in.ResourceVersion != nil {
+ in, out := &in.ResourceVersion, &out.ResourceVersion
+ *out = new(string)
+ **out = **in
+ }
+ if in.Name != nil {
+ in, out := &in.Name, &out.Name
+ *out = new(string)
+ **out = **in
+ }
+ if in.Type != nil {
+ in, out := &in.Type, &out.Type
+ *out = new(string)
+ **out = **in
+ }
+ if in.HashOn != nil {
+ in, out := &in.HashOn, &out.HashOn
+ *out = new(string)
+ **out = **in
+ }
+ if in.Key != nil {
+ in, out := &in.Key, &out.Key
+ *out = new(string)
+ **out = **in
+ }
+ if in.Nodes != nil {
+ in, out := &in.Nodes, &out.Nodes
+ *out = make([]*Node, len(*in))
+ for i := range *in {
+ if (*in)[i] != nil {
+ in, out := &(*in)[i], &(*out)[i]
+ *out = new(Node)
+ (*in).DeepCopyInto(*out)
+ }
+ }
+ }
+ if in.FromKind != nil {
+ in, out := &in.FromKind, &out.FromKind
+ *out = new(string)
+ **out = **in
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Upstream.
+func (in *Upstream) DeepCopy() *Upstream {
+ if in == nil {
+ return nil
+ }
+ out := new(Upstream)
+ in.DeepCopyInto(out)
+ return out
+}