state

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IngressControllerTypeNone    = "none"
	IngressControllerTypeTraefik = "traefik"
)

Supported Ingress controller types.

View Source
const (
	ResourceKindIngressRoute   = "IngressRoute"
	ResourceKindTraefikService = "TraefikService"
	ResourceKindTLSOption      = "TLSOption"
)

Supported Traefik CRD kinds.

View Source
const AnnotationHubIngressController = "hub.traefik.io/ingress-controller"

AnnotationHubIngressController is the annotation to add to a Deployment/ReplicaSet/StatefulSet/DaemonSet to specify the Ingress controller type.

View Source
const (
	// ControllerTypeTraefik Traefik Ingress Controllers type.
	ControllerTypeTraefik = "traefik.io/ingress-controller"
)

Supported Ingress Controllers. TODO: unify constants with ACP.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessControlPolicy

type AccessControlPolicy struct {
	Name      string                        `json:"name"`
	Namespace string                        `json:"namespace"`
	ClusterID string                        `json:"clusterId"`
	Method    string                        `json:"method"`
	JWT       *AccessControlPolicyJWT       `json:"jwt,omitempty"`
	BasicAuth *AccessControlPolicyBasicAuth `json:"basicAuth,omitempty"`
}

AccessControlPolicy describes an Access Control Policy configured within a cluster.

type AccessControlPolicyBasicAuth

type AccessControlPolicyBasicAuth struct {
	Users                    string `json:"users,omitempty"`
	Realm                    string `json:"realm,omitempty"`
	StripAuthorizationHeader bool   `json:"stripAuthorizationHeader,omitempty"`
	ForwardUsernameHeader    string `json:"forwardUsernameHeader,omitempty"`
}

AccessControlPolicyBasicAuth holds the HTTP basic authentication configuration.

type AccessControlPolicyJWT

type AccessControlPolicyJWT struct {
	SigningSecret              string            `json:"signingSecret,omitempty"`
	SigningSecretBase64Encoded bool              `json:"signingSecretBase64Encoded"`
	PublicKey                  string            `json:"publicKey,omitempty"`
	JWKsFile                   string            `json:"jwksFile,omitempty"`
	JWKsURL                    string            `json:"jwksUrl,omitempty"`
	StripAuthorizationHeader   bool              `json:"stripAuthorizationHeader,omitempty"`
	ForwardHeaders             map[string]string `json:"forwardHeaders,omitempty"`
	TokenQueryKey              string            `json:"tokenQueryKey,omitempty"`
	Claims                     string            `json:"claims,omitempty"`
}

AccessControlPolicyJWT describes the settings for JWT authentication within an access control policy.

type App

type App struct {
	Name          string            `json:"name"`
	Kind          string            `json:"kind"`
	Namespace     string            `json:"namespace"`
	Replicas      int               `json:"replicas"`
	ReadyReplicas int               `json:"readyReplicas"`
	Images        []string          `json:"images,omitempty"`
	Labels        map[string]string `json:"labels,omitempty"`
	// contains filtered or unexported fields
}

App is an abstraction of Deployments/ReplicaSets/DaemonSets/StatefulSets.

type Cluster

type Cluster struct {
	ID                    string
	Overview              Overview
	Namespaces            []string
	Apps                  map[string]*App
	Ingresses             map[string]*Ingress
	IngressRoutes         map[string]*IngressRoute `dir:"Ingresses"`
	Services              map[string]*Service
	IngressControllers    map[string]*IngressController
	AccessControlPolicies map[string]*AccessControlPolicy
	TLSOptions            map[string]*TLSOptions

	TraefikServiceNames map[string]string `dir:"-"`
}

Cluster describes a Cluster.

type Fetcher

type Fetcher struct {
	// contains filtered or unexported fields
}

Fetcher fetches Kubernetes resources and converts them into a filtered and simplified state.

func NewFetcher

func NewFetcher(ctx context.Context, clusterID string) (*Fetcher, error)

NewFetcher creates a new Fetcher.

func (*Fetcher) FetchState

func (f *Fetcher) FetchState() (*Cluster, error)

FetchState assembles a cluster state from Kubernetes resources.

func (*Fetcher) GetServiceLogs

func (f *Fetcher) GetServiceLogs(ctx context.Context, namespace, name string, lines, maxLen int) ([]byte, error)

GetServiceLogs returns the logs from a service.

