From 351d0d082e3be5f1878130274a4ed7ce8aee10ff Mon Sep 17 00:00:00 2001 From: Ashing Zheng Date: Mon, 15 Sep 2025 17:01:28 +0800 Subject: [PATCH] chore: remove dashboard v1 dir Signed-off-by: Ashing Zheng --- api/dashboard/v1/doc.go | 18 - api/dashboard/v1/plugin_types.go | 210 ----- api/dashboard/v1/types.go | 950 ---------------------- api/dashboard/v1/zz_generated.deepcopy.go | 929 --------------------- go.mod | 5 - go.sum | 11 - test/e2e/framework/api7_dashboard.go | 23 +- 7 files changed, 19 insertions(+), 2127 deletions(-) delete mode 100644 api/dashboard/v1/doc.go delete mode 100644 api/dashboard/v1/plugin_types.go delete mode 100644 api/dashboard/v1/types.go delete mode 100644 api/dashboard/v1/zz_generated.deepcopy.go diff --git a/api/dashboard/v1/doc.go b/api/dashboard/v1/doc.go deleted file mode 100644 index fb08e3745..000000000 --- a/api/dashboard/v1/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// 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 diff --git a/api/dashboard/v1/plugin_types.go b/api/dashboard/v1/plugin_types.go deleted file mode 100644 index cf8994401..000000000 --- a/api/dashboard/v1/plugin_types.go +++ /dev/null @@ -1,210 +0,0 @@ -// 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 ( - "github.com/incubator4/go-resty-expr/expr" -) - -const ( - PluginProxyRewrite string = "proxy-rewrite" - PluginRedirect string = "redirect" - PluginResponseRewrite string = "response-rewrite" - PluginProxyMirror string = "proxy-mirror" -) - -// TrafficSplitConfig is the config of traffic-split plugin. -// +k8s:deepcopy-gen=true -type TrafficSplitConfig struct { - Rules []TrafficSplitConfigRule `json:"rules"` -} - -// TrafficSplitConfigRule is the rule config in traffic-split plugin config. -// +k8s:deepcopy-gen=true -type TrafficSplitConfigRule struct { - WeightedUpstreams []TrafficSplitConfigRuleWeightedUpstream `json:"weighted_upstreams"` -} - -// TrafficSplitConfigRuleWeightedUpstream is the weighted upstream config in -// the traffic split plugin rule. -// +k8s:deepcopy-gen=true -type TrafficSplitConfigRuleWeightedUpstream struct { - UpstreamID string `json:"upstream_id,omitempty"` - Upstream *Upstream `json:"upstream,omitempty"` - Weight int `json:"weight"` -} - -// IPRestrictConfig is the rule config for ip-restriction plugin. -// +k8s:deepcopy-gen=true -type IPRestrictConfig struct { - Allowlist []string `json:"whitelist,omitempty"` - Blocklist []string `json:"blacklist,omitempty"` -} - -// CorsConfig is the rule config for cors plugin. -// +k8s:deepcopy-gen=true -type CorsConfig struct { - AllowOrigins string `json:"allow_origins,omitempty"` - AllowMethods string `json:"allow_methods,omitempty"` - AllowHeaders string `json:"allow_headers,omitempty"` -} - -// CSRfConfig is the rule config for csrf plugin. -// +k8s:deepcopy-gen=true -type CSRFConfig struct { - Key string `json:"key"` -} - -// KeyAuthConsumerConfig is the rule config for key-auth plugin -// used in Consumer object. -// +k8s:deepcopy-gen=true -type KeyAuthConsumerConfig struct { - Key string `json:"key"` -} - -// KeyAuthRouteConfig is the rule config for key-auth plugin -// used in Route object. -type KeyAuthRouteConfig struct { - Header string `json:"header,omitempty"` -} - -// BasicAuthConsumerConfig is the rule config for basic-auth plugin -// used in Consumer object. -// +k8s:deepcopy-gen=true -type BasicAuthConsumerConfig struct { - Username string `json:"username"` - Password string `json:"password"` -} - -// JwtAuthConsumerConfig is the rule config for jwt-auth plugin -// used in Consumer object. -// +k8s:deepcopy-gen=true -type JwtAuthConsumerConfig struct { - Key string `json:"key" yaml:"key"` - Secret string `json:"secret,omitempty" yaml:"secret,omitempty"` - PublicKey string `json:"public_key,omitempty" yaml:"public_key,omitempty"` - PrivateKey string `json:"private_key" yaml:"private_key,omitempty"` - Algorithm string `json:"algorithm,omitempty" yaml:"algorithm,omitempty"` - Exp int64 `json:"exp,omitempty" yaml:"exp,omitempty"` - Base64Secret bool `json:"base64_secret,omitempty" yaml:"base64_secret,omitempty"` - LifetimeGracePeriod int64 `json:"lifetime_grace_period,omitempty" yaml:"lifetime_grace_period,omitempty"` -} - -// HMACAuthConsumerConfig is the rule config for hmac-auth plugin -// used in Consumer object. -// +k8s:deepcopy-gen=true -type HMACAuthConsumerConfig struct { - AccessKey string `json:"access_key" yaml:"access_key"` - SecretKey string `json:"secret_key" yaml:"secret_key"` - Algorithm string `json:"algorithm,omitempty" yaml:"algorithm,omitempty"` - ClockSkew int64 `json:"clock_skew,omitempty" yaml:"clock_skew,omitempty"` - SignedHeaders []string `json:"signed_headers,omitempty" yaml:"signed_headers,omitempty"` - KeepHeaders bool `json:"keep_headers,omitempty" yaml:"keep_headers,omitempty"` - EncodeURIParams bool `json:"encode_uri_params,omitempty" yaml:"encode_uri_params,omitempty"` - ValidateRequestBody bool `json:"validate_request_body,omitempty" yaml:"validate_request_body,omitempty"` - MaxReqBody int64 `json:"max_req_body,omitempty" yaml:"max_req_body,omitempty"` -} - -// LDAPAuthConsumerConfig is the rule config for ldap-auth plugin -// used in Consumer object. -// +k8s:deepcopy-gen=true -type LDAPAuthConsumerConfig struct { - UserDN string `json:"user_dn"` -} - -// BasicAuthRouteConfig is the rule config for basic-auth plugin -// used in Route object. -// +k8s:deepcopy-gen=true -type BasicAuthRouteConfig struct{} - -// WolfRBACConsumerConfig is the rule config for wolf-rbac plugin -// used in Consumer object. -// +k8s:deepcopy-gen=true -type WolfRBACConsumerConfig struct { - Server string `json:"server,omitempty"` - Appid string `json:"appid,omitempty"` - HeaderPrefix string `json:"header_prefix,omitempty"` -} - -// RewriteConfig is the rule config for proxy-rewrite plugin. -// +k8s:deepcopy-gen=true -type RewriteConfig struct { - RewriteTarget string `json:"uri,omitempty"` - RewriteTargetRegex []string `json:"regex_uri,omitempty"` - Headers *Headers `json:"headers,omitempty"` - Host string `json:"host,omitempty"` -} - -// ResponseRewriteConfig is the rule config for response-rewrite plugin. -// +k8s:deepcopy-gen=true -type ResponseRewriteConfig struct { - StatusCode int `json:"status_code,omitempty"` - Body string `json:"body,omitempty"` - BodyBase64 bool `json:"body_base64,omitempty"` - Headers *ResponseHeaders `json:"headers,omitempty"` - LuaRestyExpr []expr.Expr `json:"vars,omitempty"` - Filters []map[string]string `json:"filters,omitempty"` -} - -// RedirectConfig is the rule config for redirect plugin. -// +k8s:deepcopy-gen=true -type RedirectConfig struct { - HttpToHttps bool `json:"http_to_https,omitempty"` - URI string `json:"uri,omitempty"` - RetCode int `json:"ret_code,omitempty"` -} - -// ForwardAuthConfig is the rule config for forward-auth plugin. -// +k8s:deepcopy-gen=true -type ForwardAuthConfig struct { - URI string `json:"uri"` - SSLVerify bool `json:"ssl_verify"` - RequestHeaders []string `json:"request_headers,omitempty"` - UpstreamHeaders []string `json:"upstream_headers,omitempty"` - ClientHeaders []string `json:"client_headers,omitempty"` -} - -// BasicAuthConfig is the rule config for basic-auth plugin. -// +k8s:deepcopy-gen=true -type BasicAuthConfig struct { -} - -// KeyAuthConfig is the rule config for key-auth plugin. -// +k8s:deepcopy-gen=true -type KeyAuthConfig struct { -} - -// RequestMirror is the rule config for proxy-mirror plugin. -// +k8s:deepcopy-gen=true -type RequestMirror struct { - Host string `json:"host"` -} - -// +k8s:deepcopy-gen=true -type Headers struct { - Set map[string]string `json:"set" yaml:"set"` - Add map[string]string `json:"add" yaml:"add"` - Remove []string `json:"remove" yaml:"remove"` -} - -// +k8s:deepcopy-gen=true -type ResponseHeaders struct { - Set map[string]string `json:"set" yaml:"set"` - Add []string `json:"add" yaml:"add"` - Remove []string `json:"remove" yaml:"remove"` -} diff --git a/api/dashboard/v1/types.go b/api/dashboard/v1/types.go deleted file mode 100644 index 8eba42d86..000000000 --- a/api/dashboard/v1/types.go +++ /dev/null @@ -1,950 +0,0 @@ -// 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 ( - "bytes" - "crypto/aes" - "crypto/cipher" - "database/sql/driver" - "encoding/base64" - "encoding/json" - "errors" - "fmt" - "strconv" - "strings" - "time" - - clientv3 "go.etcd.io/etcd/client/v3" -) - -const ( - // HashOnVars means the hash scope is variable. - HashOnVars = "vars" - // HashOnVarsCombination means the hash scope is the - // variable combination. - HashOnVarsCombination = "vars_combinations" - // HashOnHeader means the hash scope is HTTP request - // headers. - HashOnHeader = "header" - // HashOnCookie means the hash scope is HTTP Cookie. - HashOnCookie = "cookie" - // HashOnConsumer means the hash scope is APISIX consumer. - HashOnConsumer = "consumer" - - // LbRoundRobin is the round robin load balancer. - LbRoundRobin = "roundrobin" - // LbConsistentHash is the consistent hash load balancer. - LbConsistentHash = "chash" - // LbEwma is the ewma load balancer. - LbEwma = "ewma" - // LbLeaseConn is the least connection load balancer. - LbLeastConn = "least_conn" - - // SchemeHTTP represents the HTTP protocol. - SchemeHTTP = "http" - // SchemeGRPC represents the GRPC protocol. - SchemeGRPC = "grpc" - // SchemeHTTPS represents the HTTPS protocol. - SchemeHTTPS = "https" - // SchemeGRPCS represents the GRPCS protocol. - SchemeGRPCS = "grpcs" - // SchemeTCP represents the TCP protocol. - SchemeTCP = "tcp" - // SchemeUDP represents the UDP protocol. - SchemeUDP = "udp" - - // HealthCheckHTTP represents the HTTP kind health check. - HealthCheckHTTP = "http" - // HealthCheckHTTPS represents the HTTPS kind health check. - HealthCheckHTTPS = "https" - // HealthCheckTCP represents the TCP kind health check. - HealthCheckTCP = "tcp" - - // HealthCheckMaxConsecutiveNumber is the max number for - // the consecutive success/failure in upstream health check. - HealthCheckMaxConsecutiveNumber = 254 - // ActiveHealthCheckMinInterval is the minimum interval for - // the active health check. - ActiveHealthCheckMinInterval = time.Second - - // DefaultUpstreamTimeout represents the default connect, - // read and send timeout (in seconds) with upstreams. - DefaultUpstreamTimeout = 60 - - // PassHostPass represents pass option for pass_host Upstream settings. - PassHostPass = "pass" - // PassHostPass represents node option for pass_host Upstream settings. - PassHostNode = "node" - // PassHostPass represents rewrite option for pass_host Upstream settings. - PassHostRewrite = "rewrite" -) - -var ValidSchemes map[string]struct{} = map[string]struct{}{ - SchemeHTTP: {}, - SchemeHTTPS: {}, - SchemeGRPC: {}, - SchemeGRPCS: {}, -} - -// Metadata contains all meta information about resources. -// +k8s:deepcopy-gen=true -type Metadata struct { - ID string `json:"id,omitempty" yaml:"id,omitempty"` - Name string `json:"name,omitempty" yaml:"name,omitempty"` - Desc string `json:"desc,omitempty" yaml:"desc,omitempty"` - Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` -} - -func (m *Metadata) GetID() string { - return m.ID -} - -func (m *Metadata) GetName() string { - return m.Name -} - -func (m *Metadata) GetLabels() map[string]string { - return m.Labels -} - -// Upstream is the apisix upstream definition. -// +k8s:deepcopy-gen=true -type Upstream struct { - Metadata `json:",inline" yaml:",inline"` - - Type string `json:"type,omitempty" yaml:"type,omitempty"` - HashOn string `json:"hash_on,omitempty" yaml:"hash_on,omitempty"` - Key string `json:"key,omitempty" yaml:"key,omitempty"` - Checks *UpstreamHealthCheck `json:"checks,omitempty" yaml:"checks,omitempty"` - Nodes UpstreamNodes `json:"nodes" yaml:"nodes"` - Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"` - Retries *int `json:"retries,omitempty" yaml:"retries,omitempty"` - Timeout *UpstreamTimeout `json:"timeout,omitempty" yaml:"timeout,omitempty"` - TLS *ClientTLS `json:"tls,omitempty" yaml:"tls,omitempty"` - PassHost string `json:"pass_host,omitempty" yaml:"pass_host,omitempty"` - UpstreamHost string `json:"upstream_host,omitempty" yaml:"upstream_host,omitempty"` - - // for Service Discovery - ServiceName string `json:"service_name,omitempty" yaml:"service_name,omitempty"` - DiscoveryType string `json:"discovery_type,omitempty" yaml:"discovery_type,omitempty"` - DiscoveryArgs map[string]string `json:"discovery_args,omitempty" yaml:"discovery_args,omitempty"` -} - -type ServiceType string - -const ( - ServiceTypeHTTP ServiceType = "http" - ServiceTypeStream ServiceType = "stream" -) - -// Upstream is the apisix upstream definition. -// +k8s:deepcopy-gen=true -type Service struct { - Metadata `json:",inline" yaml:",inline"` - Type ServiceType `json:"type,omitempty" yaml:"type,omitempty"` - Upstream *Upstream `json:"upstream,omitempty" yaml:"upstream,omitempty"` - Hosts []string `json:"hosts,omitempty" yaml:"hosts,omitempty"` - Plugins Plugins `json:"plugins,omitempty" yaml:"plugins,omitempty"` -} - -// Route apisix route object -// +k8s:deepcopy-gen=true -type Route struct { - Metadata `json:",inline" yaml:",inline"` - Host string `json:"host,omitempty" yaml:"host,omitempty"` - Hosts []string `json:"hosts,omitempty" yaml:"hosts,omitempty"` - Uri string `json:"uri,omitempty" yaml:"uri,omitempty"` - Priority int `json:"priority,omitempty" yaml:"priority,omitempty"` - Timeout *UpstreamTimeout `json:"timeout,omitempty" yaml:"timeout,omitempty"` - Vars Vars `json:"vars,omitempty" yaml:"vars,omitempty"` - Paths []string `json:"paths,omitempty" yaml:"paths,omitempty"` - Methods []string `json:"methods,omitempty" yaml:"methods,omitempty"` - EnableWebsocket bool `json:"enable_websocket,omitempty" yaml:"enable_websocket,omitempty"` - RemoteAddrs []string `json:"remote_addrs,omitempty" yaml:"remote_addrs,omitempty"` - ServiceID string `json:"service_id,omitempty" yaml:"service_id,omitempty"` - Plugins Plugins `json:"plugins,omitempty" yaml:"plugins,omitempty"` - PluginConfigId string `json:"plugin_config_id,omitempty" yaml:"plugin_config_id,omitempty"` - FilterFunc string `json:"filter_func,omitempty" yaml:"filter_func,omitempty"` -} - -// Vars represents the route match expressions of APISIX. -type Vars [][]StringOrSlice - -// UnmarshalJSON implements json.Unmarshaler interface. -// lua-cjson doesn't distinguish empty array and table, -// and by default empty array will be encoded as '{}'. -// We have to maintain the compatibility. -func (vars *Vars) UnmarshalJSON(p []byte) error { - if p[0] == '{' { - if len(p) != 2 { - return errors.New("unexpected non-empty object") - } - return nil - } - var data [][]StringOrSlice - if err := json.Unmarshal(p, &data); err != nil { - return err - } - *vars = data - return nil -} - -// StringOrSlice represents a string or a string slice. -// TODO Do not use interface{} to avoid the reflection overheads. -// +k8s:deepcopy-gen=true -type StringOrSlice struct { - StrVal string `json:"-"` - SliceVal []string `json:"-"` -} - -func (s *StringOrSlice) MarshalJSON() ([]byte, error) { - var ( - p []byte - err error - ) - if s.SliceVal != nil { - p, err = json.Marshal(s.SliceVal) - } else { - p, err = json.Marshal(s.StrVal) - } - return p, err -} - -func (s *StringOrSlice) UnmarshalJSON(p []byte) error { - var err error - - if len(p) == 0 { - return errors.New("empty object") - } - if p[0] == '[' { - err = json.Unmarshal(p, &s.SliceVal) - } else { - err = json.Unmarshal(p, &s.StrVal) - } - return err -} - -type Plugins map[string]any - -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 := make(Plugins) - p.DeepCopyInto(&out) - return out -} - -// ClientTLS is tls cert and key use in mTLS -type ClientTLS struct { - Cert string `json:"client_cert,omitempty" yaml:"client_cert,omitempty"` - Key string `json:"client_key,omitempty" yaml:"client_key,omitempty"` -} - -// UpstreamTimeout represents the timeout settings on Upstream. -type UpstreamTimeout struct { - // Connect is the connect timeout - Connect int `json:"connect" yaml:"connect"` - // Send is the send timeout - Send int `json:"send" yaml:"send"` - // Read is the read timeout - Read int `json:"read" yaml:"read"` -} - -// UpstreamNodes is the upstream node list. -type UpstreamNodes []UpstreamNode - -// UnmarshalJSON implements json.Unmarshaler interface. -// lua-cjson doesn't distinguish empty array and table, -// and by default empty array will be encoded as '{}'. -// We have to maintain the compatibility. -func (n *UpstreamNodes) UnmarshalJSON(p []byte) error { - var data []UpstreamNode - if p[0] == '{' { - value := map[string]float64{} - if err := json.Unmarshal(p, &value); err != nil { - return err - } - for k, v := range value { - node, err := mapKV2Node(k, v) - if err != nil { - return err - } - data = append(data, *node) - } - *n = data - return nil - } - if err := json.Unmarshal(p, &data); err != nil { - return err - } - *n = data - return nil -} - -// MarshalJSON is used to implement custom json.MarshalJSON -func (up Upstream) MarshalJSON() ([]byte, error) { - - if up.DiscoveryType != "" { - return json.Marshal(&struct { - Metadata `json:",inline" yaml:",inline"` - - Type string `json:"type,omitempty" yaml:"type,omitempty"` - HashOn string `json:"hash_on,omitempty" yaml:"hash_on,omitempty"` - Key string `json:"key,omitempty" yaml:"key,omitempty"` - Checks *UpstreamHealthCheck `json:"checks,omitempty" yaml:"checks,omitempty"` - // Nodes UpstreamNodes `json:"nodes" yaml:"nodes"` - Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"` - Retries *int `json:"retries,omitempty" yaml:"retries,omitempty"` - Timeout *UpstreamTimeout `json:"timeout,omitempty" yaml:"timeout,omitempty"` - HostPass string `json:"pass_host,omitempty" yaml:"pass_host,omitempty"` - UpstreamHost string `json:"upstream_host,omitempty" yaml:"upstream_host,omitempty"` - TLS *ClientTLS `json:"tls,omitempty" yaml:"tls,omitempty"` - - // for Service Discovery - ServiceName string `json:"service_name,omitempty" yaml:"service_name,omitempty"` - DiscoveryType string `json:"discovery_type,omitempty" yaml:"discovery_type,omitempty"` - DiscoveryArgs map[string]string `json:"discovery_args,omitempty" yaml:"discovery_args,omitempty"` - }{ - Metadata: up.Metadata, - - Type: up.Type, - HashOn: up.HashOn, - Key: up.Key, - Checks: up.Checks, - // Nodes: up.Nodes, - Scheme: up.Scheme, - Retries: up.Retries, - Timeout: up.Timeout, - HostPass: up.PassHost, - UpstreamHost: up.UpstreamHost, - TLS: up.TLS, - - ServiceName: up.ServiceName, - DiscoveryType: up.DiscoveryType, - DiscoveryArgs: up.DiscoveryArgs, - }) - } else { - return json.Marshal(&struct { - Metadata `json:",inline" yaml:",inline"` - - Type string `json:"type,omitempty" yaml:"type,omitempty"` - HashOn string `json:"hash_on,omitempty" yaml:"hash_on,omitempty"` - Key string `json:"key,omitempty" yaml:"key,omitempty"` - Checks *UpstreamHealthCheck `json:"checks,omitempty" yaml:"checks,omitempty"` - Nodes UpstreamNodes `json:"nodes" yaml:"nodes"` - Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"` - Retries *int `json:"retries,omitempty" yaml:"retries,omitempty"` - Timeout *UpstreamTimeout `json:"timeout,omitempty" yaml:"timeout,omitempty"` - HostPass string `json:"pass_host,omitempty" yaml:"pass_host,omitempty"` - UpstreamHost string `json:"upstream_host,omitempty" yaml:"upstream_host,omitempty"` - TLS *ClientTLS `json:"tls,omitempty" yaml:"tls,omitempty"` - - // for Service Discovery - // ServiceName string `json:"service_name,omitempty" yaml:"service_name,omitempty"` - // DiscoveryType string `json:"discovery_type,omitempty" yaml:"discovery_type,omitempty"` - // DiscoveryArgs map[string]string `json:"discovery_args,omitempty" yaml:"discovery_args,omitempty"` - }{ - Metadata: up.Metadata, - - Type: up.Type, - HashOn: up.HashOn, - Key: up.Key, - Checks: up.Checks, - Nodes: up.Nodes, - Scheme: up.Scheme, - Retries: up.Retries, - Timeout: up.Timeout, - HostPass: up.PassHost, - UpstreamHost: up.UpstreamHost, - TLS: up.TLS, - - // ServiceName: up.ServiceName, - // DiscoveryType: up.DiscoveryType, - // DiscoveryArgs: up.DiscoveryArgs, - }) - } - -} - -func mapKV2Node(key string, val float64) (*UpstreamNode, error) { - hp := strings.Split(key, ":") - host := hp[0] - // according to APISIX upstream nodes policy, port is required - port := "80" - - if len(hp) > 2 { - return nil, errors.New("invalid upstream node") - } else if len(hp) == 2 { - port = hp[1] - } - - portInt, err := strconv.Atoi(port) - if err != nil { - return nil, fmt.Errorf("parse port to int fail: %s", err.Error()) - } - - node := &UpstreamNode{ - Host: host, - Port: portInt, - Weight: int(val), - } - - return node, nil -} - -// UpstreamNode is the node in upstream -// +k8s:deepcopy-gen=true -type UpstreamNode struct { - Host string `json:"host,omitempty" yaml:"host,omitempty"` - Port int `json:"port,omitempty" yaml:"port,omitempty"` - Weight int `json:"weight,omitempty" yaml:"weight,omitempty"` -} - -// UpstreamHealthCheck defines the active and/or passive health check for an Upstream, -// with the upstream health check feature, pods can be kicked out or joined in quickly, -// if the feedback of Kubernetes liveness/readiness probe is long. -// +k8s:deepcopy-gen=true -type UpstreamHealthCheck struct { - Active *UpstreamActiveHealthCheck `json:"active" yaml:"active"` - Passive *UpstreamPassiveHealthCheck `json:"passive,omitempty" yaml:"passive,omitempty"` -} - -// UpstreamActiveHealthCheck defines the active upstream health check. -// +k8s:deepcopy-gen=true -type UpstreamActiveHealthCheck struct { - Type string `json:"type,omitempty" yaml:"type,omitempty"` - Timeout int `json:"timeout,omitempty" yaml:"timeout,omitempty"` - Concurrency int `json:"concurrency,omitempty" yaml:"concurrency,omitempty"` - Host string `json:"host,omitempty" yaml:"host,omitempty"` - Port int32 `json:"port,omitempty" yaml:"port,omitempty"` - HTTPPath string `json:"http_path,omitempty" yaml:"http_path,omitempty"` - HTTPSVerifyCert bool `json:"https_verify_certificate,omitempty" yaml:"https_verify_certificate,omitempty"` - HTTPRequestHeaders []string `json:"req_headers,omitempty" yaml:"req_headers,omitempty"` - Healthy UpstreamActiveHealthCheckHealthy `json:"healthy,omitempty" yaml:"healthy,omitempty"` - Unhealthy UpstreamActiveHealthCheckUnhealthy `json:"unhealthy,omitempty" yaml:"unhealthy,omitempty"` -} - -// UpstreamPassiveHealthCheck defines the passive upstream health check. -// +k8s:deepcopy-gen=true -type UpstreamPassiveHealthCheck struct { - Type string `json:"type,omitempty" yaml:"type,omitempty"` - Healthy UpstreamPassiveHealthCheckHealthy `json:"healthy,omitempty" yaml:"healthy,omitempty"` - Unhealthy UpstreamPassiveHealthCheckUnhealthy `json:"unhealthy,omitempty" yaml:"unhealthy,omitempty"` -} - -// UpstreamActiveHealthCheckHealthy defines the conditions used to actively determine whether an upstream node is healthy. -// +k8s:deepcopy-gen=true -type UpstreamActiveHealthCheckHealthy struct { - UpstreamPassiveHealthCheckHealthy `json:",inline" yaml:",inline"` - - // Interval defines the time interval for checking targets, in seconds. - Interval int `json:"interval,omitempty" yaml:"interval,omitempty"` -} - -// UpstreamPassiveHealthCheckHealthy defines the conditions used to passively determine whether an upstream node is unhealthy. -// +k8s:deepcopy-gen=true -type UpstreamPassiveHealthCheckHealthy struct { - HTTPStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"` - Successes int `json:"successes,omitempty" yaml:"successes,omitempty"` -} - -// UpstreamActiveHealthCheckUnhealthy defines the conditions used to actively determine whether an upstream node is unhealthy. -// +k8s:deepcopy-gen=true -type UpstreamActiveHealthCheckUnhealthy struct { - UpstreamPassiveHealthCheckUnhealthy `json:",inline" yaml:",inline"` - - // Interval defines the time interval for checking targets, in seconds. - Interval int `json:"interval,omitempty" yaml:"interval,omitempty"` -} - -// UpstreamPassiveHealthCheckUnhealthy defines the conditions used to passively determine whether an upstream node is unhealthy. -// +k8s:deepcopy-gen=true -type UpstreamPassiveHealthCheckUnhealthy struct { - HTTPStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"` - HTTPFailures int `json:"http_failures,omitempty" yaml:"http_failures,omitempty"` - TCPFailures int `json:"tcp_failures,omitempty" yaml:"tcp_failures,omitempty"` - Timeouts int `json:"timeouts,omitempty" yaml:"timeouts,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"` - Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` - Client *MutualTLSClientConfig `json:"client,omitempty" yaml:"client,omitempty"` -} - -// MutualTLSClientConfig apisix SSL client field -// +k8s:deepcopy-gen=true -type MutualTLSClientConfig struct { - CA string `json:"ca,omitempty" yaml:"ca,omitempty"` - Depth int `json:"depth,omitempty" yaml:"depth,omitempty"` - SkipMTLSUriRegex []string `json:"skip_mtls_uri_regex,omitempty" yaml:"skip_mtls_uri_regex, omitempty"` -} - -// StreamRoute represents the stream_route object in APISIX. -// +k8s:deepcopy-gen=true -type StreamRoute struct { - // TODO metadata should use Metadata type - ID string `json:"id,omitempty" yaml:"id,omitempty"` - Name string `json:"name,omitempty" yaml:"name,omitempty"` - Desc string `json:"desc,omitempty" yaml:"desc,omitempty"` - Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` - ServerPort int32 `json:"server_port,omitempty" yaml:"server_port,omitempty"` - SNI string `json:"sni,omitempty" yaml:"sni,omitempty"` - ServiceID string `json:"service_id,omitempty" yaml:"service_id,omitempty"` - Plugins Plugins `json:"plugins,omitempty" yaml:"plugins,omitempty"` -} - -// GlobalRule represents the global_rule object in APISIX. -// +k8s:deepcopy-gen=true -type GlobalRule struct { - ID string `json:"id" yaml:"id"` - Plugins Plugins `json:"plugins" yaml:"plugins"` -} - -// Consumer represents the consumer object in APISIX. -// +k8s:deepcopy-gen=true -type Consumer struct { - Username string `json:"username" yaml:"username"` - Desc string `json:"desc,omitempty" yaml:"desc,omitempty"` - Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` - Plugins Plugins `json:"plugins,omitempty" yaml:"plugins,omitempty"` -} - -// PluginConfig apisix plugin object -// +k8s:deepcopy-gen=true -type PluginConfig struct { - Metadata `json:",inline" yaml:",inline"` - Plugins Plugins `json:"plugins" yaml:"plugins"` -} - -type PluginMetadata struct { - Name string - Metadata map[string]any -} - -// NewDefaultUpstream returns an empty Upstream with default values. -func NewDefaultService() *Service { - return &Service{ - Metadata: Metadata{ - Labels: map[string]string{ - "managed-by": "api7-ingress-controller", - }, - }, - Plugins: make(Plugins), - } -} - -// NewDefaultRoute returns an empty Route with default values. -func NewDefaultRoute() *Route { - return &Route{ - Metadata: Metadata{ - Desc: "Created by api7-ingress-controller, DO NOT modify it manually", - Labels: map[string]string{ - "managed-by": "api7-ingress-controller", - }, - }, - } -} - -func NewDefaultUpstream() *Upstream { - return &Upstream{ - Type: LbRoundRobin, - Key: "", - Nodes: make(UpstreamNodes, 0), - Scheme: SchemeHTTP, - Metadata: Metadata{ - Desc: "Created by apisix-ingress-controller, DO NOT modify it manually", - Labels: map[string]string{ - "managed-by": "apisix-ingress-controller", - }, - }, - } -} - -// NewDefaultStreamRoute returns an empty StreamRoute with default values. -func NewDefaultStreamRoute() *StreamRoute { - return &StreamRoute{ - Desc: "Created by api7-ingress-controller, DO NOT modify it manually", - Labels: map[string]string{ - "managed-by": "api7-ingress-controller", - }, - } -} - -// NewDefaultConsumer returns an empty Consumer with default values. -func NewDefaultConsumer() *Consumer { - return &Consumer{ - Desc: "Created by api7-ingress-controller, DO NOT modify it manually", - Labels: map[string]string{ - "managed-by": "api7-ingress-controller", - }, - } -} - -// NewDefaultPluginConfig returns an empty PluginConfig with default values. -func NewDefaultPluginConfig() *PluginConfig { - return &PluginConfig{ - Metadata: Metadata{ - Desc: "Created by api7-ingress-controller, DO NOT modify it manually", - Labels: map[string]string{ - "managed-by": "api7-ingress-controller", - }, - }, - Plugins: make(Plugins), - } -} - -// NewDefaultGlobalRule returns an empty PluginConfig with default values. -func NewDefaultGlobalRule() *GlobalRule { - return &GlobalRule{ - Plugins: make(Plugins), - } -} - -// ComposeUpstreamName uses namespace, name, subset (optional), port, resolveGranularity info to compose -// the upstream name. -// the resolveGranularity is not composited in the upstream name when it is endpoint. -func ComposeUpstreamName(namespace, name string, port int32) string { - pstr := strconv.Itoa(int(port)) - // FIXME Use sync.Pool to reuse this buffer if the upstream - // name composing code path is hot. - var p []byte - plen := len(namespace) + len(name) + len(pstr) + 2 - - p = make([]byte, 0, plen) - buf := bytes.NewBuffer(p) - buf.WriteString(namespace) - buf.WriteByte('_') - buf.WriteString(name) - buf.WriteByte('_') - buf.WriteString(pstr) - - return buf.String() -} - -func ComposeServiceNameWithRule(namespace, name string, rule string) string { - // FIXME Use sync.Pool to reuse this buffer if the upstream - // name composing code path is hot. - var p []byte - plen := len(namespace) + len(name) + 2 - - p = make([]byte, 0, plen) - buf := bytes.NewBuffer(p) - buf.WriteString(namespace) - buf.WriteByte('_') - buf.WriteString(name) - buf.WriteByte('_') - buf.WriteString(rule) - - return buf.String() -} - -func ComposeUpstreamNameWithRule(namespace, name string, rule string) string { - // FIXME Use sync.Pool to reuse this buffer if the upstream - // name composing code path is hot. - var p []byte - plen := len(namespace) + len(name) + 2 - - p = make([]byte, 0, plen) - buf := bytes.NewBuffer(p) - buf.WriteString(namespace) - buf.WriteByte('_') - buf.WriteString(name) - buf.WriteByte('_') - buf.WriteString(rule) - - return buf.String() -} - -// ComposeExternalUpstreamName uses ApisixUpstream namespace, name to compose the upstream name. -func ComposeExternalUpstreamName(namespace, name string) string { - return namespace + "_" + name -} - -// ComposeRouteName uses namespace, name and rule name to compose -// the route name. -func ComposeRouteName(namespace, name string, rule string) string { - // FIXME Use sync.Pool to reuse this buffer if the upstream - // name composing code path is hot. - p := make([]byte, 0, len(namespace)+len(name)+len(rule)+2) - buf := bytes.NewBuffer(p) - - buf.WriteString(namespace) - buf.WriteByte('_') - buf.WriteString(name) - buf.WriteByte('_') - buf.WriteString(rule) - - return buf.String() -} - -// ComposeStreamRouteName uses namespace, name and rule name to compose -// the stream_route name. -func ComposeStreamRouteName(namespace, name string, rule string) string { - // FIXME Use sync.Pool to reuse this buffer if the upstream - // name composing code path is hot. - p := make([]byte, 0, len(namespace)+len(name)+len(rule)+6) - buf := bytes.NewBuffer(p) - - buf.WriteString(namespace) - buf.WriteByte('_') - buf.WriteString(name) - buf.WriteByte('_') - buf.WriteString(rule) - buf.WriteString("_tcp") - - return buf.String() -} - -// ComposeConsumerName uses namespace and name of ApisixConsumer to compose -// the Consumer name. -func ComposeConsumerName(namespace, name string) string { - p := make([]byte, 0, len(namespace)+len(name)+1) - buf := bytes.NewBuffer(p) - - // TODO If APISIX modifies the consumer name schema, we can drop this. - buf.WriteString(strings.ReplaceAll(namespace, "-", "_")) - buf.WriteString("_") - buf.WriteString(strings.ReplaceAll(name, "-", "_")) - - return buf.String() -} - -// ComposePluginConfigName uses namespace, name to compose -// the plugin_config name. -func ComposePluginConfigName(namespace, name string) string { - // FIXME Use sync.Pool to reuse this buffer if the upstream - // name composing code path is hot. - p := make([]byte, 0, len(namespace)+len(name)+1) - buf := bytes.NewBuffer(p) - - buf.WriteString(namespace) - buf.WriteByte('_') - buf.WriteString(name) - - return buf.String() -} - -// ComposeGlobalRuleName uses namespace, name to compose -// the global_rule name. -func ComposeGlobalRuleName(namespace, name string) string { - // FIXME Use sync.Pool to reuse this buffer if the upstream - // name composing code path is hot. - p := make([]byte, 0, len(namespace)+len(name)+1) - buf := bytes.NewBuffer(p) - - buf.WriteString(namespace) - buf.WriteByte('_') - buf.WriteString(name) - - return buf.String() -} - -// Schema represents the schema of APISIX objects. -type Schema struct { - Name string `json:"name,omitempty" yaml:"name,omitempty"` - Content string `json:"content,omitempty" yaml:"content,omitempty"` -} - -func (s *Schema) DeepCopyInto(out *Schema) { - b, _ := json.Marshal(&s) - _ = json.Unmarshal(b, out) -} - -func (s *Schema) DeepCopy() *Schema { - if s == nil { - return nil - } - out := new(Schema) - s.DeepCopyInto(out) - return out -} - -type GatewayGroup struct { - ID string `json:"id" gorm:"column:id; primaryKey; size:255;"` - ShortID string `json:"short_id" gorm:"column:short_id; size:255; uniqueIndex:UQE_gateway_group_short_id;"` - Name string `json:"name" gorm:"name; size:255;"` - OrgID string `json:"-" gorm:"org_id; size:255; index:gateway_group_org_id;"` - Type string `json:"type" gorm:"column:type; size:255; default:api7_gateway;"` - Description string `json:"description" gorm:"description; type:text;"` - Labels map[string]string `json:"labels,omitempty" gorm:"serializer:json; column:labels; type:text;"` - Config GatewayGroupBasicConfig `json:"config" gorm:"serializer:json; column:config; type:text;"` - RunningConfigID string `json:"-" gorm:"column:running_config_id; size:255;"` - ConfigVersion int64 `json:"-" gorm:"column:config_version;"` - AdminKeySalt string `json:"-" gorm:"column:admin_key_salt; size:255;"` - EncryptedAdminKey string `json:"-" gorm:"column:encrypted_admin_key; size:255;"` - EnforceServicePublishing bool `json:"enforce_service_publishing" gorm:"column:enforce_service_publishing; default:false;"` -} - -func (g *GatewayGroup) GetKeyPrefix() string { - return fmt.Sprintf("/gateway_groups/%s", g.ShortID) -} - -func (g *GatewayGroup) GetKeyPrefixEnd() string { - return clientv3.GetPrefixRangeEnd(g.GetKeyPrefix()) -} - -type GatewayGroupBasicConfig struct { - ImageTag string `json:"image_tag,omitempty"` -} - -func (GatewayGroup) TableName() string { - return "gateway_group" -} - -type GatewayGroupAdminKey struct { - Key string `json:"key" mask:"fixed"` -} - -type CertificateType string - -const ( - CertificateTypeEndpoint CertificateType = "Endpoint" - CertificateTypeIntermediate CertificateType = "Intermediate" - CertificateTypeRoot CertificateType = "Root" -) - -type AesEncrypt string - -var AESKeyring = "b2zanhtrq35f6j3m" - -func PKCS7Unpadding(plantText []byte) []byte { - length := len(plantText) - if length == 0 { - return plantText - } - padding := int(plantText[length-1]) - return plantText[:(length - padding)] -} - -func FAesDecrypt(encrypted string, keyring string) (string, error) { - if len(encrypted) == 0 { - return "", nil - } - ciphertext, err := base64.StdEncoding.DecodeString(encrypted) - if err != nil { - return "", err - } - - block, err := aes.NewCipher([]byte(keyring)) - if err != nil { - return "", err - } - if len(ciphertext)%aes.BlockSize != 0 { - return "", errors.New("block size cant be zero") - } - iv := []byte(keyring)[:aes.BlockSize] - mode := cipher.NewCBCDecrypter(block, iv) - mode.CryptBlocks(ciphertext, ciphertext) - - return string(PKCS7Unpadding(ciphertext)), nil -} - -func (aesEncrypt AesEncrypt) Value() (driver.Value, error) { - return FAesDecrypt(string(aesEncrypt), AESKeyring) -} - -func (aesEncrypt *AesEncrypt) Scan(value any) error { - var str string - switch v := value.(type) { - case string: // for postgres - str = v - case []uint8: // for mysql - str = string(v) - default: - return fmt.Errorf("invalid type scan from database driver: %T", value) - } - res, err := FAesDecrypt(str, AESKeyring) - if err == nil { - *aesEncrypt = AesEncrypt(res) - } - return err -} - -type BaseCertificate struct { - ID string `json:"id" gorm:"primaryKey; column:id; size:255;"` - Certificate string `json:"certificate" gorm:"column:certificate; type:text;"` - PrivateKey AesEncrypt `json:"private_key" gorm:"column:private_key; type:text;" mask:"fixed"` - Expiry Time `json:"expiry" gorm:"column:expiry"` - CreatedAt Time `json:"-" gorm:"column:created_at;autoCreateTime; <-:create;"` - UpdatedAt Time `json:"-" gorm:"column:updated_at;autoUpdateTime"` - Type CertificateType `json:"-" gorm:"column:type;"` -} - -type DataplaneCertificate struct { - *BaseCertificate - - GatewayGroupID string `json:"gateway_group_id" gorm:"column:gateway_group_id;size:255;"` - CACertificate string `json:"ca_certificate" gorm:"column:ca_certificate;type:text;"` -} - -func (DataplaneCertificate) TableName() string { - return "dataplane_certificate" -} - -type Time time.Time - -func (t *Time) UnmarshalJSON(data []byte) error { - ts, err := strconv.ParseInt(string(data), 10, 64) - if err != nil { - return err - } - - *t = Time(time.Unix(ts, 0)) - return nil -} - -func (t Time) MarshalJSON() ([]byte, error) { - ts := (time.Time)(t).Unix() - return []byte(strconv.FormatInt(ts, 10)), nil -} - -func (t Time) String() string { - return strconv.FormatInt(time.Time(t).Unix(), 10) -} - -func (t *Time) Unix() int64 { - return time.Time(*t).Unix() -} - -func (t *Time) Scan(src any) error { - switch s := src.(type) { - case time.Time: - *t = Time(s) - default: - return fmt.Errorf("invalid time type from database driver: %T", src) - } - return nil -} - -func (t Time) Value() (driver.Value, error) { - return time.Time(t), nil -} diff --git a/api/dashboard/v1/zz_generated.deepcopy.go b/api/dashboard/v1/zz_generated.deepcopy.go deleted file mode 100644 index 241088840..000000000 --- a/api/dashboard/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,929 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024. - -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 controller-gen. DO NOT EDIT. - -package v1 - -import ( - "github.com/incubator4/go-resty-expr/expr" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BasicAuthConfig) DeepCopyInto(out *BasicAuthConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicAuthConfig. -func (in *BasicAuthConfig) DeepCopy() *BasicAuthConfig { - if in == nil { - return nil - } - out := new(BasicAuthConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BasicAuthConsumerConfig) DeepCopyInto(out *BasicAuthConsumerConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicAuthConsumerConfig. -func (in *BasicAuthConsumerConfig) DeepCopy() *BasicAuthConsumerConfig { - if in == nil { - return nil - } - out := new(BasicAuthConsumerConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BasicAuthRouteConfig) DeepCopyInto(out *BasicAuthRouteConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicAuthRouteConfig. -func (in *BasicAuthRouteConfig) DeepCopy() *BasicAuthRouteConfig { - if in == nil { - return nil - } - out := new(BasicAuthRouteConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CSRFConfig) DeepCopyInto(out *CSRFConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CSRFConfig. -func (in *CSRFConfig) DeepCopy() *CSRFConfig { - if in == nil { - return nil - } - out := new(CSRFConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Consumer) DeepCopyInto(out *Consumer) { - *out = *in - if in.Labels != nil { - in, out := &in.Labels, &out.Labels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - out.Plugins = in.Plugins.DeepCopy() -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Consumer. -func (in *Consumer) DeepCopy() *Consumer { - if in == nil { - return nil - } - out := new(Consumer) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CorsConfig) DeepCopyInto(out *CorsConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CorsConfig. -func (in *CorsConfig) DeepCopy() *CorsConfig { - if in == nil { - return nil - } - out := new(CorsConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ForwardAuthConfig) DeepCopyInto(out *ForwardAuthConfig) { - *out = *in - if in.RequestHeaders != nil { - in, out := &in.RequestHeaders, &out.RequestHeaders - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.UpstreamHeaders != nil { - in, out := &in.UpstreamHeaders, &out.UpstreamHeaders - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.ClientHeaders != nil { - in, out := &in.ClientHeaders, &out.ClientHeaders - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ForwardAuthConfig. -func (in *ForwardAuthConfig) DeepCopy() *ForwardAuthConfig { - if in == nil { - return nil - } - out := new(ForwardAuthConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GlobalRule) DeepCopyInto(out *GlobalRule) { - *out = *in - out.Plugins = in.Plugins.DeepCopy() -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalRule. -func (in *GlobalRule) DeepCopy() *GlobalRule { - if in == nil { - return nil - } - out := new(GlobalRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMACAuthConsumerConfig) DeepCopyInto(out *HMACAuthConsumerConfig) { - *out = *in - if in.SignedHeaders != nil { - in, out := &in.SignedHeaders, &out.SignedHeaders - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMACAuthConsumerConfig. -func (in *HMACAuthConsumerConfig) DeepCopy() *HMACAuthConsumerConfig { - if in == nil { - return nil - } - out := new(HMACAuthConsumerConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Headers) DeepCopyInto(out *Headers) { - *out = *in - if in.Set != nil { - in, out := &in.Set, &out.Set - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Add != nil { - in, out := &in.Add, &out.Add - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Remove != nil { - in, out := &in.Remove, &out.Remove - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Headers. -func (in *Headers) DeepCopy() *Headers { - if in == nil { - return nil - } - out := new(Headers) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPRestrictConfig) DeepCopyInto(out *IPRestrictConfig) { - *out = *in - if in.Allowlist != nil { - in, out := &in.Allowlist, &out.Allowlist - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Blocklist != nil { - in, out := &in.Blocklist, &out.Blocklist - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPRestrictConfig. -func (in *IPRestrictConfig) DeepCopy() *IPRestrictConfig { - if in == nil { - return nil - } - out := new(IPRestrictConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *JwtAuthConsumerConfig) DeepCopyInto(out *JwtAuthConsumerConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JwtAuthConsumerConfig. -func (in *JwtAuthConsumerConfig) DeepCopy() *JwtAuthConsumerConfig { - if in == nil { - return nil - } - out := new(JwtAuthConsumerConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KeyAuthConfig) DeepCopyInto(out *KeyAuthConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyAuthConfig. -func (in *KeyAuthConfig) DeepCopy() *KeyAuthConfig { - if in == nil { - return nil - } - out := new(KeyAuthConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KeyAuthConsumerConfig) DeepCopyInto(out *KeyAuthConsumerConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyAuthConsumerConfig. -func (in *KeyAuthConsumerConfig) DeepCopy() *KeyAuthConsumerConfig { - if in == nil { - return nil - } - out := new(KeyAuthConsumerConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LDAPAuthConsumerConfig) DeepCopyInto(out *LDAPAuthConsumerConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LDAPAuthConsumerConfig. -func (in *LDAPAuthConsumerConfig) DeepCopy() *LDAPAuthConsumerConfig { - if in == nil { - return nil - } - out := new(LDAPAuthConsumerConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Metadata) DeepCopyInto(out *Metadata) { - *out = *in - if in.Labels != nil { - in, out := &in.Labels, &out.Labels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metadata. -func (in *Metadata) DeepCopy() *Metadata { - if in == nil { - return nil - } - out := new(Metadata) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MutualTLSClientConfig) DeepCopyInto(out *MutualTLSClientConfig) { - *out = *in - if in.SkipMTLSUriRegex != nil { - in, out := &in.SkipMTLSUriRegex, &out.SkipMTLSUriRegex - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutualTLSClientConfig. -func (in *MutualTLSClientConfig) DeepCopy() *MutualTLSClientConfig { - if in == nil { - return nil - } - out := new(MutualTLSClientConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PluginConfig) DeepCopyInto(out *PluginConfig) { - *out = *in - in.Metadata.DeepCopyInto(&out.Metadata) - out.Plugins = in.Plugins.DeepCopy() -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PluginConfig. -func (in *PluginConfig) DeepCopy() *PluginConfig { - if in == nil { - return nil - } - out := new(PluginConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedirectConfig) DeepCopyInto(out *RedirectConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedirectConfig. -func (in *RedirectConfig) DeepCopy() *RedirectConfig { - if in == nil { - return nil - } - out := new(RedirectConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RequestMirror) DeepCopyInto(out *RequestMirror) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequestMirror. -func (in *RequestMirror) DeepCopy() *RequestMirror { - if in == nil { - return nil - } - out := new(RequestMirror) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResponseHeaders) DeepCopyInto(out *ResponseHeaders) { - *out = *in - if in.Set != nil { - in, out := &in.Set, &out.Set - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Add != nil { - in, out := &in.Add, &out.Add - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Remove != nil { - in, out := &in.Remove, &out.Remove - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResponseHeaders. -func (in *ResponseHeaders) DeepCopy() *ResponseHeaders { - if in == nil { - return nil - } - out := new(ResponseHeaders) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResponseRewriteConfig) DeepCopyInto(out *ResponseRewriteConfig) { - *out = *in - if in.Headers != nil { - in, out := &in.Headers, &out.Headers - *out = new(ResponseHeaders) - (*in).DeepCopyInto(*out) - } - if in.LuaRestyExpr != nil { - in, out := &in.LuaRestyExpr, &out.LuaRestyExpr - *out = make([]expr.Expr, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Filters != nil { - in, out := &in.Filters, &out.Filters - *out = make([]map[string]string, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResponseRewriteConfig. -func (in *ResponseRewriteConfig) DeepCopy() *ResponseRewriteConfig { - if in == nil { - return nil - } - out := new(ResponseRewriteConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RewriteConfig) DeepCopyInto(out *RewriteConfig) { - *out = *in - if in.RewriteTargetRegex != nil { - in, out := &in.RewriteTargetRegex, &out.RewriteTargetRegex - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Headers != nil { - in, out := &in.Headers, &out.Headers - *out = new(Headers) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RewriteConfig. -func (in *RewriteConfig) DeepCopy() *RewriteConfig { - if in == nil { - return nil - } - out := new(RewriteConfig) - 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 - in.Metadata.DeepCopyInto(&out.Metadata) - if in.Hosts != nil { - in, out := &in.Hosts, &out.Hosts - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Timeout != nil { - in, out := &in.Timeout, &out.Timeout - *out = new(UpstreamTimeout) - **out = **in - } - if in.Vars != nil { - in, out := &in.Vars, &out.Vars - *out = make(Vars, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = make([]StringOrSlice, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - } - if in.Paths != nil { - in, out := &in.Paths, &out.Paths - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Methods != nil { - in, out := &in.Methods, &out.Methods - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.RemoteAddrs != nil { - in, out := &in.RemoteAddrs, &out.RemoteAddrs - *out = make([]string, len(*in)) - copy(*out, *in) - } - out.Plugins = in.Plugins.DeepCopy() -} - -// 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 - in.Metadata.DeepCopyInto(&out.Metadata) - if in.Upstream != nil { - in, out := &in.Upstream, &out.Upstream - *out = new(Upstream) - (*in).DeepCopyInto(*out) - } - if in.Hosts != nil { - in, out := &in.Hosts, &out.Hosts - *out = make([]string, len(*in)) - copy(*out, *in) - } - out.Plugins = in.Plugins.DeepCopy() -} - -// 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.Snis != nil { - in, out := &in.Snis, &out.Snis - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Labels != nil { - in, out := &in.Labels, &out.Labels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Client != nil { - in, out := &in.Client, &out.Client - *out = new(MutualTLSClientConfig) - (*in).DeepCopyInto(*out) - } -} - -// 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 *StreamRoute) DeepCopyInto(out *StreamRoute) { - *out = *in - if in.Labels != nil { - in, out := &in.Labels, &out.Labels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - out.Plugins = in.Plugins.DeepCopy() -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StreamRoute. -func (in *StreamRoute) DeepCopy() *StreamRoute { - if in == nil { - return nil - } - out := new(StreamRoute) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *StringOrSlice) DeepCopyInto(out *StringOrSlice) { - *out = *in - if in.SliceVal != nil { - in, out := &in.SliceVal, &out.SliceVal - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StringOrSlice. -func (in *StringOrSlice) DeepCopy() *StringOrSlice { - if in == nil { - return nil - } - out := new(StringOrSlice) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TrafficSplitConfig) DeepCopyInto(out *TrafficSplitConfig) { - *out = *in - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]TrafficSplitConfigRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficSplitConfig. -func (in *TrafficSplitConfig) DeepCopy() *TrafficSplitConfig { - if in == nil { - return nil - } - out := new(TrafficSplitConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TrafficSplitConfigRule) DeepCopyInto(out *TrafficSplitConfigRule) { - *out = *in - if in.WeightedUpstreams != nil { - in, out := &in.WeightedUpstreams, &out.WeightedUpstreams - *out = make([]TrafficSplitConfigRuleWeightedUpstream, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficSplitConfigRule. -func (in *TrafficSplitConfigRule) DeepCopy() *TrafficSplitConfigRule { - if in == nil { - return nil - } - out := new(TrafficSplitConfigRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TrafficSplitConfigRuleWeightedUpstream) DeepCopyInto(out *TrafficSplitConfigRuleWeightedUpstream) { - *out = *in - if in.Upstream != nil { - in, out := &in.Upstream, &out.Upstream - *out = new(Upstream) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficSplitConfigRuleWeightedUpstream. -func (in *TrafficSplitConfigRuleWeightedUpstream) DeepCopy() *TrafficSplitConfigRuleWeightedUpstream { - if in == nil { - return nil - } - out := new(TrafficSplitConfigRuleWeightedUpstream) - 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 - in.Metadata.DeepCopyInto(&out.Metadata) - if in.Checks != nil { - in, out := &in.Checks, &out.Checks - *out = new(UpstreamHealthCheck) - (*in).DeepCopyInto(*out) - } - if in.Nodes != nil { - in, out := &in.Nodes, &out.Nodes - *out = make(UpstreamNodes, len(*in)) - copy(*out, *in) - } - if in.Retries != nil { - in, out := &in.Retries, &out.Retries - *out = new(int) - **out = **in - } - if in.Timeout != nil { - in, out := &in.Timeout, &out.Timeout - *out = new(UpstreamTimeout) - **out = **in - } - if in.TLS != nil { - in, out := &in.TLS, &out.TLS - *out = new(ClientTLS) - **out = **in - } - if in.DiscoveryArgs != nil { - in, out := &in.DiscoveryArgs, &out.DiscoveryArgs - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// 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 -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UpstreamActiveHealthCheck) DeepCopyInto(out *UpstreamActiveHealthCheck) { - *out = *in - if in.HTTPRequestHeaders != nil { - in, out := &in.HTTPRequestHeaders, &out.HTTPRequestHeaders - *out = make([]string, len(*in)) - copy(*out, *in) - } - in.Healthy.DeepCopyInto(&out.Healthy) - in.Unhealthy.DeepCopyInto(&out.Unhealthy) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamActiveHealthCheck. -func (in *UpstreamActiveHealthCheck) DeepCopy() *UpstreamActiveHealthCheck { - if in == nil { - return nil - } - out := new(UpstreamActiveHealthCheck) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UpstreamActiveHealthCheckHealthy) DeepCopyInto(out *UpstreamActiveHealthCheckHealthy) { - *out = *in - in.UpstreamPassiveHealthCheckHealthy.DeepCopyInto(&out.UpstreamPassiveHealthCheckHealthy) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamActiveHealthCheckHealthy. -func (in *UpstreamActiveHealthCheckHealthy) DeepCopy() *UpstreamActiveHealthCheckHealthy { - if in == nil { - return nil - } - out := new(UpstreamActiveHealthCheckHealthy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UpstreamActiveHealthCheckUnhealthy) DeepCopyInto(out *UpstreamActiveHealthCheckUnhealthy) { - *out = *in - in.UpstreamPassiveHealthCheckUnhealthy.DeepCopyInto(&out.UpstreamPassiveHealthCheckUnhealthy) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamActiveHealthCheckUnhealthy. -func (in *UpstreamActiveHealthCheckUnhealthy) DeepCopy() *UpstreamActiveHealthCheckUnhealthy { - if in == nil { - return nil - } - out := new(UpstreamActiveHealthCheckUnhealthy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UpstreamHealthCheck) DeepCopyInto(out *UpstreamHealthCheck) { - *out = *in - if in.Active != nil { - in, out := &in.Active, &out.Active - *out = new(UpstreamActiveHealthCheck) - (*in).DeepCopyInto(*out) - } - if in.Passive != nil { - in, out := &in.Passive, &out.Passive - *out = new(UpstreamPassiveHealthCheck) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamHealthCheck. -func (in *UpstreamHealthCheck) DeepCopy() *UpstreamHealthCheck { - if in == nil { - return nil - } - out := new(UpstreamHealthCheck) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UpstreamNode) DeepCopyInto(out *UpstreamNode) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamNode. -func (in *UpstreamNode) DeepCopy() *UpstreamNode { - if in == nil { - return nil - } - out := new(UpstreamNode) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UpstreamPassiveHealthCheck) DeepCopyInto(out *UpstreamPassiveHealthCheck) { - *out = *in - in.Healthy.DeepCopyInto(&out.Healthy) - in.Unhealthy.DeepCopyInto(&out.Unhealthy) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamPassiveHealthCheck. -func (in *UpstreamPassiveHealthCheck) DeepCopy() *UpstreamPassiveHealthCheck { - if in == nil { - return nil - } - out := new(UpstreamPassiveHealthCheck) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UpstreamPassiveHealthCheckHealthy) DeepCopyInto(out *UpstreamPassiveHealthCheckHealthy) { - *out = *in - if in.HTTPStatuses != nil { - in, out := &in.HTTPStatuses, &out.HTTPStatuses - *out = make([]int, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamPassiveHealthCheckHealthy. -func (in *UpstreamPassiveHealthCheckHealthy) DeepCopy() *UpstreamPassiveHealthCheckHealthy { - if in == nil { - return nil - } - out := new(UpstreamPassiveHealthCheckHealthy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UpstreamPassiveHealthCheckUnhealthy) DeepCopyInto(out *UpstreamPassiveHealthCheckUnhealthy) { - *out = *in - if in.HTTPStatuses != nil { - in, out := &in.HTTPStatuses, &out.HTTPStatuses - *out = make([]int, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamPassiveHealthCheckUnhealthy. -func (in *UpstreamPassiveHealthCheckUnhealthy) DeepCopy() *UpstreamPassiveHealthCheckUnhealthy { - if in == nil { - return nil - } - out := new(UpstreamPassiveHealthCheckUnhealthy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WolfRBACConsumerConfig) DeepCopyInto(out *WolfRBACConsumerConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WolfRBACConsumerConfig. -func (in *WolfRBACConsumerConfig) DeepCopy() *WolfRBACConsumerConfig { - if in == nil { - return nil - } - out := new(WolfRBACConsumerConfig) - in.DeepCopyInto(out) - return out -} diff --git a/go.mod b/go.mod index b2d94d99d..d7e8c9b73 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,6 @@ require ( github.com/samber/lo v1.47.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - go.etcd.io/etcd/client/v3 v3.5.15 go.uber.org/zap v1.27.0 golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 gopkg.in/yaml.v3 v3.0.1 @@ -62,8 +61,6 @@ require ( github.com/chai2010/gettext-go v1.0.2 // indirect github.com/containerd/containerd v1.7.15 // indirect github.com/containerd/log v0.1.0 // indirect - github.com/coreos/go-semver v0.3.1 // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -174,8 +171,6 @@ require ( github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect github.com/yudai/gojsondiff v1.0.0 // indirect github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect - go.etcd.io/etcd/api/v3 v3.5.15 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect diff --git a/go.sum b/go.sum index 911a70311..2b7092be0 100644 --- a/go.sum +++ b/go.sum @@ -82,10 +82,6 @@ github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG github.com/containerd/continuity v0.4.2/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= -github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= -github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= -github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= @@ -189,7 +185,6 @@ github.com/gobuffalo/packr/v2 v2.8.3/go.mod h1:0SahksCVcx4IMnigTjiFuyldmTrdTctXs github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -536,12 +531,6 @@ github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50 h1:hlE8//ciYMzt github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f h1:ERexzlUfuTvpE74urLSbIQW0Z/6hF9t8U4NsJLaioAY= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= -go.etcd.io/etcd/api/v3 v3.5.15 h1:3KpLJir1ZEBrYuV2v+Twaa/e2MdDCEZ/70H+lzEiwsk= -go.etcd.io/etcd/api/v3 v3.5.15/go.mod h1:N9EhGzXq58WuMllgH9ZvnEr7SI9pS0k0+DHZezGp7jM= -go.etcd.io/etcd/client/pkg/v3 v3.5.15 h1:fo0HpWz/KlHGMCC+YejpiCmyWDEuIpnTDzpJLB5fWlA= -go.etcd.io/etcd/client/pkg/v3 v3.5.15/go.mod h1:mXDI4NAOwEiszrHCb0aqfAYNCrZP4e9hRca3d1YK8EU= -go.etcd.io/etcd/client/v3 v3.5.15 h1:23M0eY4Fd/inNv1ZfU3AxrbbOdW79r9V9Rl62Nm6ip4= -go.etcd.io/etcd/client/v3 v3.5.15/go.mod h1:CLSJxrYjvLtHsrPKsy7LmZEE+DK2ktfd2bN4RhBMwlU= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= diff --git a/test/e2e/framework/api7_dashboard.go b/test/e2e/framework/api7_dashboard.go index ded0eb6fc..e8ebc55d5 100644 --- a/test/e2e/framework/api7_dashboard.go +++ b/test/e2e/framework/api7_dashboard.go @@ -30,8 +30,6 @@ import ( "github.com/gavv/httpexpect/v2" "github.com/google/uuid" . "github.com/onsi/gomega" - - v1 "github.com/apache/apisix-ingress-controller/api/dashboard/v1" ) var ( @@ -302,7 +300,24 @@ type responseCreateGatewayValue struct { Key string `json:"key"` } -func (f *Framework) GetDataplaneCertificates(gatewayGroupID string) *v1.DataplaneCertificate { +type BaseCertificate struct { + ID string `json:"id" gorm:"primaryKey; column:id; size:255;"` + Certificate string `json:"certificate" gorm:"column:certificate; type:text;"` + PrivateKey string `json:"private_key" gorm:"column:private_key; type:text;" mask:"fixed"` +} + +type DataplaneCertificate struct { + *BaseCertificate + + GatewayGroupID string `json:"gateway_group_id" gorm:"column:gateway_group_id;size:255;"` + CACertificate string `json:"ca_certificate" gorm:"column:ca_certificate;type:text;"` +} + +func (DataplaneCertificate) TableName() string { + return "dataplane_certificate" +} + +func (f *Framework) GetDataplaneCertificates(gatewayGroupID string) *DataplaneCertificate { respExp := f.DashboardHTTPClient(). POST("/api/gateway_groups/"+gatewayGroupID+"/dp_client_certificates"). WithBasicAuth("admin", "admin"). @@ -316,7 +331,7 @@ func (f *Framework) GetDataplaneCertificates(gatewayGroupID string) *v1.Dataplan body := respExp.Body().Raw() var dpCertResp struct { - Value v1.DataplaneCertificate `json:"value"` + Value DataplaneCertificate `json:"value"` } err := json.Unmarshal([]byte(body), &dpCertResp) Expect(err).ToNot(HaveOccurred())