v1

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Overview

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.

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.

Index

Constants

View Source
const (
	// HashOnVars means the hash scope is variable.
	HashOnVars = "vars"
	// HashVarsCombination 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"

	// 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

	// Default connect, read and send timeout (in seconds) with upstreams.
	DefaultUpstreamTimeout = 60
)

Variables

This section is empty.

Functions

func ComposeRouteName added in v0.4.0

func ComposeRouteName(namespace, name string, rule string) string

ComposeRouteName uses namespace, name and rule name to compose the route name.

func ComposeUpstreamName added in v0.4.0

func ComposeUpstreamName(namespace, name string, port int32) string

ComposeUpstreamName uses namespace, name and port info to compose the upstream name.

Types

type Metadata

type Metadata struct {
	ID              string `json:"id,omitempty" yaml:"id,omitempty"`
	FullName        string `json:"full_name,omitempty" yaml:"full_name,omitempty"`
	Name            string `json:"name,omitempty" yaml:"name,omitempty"`
	ResourceVersion string `json:"resource_version,omitempty" yaml:"resource_version,omitempty"`
	Group           string `json:"group,omitempty" yaml:"group,omitempty"`
}

Metadata contains all meta information about resources.

type Plugins

type Plugins map[string]interface{}

func (*Plugins) DeepCopy

func (p *Plugins) DeepCopy() *Plugins

func (*Plugins) DeepCopyInto

func (p *Plugins) DeepCopyInto(out *Plugins)

type Route

type Route struct {
	Metadata `json:",inline" yaml:",inline"`

	Host         string   `json:"host,omitempty" yaml:"host,omitempty"`
	Hosts        []string `json:"hosts,omitempty" yaml:"hosts,omitempty"`
	Path         string   `json:"path,omitempty" yaml:"path,omitempty"`
	Priority     int      `json:"priority,omitempty" yaml:"priority,omitempty"`
	Uris         []string `json:"uris,omitempty" yaml:"uris,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"`
}

Route apisix route object +k8s:deepcopy-gen=true

func (*Route) DeepCopy

func (in *Route) DeepCopy() *Route

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route.

func (*Route) DeepCopyInto

func (in *Route) DeepCopyInto(out *Route)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Service

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"`
}

Service apisix service +k8s:deepcopy-gen=true

func (*Service) DeepCopy

func (in *Service) DeepCopy() *Service

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service.

func (*Service) DeepCopyInto

func (in *Service) DeepCopyInto(out *Service)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Ssl

type Ssl struct {
	ID       string   `json:"id,omitempty" yaml:"id,omitempty"`
	FullName string   `json:"full_name,omitempty" yaml:"full_name,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"`
}

Ssl apisix ssl object +k8s:deepcopy-gen=true

func (*Ssl) DeepCopy

func (in *Ssl) DeepCopy() *Ssl

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Ssl.

func (*Ssl) DeepCopyInto

func (in *Ssl) DeepCopyInto(out *Ssl)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Upstream

type Upstream struct {
	Metadata `json:",inline" yaml:",inline"`

	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"`
	Checks   *UpstreamHealthCheck `json:"checks,omitempty" yaml:"checks,omitempty"`
	Nodes    []UpstreamNode       `json:"nodes,omitempty" yaml:"nodes,omitempty"`
	FromKind string               `json:"from_kind,omitempty" yaml:"from_kind,omitempty"`
	Scheme   string               `json:"scheme,omitempty" yaml:"scheme,omitempty"`
	Retries  int                  `json:"retries,omitempty" yaml:"retries,omitempty"`
	Timeout  *UpstreamTimeout     `json:"timeout,omitempty" yaml:"timeout,omitempty"`
}

Upstream is the apisix upstream definition. +k8s:deepcopy-gen=true

func NewDefaultUpstream added in v0.4.0

func NewDefaultUpstream() *Upstream

NewDefaultUpstream returns an empty Upstream with default values.

func (*Upstream) DeepCopy

func (in *Upstream) DeepCopy() *Upstream

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Upstream.

func (*Upstream) DeepCopyInto

func (in *Upstream) DeepCopyInto(out *Upstream)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type UpstreamActiveHealthCheck added in v0.4.0

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"`
}

UpstreamActiveHealthCheck defines the active kind of upstream health check. +k8s:deepcopy-gen=true