type Ingress

type Ingress struct {
	ResourceMeta
	IngressMeta

	IngressClassName *string               `json:"ingressClassName,omitempty"`
	TLS              []netv1.IngressTLS    `json:"tls,omitempty"`
	Rules            []netv1.IngressRule   `json:"rules,omitempty"`
	DefaultBackend   *netv1.IngressBackend `json:"defaultBackend,omitempty"`
	Services         []string              `json:"services,omitempty"`
}

Ingress describes an Kubernetes Ingress.

type IngressController

type IngressController struct {
	App

	Type            string   `json:"type"`
	IngressClasses  []string `json:"ingressClasses,omitempty"`
	MetricsURLs     []string `json:"metricsURLs,omitempty"`
	PublicEndpoints []string `json:"publicEndpoints,omitempty"`
	Endpoints       []string `json:"endpoints,omitempty"`
}

IngressController is an abstraction of Deployments/ReplicaSets/DaemonSets/StatefulSets that are a cluster's IngressController.

type IngressMeta

type IngressMeta struct {
	ClusterID      string            `json:"clusterId"`
	ControllerType string            `json:"controllerType,omitempty"`
	Annotations    map[string]string `json:"annotations,omitempty"`
}

IngressMeta represents the common Ingress metadata properties.

type IngressRoute

type IngressRoute struct {
	ResourceMeta
	IngressMeta

	TLS      *IngressRouteTLS `json:"tls,omitempty"`
	Routes   []Route          `json:"routes,omitempty"`
	Services []string         `json:"services,omitempty"`
}

IngressRoute describes a Traefik IngressRoute.

type IngressRouteTLS

type IngressRouteTLS struct {
	Domains    []traefikv1alpha1.Domain `json:"domains,omitempty"`
	SecretName string                   `json:"secretName,omitempty"`
	Options    *TLSOptionRef            `json:"options,omitempty"`
}

IngressRouteTLS represents a simplified Traefik IngressRoute TLS configuration.

type Overview

type Overview struct {
	IngressCount           int      `json:"ingressCount"`
	ServiceCount           int      `json:"serviceCount"`
	IngressControllerTypes []string `json:"ingressControllerTypes"`
}

Overview represents an overview of the cluster resources.

type ResourceMeta

type ResourceMeta struct {
	Kind      string `json:"kind"`
	Group     string `json:"group"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

ResourceMeta represents the metadata which identify a Kubernetes resource.

type Route

type Route struct {
	Match    string         `json:"match"`
	Services []RouteService `json:"services,omitempty"`
}

Route represents a Traefik IngressRoute route.

type RouteService

type RouteService struct {
	Namespace  string `json:"namespace"`
	Name       string `json:"name"`
	PortName   string `json:"portName,omitempty"`
	PortNumber int32  `json:"portNumber,omitempty"`
}

RouteService represents a Kubernetes service targeted by a Traefik IngressRoute route.

type Service

type Service struct {
	Name          string             `json:"name"`
	Namespace     string             `json:"namespace"`
	ClusterID     string             `json:"clusterId"`
	Type          corev1.ServiceType `json:"type"`
	Selector      map[string]string  `json:"selector"`
	Apps          []string           `json:"apps,omitempty"`
	Annotations   map[string]string  `json:"annotations,omitempty"`
	ExternalIPs   []string           `json:"externalIPs,omitempty"`
	ExternalPorts []int              `json:"externalPorts,omitempty"`
	// contains filtered or unexported fields
}

Service describes a Service.

type TLSOptionRef

type TLSOptionRef struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace,omitempty"`
}

TLSOptionRef references TLSOptions.

type TLSOptions

type TLSOptions struct {
	Name                     string                     `json:"name"`
	Namespace                string                     `json:"namespace"`
	MinVersion               string                     `json:"minVersion,omitempty"`
	MaxVersion               string                     `json:"maxVersion,omitempty"`
	CipherSuites             []string                   `json:"cipherSuites,omitempty"`
	CurvePreferences         []string                   `json:"curvePreferences,omitempty"`
	ClientAuth               traefikv1alpha1.ClientAuth `json:"clientAuth"`
	SniStrict                bool                       `json:"sniStrict"`
	PreferServerCipherSuites bool                       `json:"preferServerCipherSuites"`
}

TLSOptions holds TLS options.

Jump to

Keyboard shortcuts

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