This is an automated email from the ASF dual-hosted git repository.
kvn 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 b5cba04 chore: add yaml tags for types (#307)
b5cba04 is described below
commit b5cba04a9039ba47cb4991102ba80cbcf653db8b
Author: Hoshea Jiang <[email protected]>
AuthorDate: Tue Mar 23 08:54:41 2021 +0800
chore: add yaml tags for types (#307)
* Add yaml tags
* resolve conflicts
---
pkg/kube/apisix/apis/config/v1/types.go | 52 +++++++++++++-------------
pkg/kube/apisix/apis/config/v2alpha1/types.go | 54 +++++++++++++--------------
2 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/pkg/kube/apisix/apis/config/v1/types.go
b/pkg/kube/apisix/apis/config/v1/types.go
index fe665ab..9e014c2 100644
--- a/pkg/kube/apisix/apis/config/v1/types.go
+++ b/pkg/kube/apisix/apis/config/v1/types.go
@@ -35,40 +35,40 @@ type ApisixRoute struct {
// ApisixRouteSpec is the spec definition for ApisixRouteSpec.
type ApisixRouteSpec struct {
- Rules []Rule `json:"rules,omitempty"`
+ Rules []Rule `json:"rules,omitempty" yaml:"rules,omitempty"`
}
// Rule represents a single route rule in ApisixRoute.
type Rule struct {
- Host string `json:"host,omitempty"`
- Http Http `json:"http,omitempty"`
+ Host string `json:"host,omitempty" yaml:"host,omitempty"`
+ Http Http `json:"http,omitempty" yaml:"http,omitempty"`
}
// Http represents all route rules in HTTP scope.
type Http struct {
- Paths []Path `json:"paths,omitempty"`
+ Paths []Path `json:"paths,omitempty" yaml:"paths,omitempty"`
}
// Path defines an URI based route rule.
type Path struct {
- Path string `json:"path,omitempty"`
- Backend Backend `json:"backend,omitempty"`
- Plugins []Plugin `json:"plugins,omitempty"`
+ Path string `json:"path,omitempty" yaml:"path,omitempty"`
+ Backend Backend `json:"backend,omitempty" yaml:"backend,omitempty"`
+ Plugins []Plugin `json:"plugins,omitempty" yaml:"plugins,omitempty"`
}
// Backend defines an upstream, it should be an existing Kubernetes Service.
// Note the Service should be in the same namespace with ApisixRoute resource,
// i.e. cross namespacing is not allowed.
type Backend struct {
- ServiceName string `json:"serviceName,omitempty"`
- ServicePort int `json:"servicePort,omitempty"`
+ ServiceName string `json:"serviceName,omitempty"
yaml:"serviceName,omitempty"`
+ ServicePort int `json:"servicePort,omitempty"
yaml:"servicePort,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ApisixRouteList struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ListMeta `json:"metadata"`
- Items []ApisixRoute `json:"items,omitempty"`
+ metav1.TypeMeta `json:",inline" yaml:",inline"`
+ metav1.ListMeta `json:"metadata" yaml:"metadata"`
+ Items []ApisixRoute `json:"items,omitempty"
yaml:"items,omitempty"`
}
// +genclient
@@ -208,16 +208,16 @@ type PassiveHealthCheckUnhealthy struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ApisixUpstreamList struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ListMeta `json:"metadata"`
- Items []ApisixUpstream `json:"items,omitempty"`
+ metav1.TypeMeta `json:",inline" yaml:",inline"`
+ metav1.ListMeta `json:"metadata" yaml:"metadata"`
+ Items []ApisixUpstream `json:"items,omitempty"
yaml:"items,omitempty"`
}
type Plugin struct {
- Name string `json:"name,omitempty"`
- Enable bool `json:"enable,omitempty"`
- Config Config `json:"config,omitempty"`
- ConfigSet ConfigSet `json:"config_set,omitempty"`
+ Name string `json:"name,omitempty" yaml:"name,omitempty"`
+ Enable bool `json:"enable,omitempty" yaml:"enable,omitempty"`
+ Config Config `json:"config,omitempty" yaml:"config,omitempty"`
+ ConfigSet ConfigSet `json:"config_set,omitempty"
yaml:"config_set,omitempty"`
}
type ConfigSet []interface{}
@@ -265,19 +265,19 @@ type ApisixTls struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ApisixTlsList struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ListMeta `json:"metadata"`
- Items []ApisixTls `json:"items,omitempty"`
+ metav1.TypeMeta `json:",inline" yaml:",inline"`
+ metav1.ListMeta `json:"metadata" yaml:"metadata"`
+ Items []ApisixTls `json:"items,omitempty"
yaml:"items,omitempty"`
}
// ApisixTlsSpec is the specification of ApisixSSL.
type ApisixTlsSpec struct {
- Hosts []string `json:"hosts,omitempty"`
- Secret ApisixSecret `json:"secret,omitempty"`
+ Hosts []string `json:"hosts,omitempty" yaml:"hosts,omitempty"`
+ Secret ApisixSecret `json:"secret,omitempty" yaml:"secret,omitempty"`
}
// ApisixSecret describes the Kubernetes Secret name and namespace.
type ApisixSecret struct {
- Name string `json:"name,omitempty"`
- Namespace string `json:"namespace,omitempty"`
+ Name string `json:"name,omitempty" yaml:"name,omitempty"`
+ Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
}
diff --git a/pkg/kube/apisix/apis/config/v2alpha1/types.go
b/pkg/kube/apisix/apis/config/v2alpha1/types.go
index efeb15b..303bd04 100644
--- a/pkg/kube/apisix/apis/config/v2alpha1/types.go
+++ b/pkg/kube/apisix/apis/config/v2alpha1/types.go
@@ -70,25 +70,25 @@ type ApisixRoute struct {
// ApisixRouteSpec is the spec definition for ApisixRouteSpec.
type ApisixRouteSpec struct {
- HTTP []*ApisixRouteHTTP `json:"http,omitempty"`
+ HTTP []*ApisixRouteHTTP `json:"http,omitempty" yaml:"http,omitempty"`
}
// ApisixRouteHTTP represents a single route in for HTTP traffic.
type ApisixRouteHTTP struct {
// The rule name, cannot be empty.
- Name string `json:"name"`
+ Name string `json:"name" yaml:"name"`
// Route priority, when multiple routes contains
// same URI path (for path matching), route with
// higher priority will take effect.
- Priority int `json:"priority,omitempty"`
- Match *ApisixRouteHTTPMatch `json:"match,omitempty"`
+ Priority int `json:"priority,omitempty"
yaml:"priority,omitempty"`
+ Match *ApisixRouteHTTPMatch `json:"match,omitempty"
yaml:"match,omitempty"`
// Deprecated: Backend will be removed in the future, use Backends
instead.
- Backend *ApisixRouteHTTPBackend `json:"backend"`
+ Backend *ApisixRouteHTTPBackend `json:"backend" yaml:"backend"`
// Backends represents potential backends to proxy after the route
// rule matched. When number of backends are more than one,
traffic-split
// plugin in APISIX will be used to split traffic based on the backend
weight.
- Backends []*ApisixRouteHTTPBackend `json:"backends"`
- Plugins []*ApisixRouteHTTPPlugin `json:"plugins,omitempty"`
+ Backends []*ApisixRouteHTTPBackend `json:"backends" yaml:"backends"`
+ Plugins []*ApisixRouteHTTPPlugin `json:"plugins,omitempty"
yaml:"plugins,omitempty"`
}
// ApisixRouteHTTPMatch represents the match condition for hitting this route.
@@ -96,17 +96,17 @@ type ApisixRouteHTTPMatch struct {
// URI path predicates, at least one path should be
// configured, path could be exact or prefix, for prefix path,
// append "*" after it, for instance, "/foo*".
- Paths []string `json:"paths"`
+ Paths []string `json:"paths" yaml:"paths"`
// HTTP request method predicates.
- Methods []string `json:"methods,omitempty"`
+ Methods []string `json:"methods,omitempty" yaml:"methods,omitempty"`
// HTTP Host predicates, host can be a wildcard domain or
// an exact domain. For wildcard domain, only one generic
// level is allowed, for instance, "*.foo.com" is valid but
// "*.*.foo.com" is not.
- Hosts []string `json:"hosts,omitempty"`
+ Hosts []string `json:"hosts,omitempty" yaml:"hosts,omitempty"`
// Remote address predicates, items can be valid IPv4 address
// or IPv6 address or CIDR.
- RemoteAddrs []string `json:"remoteAddrs,omitempty"`
+ RemoteAddrs []string `json:"remoteAddrs,omitempty"
yaml:"remoteAddrs,omitempty"`
// NginxVars represents generic match predicates,
// it uses Nginx variable systems, so any predicate
// like headers, querystring and etc can be leveraged
@@ -118,7 +118,7 @@ type ApisixRouteHTTPMatch struct {
// value:
// - "127.0.0.1"
// - "10.0.5.11"
- NginxVars []ApisixRouteHTTPMatchExpr `json:"exprs,omitempty"`
+ NginxVars []ApisixRouteHTTPMatchExpr `json:"exprs,omitempty"
yaml:"exprs,omitempty"`
}
// ApisixRouteHTTPMatchExpre represents a binary route match expression .
@@ -126,17 +126,17 @@ type ApisixRouteHTTPMatchExpr struct {
// Subject is the expression subject, it can
// be any string composed by literals and nginx
// vars.
- Subject ApisixRouteHTTPMatchExprSubject `json:"subject"`
+ Subject ApisixRouteHTTPMatchExprSubject `json:"subject" yaml:"subject"`
// Op is the operator.
- Op string `json:"op"`
+ Op string `json:"op" yaml:"op"`
// Set is an array type object of the expression.
// It should be used when the Op is "in" or "not_in";
- Set []string `json:"set"`
+ Set []string `json:"set" yaml:"set"`
// Value is the normal type object for the expression,
// it should be used when the Op is not "in" and "not_in".
// Set and Value are exclusive so only of them can be set
// in the same time.
- Value *string `json:"value"`
+ Value *string `json:"value" yaml:"value"`
}
// ApisixRouteHTTPMatchExprSubject describes the route match expression
subject.
@@ -145,33 +145,33 @@ type ApisixRouteHTTPMatchExprSubject struct {
// ScopeQuery, ScopeHeader, ScopePath
// when subject is ScopePath, Name field
// will be ignored.
- Scope string `json:"scope"`
+ Scope string `json:"scope" yaml:"scope"`
// The name of subject.
- Name string `json:"name"`
+ Name string `json:"name" yaml:"name"`
}
// ApisixRouteHTTPBackend represents a HTTP backend (a Kuberentes Service).
type ApisixRouteHTTPBackend struct {
// The name (short) of the service, note cross namespace is forbidden,
// so be sure the ApisixRoute and Service are in the same namespace.
- ServiceName string `json:"serviceName"`
+ ServiceName string `json:"serviceName" yaml:"serviceName"`
// The service port, could be the name or the port number.
- ServicePort intstr.IntOrString `json:"servicePort"`
+ ServicePort intstr.IntOrString `json:"servicePort" yaml:"servicePort"`
// The resolve granularity, can be "endpoints" or "service",
// when set to "endpoints", the pod ips will be used; other
// wise, the service ClusterIP or ExternalIP will be used,
// default is endpoints.
- ResolveGranularity string `json:"resolveGranularity"`
+ ResolveGranularity string `json:"resolveGranularity"
yaml:"resolveGranularity"`
// Weight of this backend.
- Weight int `json:"weight"`
+ Weight int `json:"weight" yaml:"weight"`
}
// ApisixRouteHTTPPlugin represents an APISIX plugin.
type ApisixRouteHTTPPlugin struct {
// The plugin name.
- Name string `json:"name"`
+ Name string `json:"name" yaml:"name"`
// Whether this plugin is in use, default is true.
- Enable bool `json:"enable"`
+ Enable bool `json:"enable" yaml:"enable"`
// Plugin configuration.
// TODO we may use protobuf to define it.
Config ApisixRouteHTTPPluginConfig
@@ -197,7 +197,7 @@ func (p *ApisixRouteHTTPPluginConfig) DeepCopy()
*ApisixRouteHTTPPluginConfig {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ApisixRouteList struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ListMeta `json:"metadata"`
- Items []ApisixRoute `json:"items,omitempty"`
+ metav1.TypeMeta `json:",inline" yaml:",inline"`
+ metav1.ListMeta `json:"metadata" yaml:"metadata"`
+ Items []ApisixRoute `json:"items,omitempty"
yaml:"items,omitempty"`
}