func (*UpstreamActiveHealthCheck) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamActiveHealthCheck.

func (*UpstreamActiveHealthCheck) DeepCopyInto added in v0.4.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type UpstreamActiveHealthCheckHealthy added in v0.4.0

type UpstreamActiveHealthCheckHealthy struct {
	UpstreamPassiveHealthCheckHealthy `json:",inline" yaml:",inline"`

	Interval int `json:"interval,omitempty" yaml:"interval,omitempty"`
}

UpstreamActiveHealthCheckHealthy defines the conditions to judge whether an upstream node is healthy with the active manner. +k8s:deepcopy-gen=true

func (*UpstreamActiveHealthCheckHealthy) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamActiveHealthCheckHealthy.

func (*UpstreamActiveHealthCheckHealthy) DeepCopyInto added in v0.4.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type UpstreamActiveHealthCheckUnhealthy added in v0.4.0

type UpstreamActiveHealthCheckUnhealthy struct {
	UpstreamPassiveHealthCheckUnhealthy `json:",inline" yaml:",inline"`

	Interval int `json:"interval,omitempty" yaml:"interval,omitempty"`
}

UpstreamActiveHealthCheckUnhealthy defines the conditions to judge whether an upstream node is unhealthy with the active manager. +k8s:deepcopy-gen=true

func (*UpstreamActiveHealthCheckUnhealthy) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamActiveHealthCheckUnhealthy.

func (*UpstreamActiveHealthCheckUnhealthy) DeepCopyInto added in v0.4.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type UpstreamHealthCheck added in v0.4.0

type UpstreamHealthCheck struct {
	Active  *UpstreamActiveHealthCheck  `json:"active" yaml:"active"`
	Passive *UpstreamPassiveHealthCheck `json:"passive,omitempty" yaml:"passive,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

func (*UpstreamHealthCheck) DeepCopy added in v0.4.0

func (in *UpstreamHealthCheck) DeepCopy() *UpstreamHealthCheck

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamHealthCheck.

func (*UpstreamHealthCheck) DeepCopyInto added in v0.4.0

func (in *UpstreamHealthCheck) DeepCopyInto(out *UpstreamHealthCheck)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type UpstreamNode added in v0.4.0

type UpstreamNode 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"`
}

Node the node in upstream +k8s:deepcopy-gen=true

func (*UpstreamNode) DeepCopy added in v0.4.0

func (in *UpstreamNode) DeepCopy() *UpstreamNode

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamNode.

func (*UpstreamNode) DeepCopyInto added in v0.4.0

func (in *UpstreamNode) DeepCopyInto(out *UpstreamNode)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type UpstreamPassiveHealthCheck added in v0.4.0

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"`
}

UpstreamPassiveHealthCheck defines the passive kind of upstream health check. +k8s:deepcopy-gen=true

func (*UpstreamPassiveHealthCheck) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamPassiveHealthCheck.

func (*UpstreamPassiveHealthCheck) DeepCopyInto added in v0.4.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type UpstreamPassiveHealthCheckHealthy added in v0.4.0

type UpstreamPassiveHealthCheckHealthy struct {
	HTTPStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"`
	Successes    int   `json:"successes,omitempty" yaml:"successes,omitempty"`
}

UpstreamPassiveHealthCheckHealthy defines the conditions to judge whether an upstream node is healthy with the passive manner. +k8s:deepcopy-gen=true

func (*UpstreamPassiveHealthCheckHealthy) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamPassiveHealthCheckHealthy.

func (*UpstreamPassiveHealthCheckHealthy) DeepCopyInto added in v0.4.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type UpstreamPassiveHealthCheckUnhealthy added in v0.4.0

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     float64 `json:"timeouts,omitempty" yaml:"timeouts,omitempty"`
}

UpstreamPassiveHealthCheckUnhealthy defines the conditions to judge whether an upstream node is unhealthy with the passive manager. +k8s:deepcopy-gen=true

func (*UpstreamPassiveHealthCheckUnhealthy) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamPassiveHealthCheckUnhealthy.

func (*UpstreamPassiveHealthCheckUnhealthy) DeepCopyInto added in v0.4.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type UpstreamTimeout added in v0.4.0

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"`
}

UpstreamTimeout represents the timeout settings on Upstream.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL