Documentation ¶
Index ¶
- Constants
- func GetK8sVersion(client kubernetes.Interface) (v *version.Version, err error)
- func NewSpiffeController(sync func(*workload.X509SVIDs), spireAgentAddr string) (*spiffeController, error)
- func ParseNamespaceName(value string) (ns string, name string, err error)
- type Configuration
- func (c *Configuration) AddOrUpdateGlobalConfiguration(gc *conf_v1alpha1.GlobalConfiguration) ([]ResourceChange, []ConfigurationProblem, error)
- func (c *Configuration) AddOrUpdateIngress(ing *networking.Ingress) ([]ResourceChange, []ConfigurationProblem)
- func (c *Configuration) AddOrUpdateTransportServer(ts *conf_v1alpha1.TransportServer) ([]ResourceChange, []ConfigurationProblem)
- func (c *Configuration) AddOrUpdateVirtualServer(vs *conf_v1.VirtualServer) ([]ResourceChange, []ConfigurationProblem)
- func (c *Configuration) AddOrUpdateVirtualServerRoute(vsr *conf_v1.VirtualServerRoute) ([]ResourceChange, []ConfigurationProblem)
- func (c *Configuration) DeleteGlobalConfiguration() ([]ResourceChange, []ConfigurationProblem)
- func (c *Configuration) DeleteIngress(key string) ([]ResourceChange, []ConfigurationProblem)
- func (c *Configuration) DeleteTransportServer(key string) ([]ResourceChange, []ConfigurationProblem)
- func (c *Configuration) DeleteVirtualServer(key string) ([]ResourceChange, []ConfigurationProblem)
- func (c *Configuration) DeleteVirtualServerRoute(key string) ([]ResourceChange, []ConfigurationProblem)
- func (c *Configuration) FindResourcesForAppProtectLogConfAnnotation(logConfNamespace string, logConfName string) []Resource
- func (c *Configuration) FindResourcesForAppProtectPolicyAnnotation(policyNamespace string, policyName string) []Resource
- func (c *Configuration) FindResourcesForEndpoints(endpointsNamespace string, endpointsName string) []Resource
- func (c *Configuration) FindResourcesForPolicy(policyNamespace string, policyName string) []Resource
- func (c *Configuration) FindResourcesForSecret(secretNamespace string, secretName string) []Resource
- func (c *Configuration) FindResourcesForService(svcNamespace string, svcName string) []Resource
- func (c *Configuration) GetResources() []Resource
- func (c *Configuration) GetResourcesWithFilter(filter resourceFilter) []Resource
- type ConfigurationProblem
- type IngressConfiguration
- func (ic *IngressConfiguration) AddWarning(warning string)
- func (ic *IngressConfiguration) GetKeyWithKind() string
- func (ic *IngressConfiguration) GetObjectMeta() *metav1.ObjectMeta
- func (ic *IngressConfiguration) IsEqual(resource Resource) bool
- func (ic *IngressConfiguration) Wins(resource Resource) bool
- type LoadBalancerController
- func (lbc *LoadBalancerController) AddSyncQueue(item interface{})
- func (lbc *LoadBalancerController) HasCorrectIngressClass(obj interface{}) bool
- func (lbc *LoadBalancerController) IsExternalServiceForStatus(svc *api_v1.Service) bool
- func (lbc *LoadBalancerController) IsExternalServiceKeyForStatus(key string) bool
- func (lbc *LoadBalancerController) IsNginxReady() bool
- func (lbc *LoadBalancerController) Run()
- func (lbc *LoadBalancerController) Stop()
- func (lbc *LoadBalancerController) UpdateIngressStatusAndEventsOnDelete(ingConfig *IngressConfiguration, changeError string, deleteErr error)
- func (lbc *LoadBalancerController) UpdateVirtualServerStatusAndEventsOnDelete(vsConfig *VirtualServerConfiguration, changeError string, deleteErr error)
- type MinionConfiguration
- type NewLoadBalancerControllerInput
- type Operation
- type Resource
- type ResourceChange
- type TransportServerConfiguration
- func (tsc *TransportServerConfiguration) AddWarning(warning string)
- func (tsc *TransportServerConfiguration) GetKeyWithKind() string
- func (tsc *TransportServerConfiguration) GetObjectMeta() *metav1.ObjectMeta
- func (tsc *TransportServerConfiguration) IsEqual(resource Resource) bool
- func (tsc *TransportServerConfiguration) Wins(resource Resource) bool
- type VirtualServerConfiguration
- func (vsc *VirtualServerConfiguration) AddWarning(warning string)
- func (vsc *VirtualServerConfiguration) GetKeyWithKind() string
- func (vsc *VirtualServerConfiguration) GetObjectMeta() *metav1.ObjectMeta
- func (vsc *VirtualServerConfiguration) IsEqual(resource Resource) bool
- func (vsc *VirtualServerConfiguration) Wins(resource Resource) bool
Constants ¶
const (
// IngressControllerName holds Ingress Controller name
IngressControllerName = "nginx.org/ingress-controller"
)
Variables ¶
This section is empty.
Functions ¶
func GetK8sVersion ¶ added in v1.9.0
func GetK8sVersion(client kubernetes.Interface) (v *version.Version, err error)
GetK8sVersion returns the running version of k8s
Types ¶
type Configuration ¶ added in v1.9.0
type Configuration struct {
// contains filtered or unexported fields
}
Configuration represents the configuration of the Ingress Controller - a collection of configuration objects (Ingresses, VirtualServers, VirtualServerRoutes) ready to be transformed into NGINX config. It holds the latest valid state of those objects. The IC needs to ensure that at any point in time the NGINX config on the filesystem reflects the state of the objects in the Configuration.
func NewConfiguration ¶ added in v1.9.0
func NewConfiguration( hasCorrectIngressClass func(interface{}) bool, isPlus bool, appProtectEnabled bool, internalRoutesEnabled bool, virtualServerValidator *validation.VirtualServerValidator, globalConfigurationValidator *validation.GlobalConfigurationValidator, transportServerValidator *validation.TransportServerValidator, isTLSPassthroughEnabled bool, ) *Configuration
NewConfiguration creates a new Configuration.
func (*Configuration) AddOrUpdateGlobalConfiguration ¶ added in v1.11.0
func (c *Configuration) AddOrUpdateGlobalConfiguration(gc *conf_v1alpha1.GlobalConfiguration) ([]ResourceChange, []ConfigurationProblem, error)
AddOrUpdateGlobalConfiguration adds or updates the GlobalConfiguration.
func (*Configuration) AddOrUpdateIngress ¶ added in v1.9.0
func (c *Configuration) AddOrUpdateIngress(ing *networking.Ingress) ([]ResourceChange, []ConfigurationProblem)
AddOrUpdateIngress adds or updates the Ingress resource.
func (*Configuration) AddOrUpdateTransportServer ¶ added in v1.11.0
func (c *Configuration) AddOrUpdateTransportServer(ts *conf_v1alpha1.TransportServer) ([]ResourceChange, []ConfigurationProblem)
AddOrUpdateTransportServer adds or updates the TransportServer.
func (*Configuration) AddOrUpdateVirtualServer ¶ added in v1.9.0
func (c *Configuration) AddOrUpdateVirtualServer(vs *conf_v1.VirtualServer) ([]ResourceChange, []ConfigurationProblem)
AddOrUpdateVirtualServer adds or updates the VirtualServer resource.
func (*Configuration) AddOrUpdateVirtualServerRoute ¶ added in v1.9.0
func (c *Configuration) AddOrUpdateVirtualServerRoute(vsr *conf_v1.VirtualServerRoute) ([]ResourceChange, []ConfigurationProblem)
AddOrUpdateVirtualServerRoute adds or updates the VirtualServerRoute.
func (*Configuration) DeleteGlobalConfiguration ¶ added in v1.11.0
func (c *Configuration) DeleteGlobalConfiguration() ([]ResourceChange, []ConfigurationProblem)
DeleteGlobalConfiguration deletes GlobalConfiguration.
func (*Configuration) DeleteIngress ¶ added in v1.9.0
func (c *Configuration) DeleteIngress(key string) ([]ResourceChange, []ConfigurationProblem)
DeleteIngress deletes an Ingress resource by the key.
func (*Configuration) DeleteTransportServer ¶ added in v1.11.0
func (c *Configuration) DeleteTransportServer(key string) ([]ResourceChange, []ConfigurationProblem)
DeleteTransportServer deletes a TransportServer by the key.
func (*Configuration) DeleteVirtualServer ¶ added in v1.9.0
func (c *Configuration) DeleteVirtualServer(key string) ([]ResourceChange, []ConfigurationProblem)
DeleteVirtualServer deletes a VirtualServerResource by the key.
func (*Configuration) DeleteVirtualServerRoute ¶ added in v1.9.0
func (c *Configuration) DeleteVirtualServerRoute(key string) ([]ResourceChange, []ConfigurationProblem)
DeleteVirtualServerRoute deletes a VirtualServerRoute by the key.
func (*Configuration) FindResourcesForAppProtectLogConfAnnotation ¶ added in v1.11.0
func (c *Configuration) FindResourcesForAppProtectLogConfAnnotation(logConfNamespace string, logConfName string) []Resource
FindResourcesForAppProtectLogConfAnnotation finds resources that reference the specified AppProtect LogConf.
func (*Configuration) FindResourcesForAppProtectPolicyAnnotation ¶ added in v1.11.0
func (c *Configuration) FindResourcesForAppProtectPolicyAnnotation(policyNamespace string, policyName string) []Resource
FindResourcesForAppProtectPolicyAnnotation finds resources that reference the specified AppProtect policy via annotation.
func (*Configuration) FindResourcesForEndpoints ¶ added in v1.9.0
func (c *Configuration) FindResourcesForEndpoints(endpointsNamespace string, endpointsName string) []Resource
FindResourcesForEndpoints finds resources that reference the specified endpoints.
func (*Configuration) FindResourcesForPolicy ¶ added in v1.9.0
func (c *Configuration) FindResourcesForPolicy(policyNamespace string, policyName string) []Resource
FindResourcesForPolicy finds resources that reference the specified policy.
func (*Configuration) FindResourcesForSecret ¶ added in v1.9.0
func (c *Configuration) FindResourcesForSecret(secretNamespace string, secretName string) []Resource
FindResourcesForSecret finds resources that reference the specified secret.
func (*Configuration) FindResourcesForService ¶ added in v1.9.0
func (c *Configuration) FindResourcesForService(svcNamespace string, svcName string) []Resource
FindResourcesForService finds resources that reference the specified service.
func (*Configuration) GetResources ¶ added in v1.9.0
func (c *Configuration) GetResources() []Resource
GetResources returns all configuration resources.
func (*Configuration) GetResourcesWithFilter ¶ added in v1.9.0
func (c *Configuration) GetResourcesWithFilter(filter resourceFilter) []Resource
GetResourcesWithFilter returns resources using the filter.
type ConfigurationProblem ¶ added in v1.9.0
type ConfigurationProblem struct { // Object is a configuration object. Object runtime.Object // IsError tells if the problem is an error. If it is an error, then it is expected that the status of the object // will be updated to the state 'invalid'. Otherwise, the state will be 'warning'. IsError bool // Reason tells the reason. It matches the reason in the events/status of our configuration objects. Reason string // Messages gives the details about the problem. It matches the message in the events/status of our configuration objects. Message string }
ConfigurationProblem is a problem associated with a configuration object.
type IngressConfiguration ¶ added in v1.10.0
type IngressConfiguration struct { // Ingress holds a regular Ingress or a master Ingress. Ingress *networking.Ingress // IsMaster is true when the Ingress is a master. IsMaster bool // Minions contains minions if the Ingress is a master. Minions []*MinionConfiguration // ValidHosts marks the hosts of the Ingress as valid (true) or invalid (false). // Regular Ingress resources can have multiple hosts. It is possible that some of the hosts are taken by other // resources. In that case, those hosts will be marked as invalid. ValidHosts map[string]bool // Warnings includes all the warnings for the resource. Warnings []string // ChildWarnings includes the warnings of the minions. The key is the namespace/name. ChildWarnings map[string][]string }
IngressConfiguration holds an Ingress resource with its minions. It implements the Resource interface.
func NewMasterIngressConfiguration ¶ added in v1.10.0
func NewMasterIngressConfiguration(ing *networking.Ingress, minions []*MinionConfiguration, childWarnings map[string][]string) *IngressConfiguration
NewMasterIngressConfiguration creates an IngressConfiguration from a master Ingress resource.
func NewRegularIngressConfiguration ¶ added in v1.10.0
func NewRegularIngressConfiguration(ing *networking.Ingress) *IngressConfiguration
NewRegularIngressConfiguration creates an IngressConfiguration from an Ingress resource.
func (*IngressConfiguration) AddWarning ¶ added in v1.10.0
func (ic *IngressConfiguration) AddWarning(warning string)
AddWarning adds a warning.
func (*IngressConfiguration) GetKeyWithKind ¶ added in v1.10.0
func (ic *IngressConfiguration) GetKeyWithKind() string
GetKeyWithKind returns the key of the resource with its kind. For example, Ingress/my-namespace/my-name.
func (*IngressConfiguration) GetObjectMeta ¶ added in v1.10.0
func (ic *IngressConfiguration) GetObjectMeta() *metav1.ObjectMeta
GetObjectMeta returns the resource ObjectMeta.
func (*IngressConfiguration) IsEqual ¶ added in v1.10.0
func (ic *IngressConfiguration) IsEqual(resource Resource) bool
IsEqual tests if the IngressConfiguration is equal to the resource.
func (*IngressConfiguration) Wins ¶ added in v1.10.0
func (ic *IngressConfiguration) Wins(resource Resource) bool
Wins tells if this resource wins over the specified resource.
type LoadBalancerController ¶
type LoadBalancerController struct {
// contains filtered or unexported fields
}
LoadBalancerController watches Kubernetes API and reconfigures NGINX via NginxController when needed
func NewLoadBalancerController ¶
func NewLoadBalancerController(input NewLoadBalancerControllerInput) *LoadBalancerController
NewLoadBalancerController creates a controller
func (*LoadBalancerController) AddSyncQueue ¶
func (lbc *LoadBalancerController) AddSyncQueue(item interface{})
AddSyncQueue enqueues the provided item on the sync queue
func (*LoadBalancerController) HasCorrectIngressClass ¶ added in v1.8.0
func (lbc *LoadBalancerController) HasCorrectIngressClass(obj interface{}) bool
HasCorrectIngressClass checks if resource ingress class annotation (if exists) or ingressClass string for VS/VSR is matching with ingress controller class
func (*LoadBalancerController) IsExternalServiceForStatus ¶
func (lbc *LoadBalancerController) IsExternalServiceForStatus(svc *api_v1.Service) bool
IsExternalServiceForStatus matches the service specified by the external-service cli arg
func (*LoadBalancerController) IsExternalServiceKeyForStatus ¶ added in v1.9.0
func (lbc *LoadBalancerController) IsExternalServiceKeyForStatus(key string) bool
IsExternalServiceKeyForStatus matches the service key specified by the external-service cli arg
func (*LoadBalancerController) IsNginxReady ¶ added in v1.8.0
func (lbc *LoadBalancerController) IsNginxReady() bool
IsNginxReady returns ready status of NGINX
func (*LoadBalancerController) Run ¶
func (lbc *LoadBalancerController) Run()
Run starts the loadbalancer controller
func (*LoadBalancerController) Stop ¶
func (lbc *LoadBalancerController) Stop()
Stop shutdowns the load balancer controller
func (*LoadBalancerController) UpdateIngressStatusAndEventsOnDelete ¶ added in v1.9.0
func (lbc *LoadBalancerController) UpdateIngressStatusAndEventsOnDelete(ingConfig *IngressConfiguration, changeError string, deleteErr error)
func (*LoadBalancerController) UpdateVirtualServerStatusAndEventsOnDelete ¶ added in v1.9.0
func (lbc *LoadBalancerController) UpdateVirtualServerStatusAndEventsOnDelete(vsConfig *VirtualServerConfiguration, changeError string, deleteErr error)
type MinionConfiguration ¶ added in v1.10.0
type MinionConfiguration struct { // Ingress is the Ingress behind a minion. Ingress *networking.Ingress // ValidPaths marks the paths of the Ingress as valid (true) or invalid (false). // Minion Ingress resources can have multiple paths. It is possible that some of the paths are taken by other // Minions. In that case, those paths will be marked as invalid. ValidPaths map[string]bool }
MinionConfiguration holds a Minion resource.
func NewMinionConfiguration ¶ added in v1.10.0
func NewMinionConfiguration(ing *networking.Ingress) *MinionConfiguration
NewMinionConfiguration creates a new MinionConfiguration.
type NewLoadBalancerControllerInput ¶
type NewLoadBalancerControllerInput struct { KubeClient kubernetes.Interface ConfClient k8s_nginx.Interface DynClient dynamic.Interface ResyncPeriod time.Duration Namespace string NginxConfigurator *configs.Configurator DefaultServerSecret string AppProtectEnabled bool IsNginxPlus bool IngressClass string UseIngressClassOnly bool ExternalServiceName string IngressLink string ControllerNamespace string ReportIngressStatus bool IsLeaderElectionEnabled bool LeaderElectionLockName string WildcardTLSSecret string ConfigMaps string GlobalConfiguration string AreCustomResourcesEnabled bool EnablePreviewPolicies bool MetricsCollector collectors.ControllerCollector GlobalConfigurationValidator *validation.GlobalConfigurationValidator TransportServerValidator *validation.TransportServerValidator VirtualServerValidator *validation.VirtualServerValidator SpireAgentAddress string InternalRoutesEnabled bool IsPrometheusEnabled bool IsLatencyMetricsEnabled bool IsTLSPassthroughEnabled bool }
NewLoadBalancerControllerInput holds the input needed to call NewLoadBalancerController.
type Operation ¶ added in v1.9.0
type Operation int
Operation defines an operation to perform for a resource.
type Resource ¶ added in v1.9.0
type Resource interface { GetObjectMeta() *metav1.ObjectMeta GetKeyWithKind() string Wins(resource Resource) bool AddWarning(warning string) IsEqual(resource Resource) bool }
Resource represents a configuration resource. A Resource can be a top level configuration object: - Regular or Master Ingress - VirtualServer - TransportServer
type ResourceChange ¶ added in v1.9.0
type ResourceChange struct { // Op is an operation that needs be performed on the resource. Op Operation // Resource is the target resource. Resource Resource // Error is the error associated with the resource. Error string }
ResourceChange represents a change of the resource that needs to be reflected in the NGINX config.
type TransportServerConfiguration ¶ added in v1.11.0
type TransportServerConfiguration struct { ListenerPort int TransportServer *conf_v1alpha1.TransportServer Warnings []string }
TransportServerConfiguration holds a TransportServer resource.
func NewTransportServerConfiguration ¶ added in v1.11.0
func NewTransportServerConfiguration(ts *conf_v1alpha1.TransportServer) *TransportServerConfiguration
NewTransportServerConfiguration creates a new TransportServerConfiguration.
func (*TransportServerConfiguration) AddWarning ¶ added in v1.11.0
func (tsc *TransportServerConfiguration) AddWarning(warning string)
AddWarning adds a warning.
func (*TransportServerConfiguration) GetKeyWithKind ¶ added in v1.11.0
func (tsc *TransportServerConfiguration) GetKeyWithKind() string
GetKeyWithKind returns the key of the resource with its kind. For example, TransportServer/my-namespace/my-name.
func (*TransportServerConfiguration) GetObjectMeta ¶ added in v1.11.0
func (tsc *TransportServerConfiguration) GetObjectMeta() *metav1.ObjectMeta
GetObjectMeta returns the resource ObjectMeta.
func (*TransportServerConfiguration) IsEqual ¶ added in v1.11.0
func (tsc *TransportServerConfiguration) IsEqual(resource Resource) bool
IsEqual tests if the TransportServerConfiguration is equal to the resource.
func (*TransportServerConfiguration) Wins ¶ added in v1.11.0
func (tsc *TransportServerConfiguration) Wins(resource Resource) bool
Wins tells if this resource wins over the specified resource. It is used to determine which resource should win over a host or port.
type VirtualServerConfiguration ¶ added in v1.10.0
type VirtualServerConfiguration struct { VirtualServer *conf_v1.VirtualServer VirtualServerRoutes []*conf_v1.VirtualServerRoute Warnings []string }
VirtualServerConfiguration holds a VirtualServer along with its VirtualServerRoutes.
func NewVirtualServerConfiguration ¶ added in v1.10.0
func NewVirtualServerConfiguration(vs *conf_v1.VirtualServer, vsrs []*conf_v1.VirtualServerRoute, warnings []string) *VirtualServerConfiguration
NewVirtualServerConfiguration creates a VirtualServerConfiguration.
func (*VirtualServerConfiguration) AddWarning ¶ added in v1.10.0
func (vsc *VirtualServerConfiguration) AddWarning(warning string)
AddWarning adds a warning.
func (*VirtualServerConfiguration) GetKeyWithKind ¶ added in v1.10.0
func (vsc *VirtualServerConfiguration) GetKeyWithKind() string
GetKeyWithKind returns the key of the resource with its kind. For example, VirtualServer/my-namespace/my-name.
func (*VirtualServerConfiguration) GetObjectMeta ¶ added in v1.10.0
func (vsc *VirtualServerConfiguration) GetObjectMeta() *metav1.ObjectMeta
GetObjectMeta returns the resource ObjectMeta.
func (*VirtualServerConfiguration) IsEqual ¶ added in v1.10.0
func (vsc *VirtualServerConfiguration) IsEqual(resource Resource) bool
IsEqual tests if the VirtualServerConfiguration is equal to the resource.
func (*VirtualServerConfiguration) Wins ¶ added in v1.10.0
func (vsc *VirtualServerConfiguration) Wins(resource Resource) bool
Wins tells if this resource wins over the specified resource. It is used to determine which resource should win over a host.