config

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

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.

Index

Constants

View Source
const (
	// IngressAPISIXLeader is the default election id for the controller
	// leader election.
	IngressAPISIXLeader = "ingress-apisix-leader"
	// IngressClass is the default ingress class name, used for Ingress
	// object's IngressClassName field in Kubernetes clusters version v1.18.0
	// or higher, or the annotation "kubernetes.io/ingress.class" (deprecated).
	IngressClass = "apisix"

	// IngressNetworkingV1 represents ingress.networking/v1
	IngressNetworkingV1 = "networking/v1"
	// IngressNetworkingV1beta1 represents ingress.networking/v1beta1
	IngressNetworkingV1beta1 = "networking/v1beta1"
	// IngressExtensionsV1beta1 represents ingress.extensions/v1beta1
	// WARNING: ingress.extensions/v1beta1 is deprecated in v1.14+, and will be unavilable
	// in v1.22.
	IngressExtensionsV1beta1 = "extensions/v1beta1"
	// ApisixV2 represents apisix.apache.org/v2
	ApisixV2 = "apisix.apache.org/v2"
	// DefaultAPIVersion refers to the default resource version
	DefaultAPIVersion = ApisixV2

	// ControllerName is the name of the controller used to identify
	// the controller of the GatewayClass.
	ControllerName = "apisix.apache.org/gateway-controller"

	// Process Ingress resources with ingressClass=apisix and all CRDs
	IngressClassApisixAndAll = "apisix-and-all"

	// Deployment mode
	DeploymentMode_AdminAPI = "admin-api"
	DeploymentMode_gRPC     = "grpc"
)

Variables

View Source
var (
	// Description information of API version, including default values and supported API version.
	APIVersionDescribe = fmt.Sprintf(`the default value of API version is "%s", support "%s".`, DefaultAPIVersion, ApisixV2)
)

Functions

This section is empty.

Types

type APISIXConfig

type APISIXConfig struct {
	// AdminAPIVersion is the APISIX admin API version
	AdminAPIVersion string `json:"admin_api_version" yaml:"admin_api_version"`
	// DefaultClusterName is the name of default cluster.
	DefaultClusterName string `json:"default_cluster_name" yaml:"default_cluster_name"`
	// DefaultClusterBaseURL is the base url configuration for the default cluster.
	DefaultClusterBaseURL string `json:"default_cluster_base_url" yaml:"default_cluster_base_url"`
	// DefaultClusterAdminKey is the admin key for the default cluster.
	// TODO: Obsolete the plain way to specify admin_key, which is insecure.
	DefaultClusterAdminKey string `json:"default_cluster_admin_key" yaml:"default_cluster_admin_key"`
}

APISIXConfig contains all APISIX related config items.

type Config

type Config struct {
	CertFilePath                 string             `json:"cert_file" yaml:"cert_file"`
	KeyFilePath                  string             `json:"key_file" yaml:"key_file"`
	LogLevel                     string             `json:"log_level" yaml:"log_level"`
	LogOutput                    string             `json:"log_output" yaml:"log_output"`
	LogRotateOutputPath          string             `json:"log_rotate_output_path" yaml:"log_rotate_output_path"`
	LogRotationMaxSize           int                `json:"log_rotation_max_size" yaml:"log_rotation_max_size"`
	LogRotationMaxAge            int                `json:"log_rotation_max_age" yaml:"log_rotation_max_age"`
	LogRotationMaxBackups        int                `json:"log_rotation_max_backups" yaml:"log_rotation_max_backups"`
	HTTPListen                   string             `json:"http_listen" yaml:"http_listen"`
	HTTPSListen                  string             `json:"https_listen" yaml:"https_listen"`
	IngressPublishService        string             `json:"ingress_publish_service" yaml:"ingress_publish_service"`
	IngressStatusAddress         []string           `json:"ingress_status_address" yaml:"ingress_status_address"`
	EnableProfiling              bool               `json:"enable_profiling" yaml:"enable_profiling"`
	Kubernetes                   KubernetesConfig   `json:"kubernetes" yaml:"kubernetes"`
	APISIX                       APISIXConfig       `json:"apisix" yaml:"apisix"`
	ApisixResourceSyncInterval   types.TimeDuration `json:"apisix_resource_sync_interval" yaml:"apisix_resource_sync_interval"`
	ApisixResourceSyncComparison bool               `json:"apisix_resource_sync_comparison" yaml:"apisix_resource_sync_comparison"`
	PluginMetadataConfigMap      string             `json:"plugin_metadata_cm" yaml:"plugin_metadata_cm"`
	EtcdServer                   EtcdServerConfig   `json:"etcdserver" yaml:"etcdserver"`
}

Config contains all config items which are necessary for apisix-ingress-controller's running.

func NewConfigFromFile

func NewConfigFromFile(filename string) (*Config, error)

NewConfigFromFile creates a Config object and fills all config items according to the configuration file. The file can be in JSON/YAML format, which will be distinguished according to the file suffix.

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig creates a Config object which fills all config items with default value.

func (*Config) Validate

func (cfg *Config) Validate() error

Validate validates whether the Config is right.

type EtcdServerConfig added in v1.7.0

type EtcdServerConfig struct {
	Enabled           bool   `json:"enabled" yaml:"enabled"`
	Prefix            string `json:"prefix" yaml:"prefix"`
	ListenAddress     string `json:"listen_address" yaml:"listen_address"`
	SSLKeyEncryptSalt string `json:"ssl_key_encrypt_salt" yaml:"ssl_key_encrypt_salt"`
}

type KubernetesConfig

type KubernetesConfig struct {
	Kubeconfig           string             `json:"kubeconfig" yaml:"kubeconfig"`
	ResyncInterval       types.TimeDuration `json:"resync_interval" yaml:"resync_interval"`
	NamespaceSelector    []string           `json:"namespace_selector" yaml:"namespace_selector"`
	ElectionID           string             `json:"election_id" yaml:"election_id"`
	IngressClass         string             `json:"ingress_class" yaml:"ingress_class"`
	IngressVersion       string             `json:"ingress_version" yaml:"ingress_version"`
	WatchEndpointSlices  bool               `json:"watch_endpoint_slices" yaml:"watch_endpoint_slices"`
	APIVersion           string             `json:"api_version" yaml:"api_version"`
	EnableGatewayAPI     bool               `json:"enable_gateway_api" yaml:"enable_gateway_api"`
	DisableStatusUpdates bool               `json:"disable_status_updates" yaml:"disable_status_updates"`
	EnableAdmission      bool               `json:"enable_admission" yaml:"enable_admission"`
}

KubernetesConfig contains all Kubernetes related config items.

Jump to

Keyboard shortcuts

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