util

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNodeIPOrName

func GetNodeIPOrName(ctx context.Context, kubeClient clientset.Interface, name string) string

GetNodeIPOrName returns the IP address or the name of a node in the cluster

func MakeLogger added in v1.3.2

func MakeLogger(level string, formatter string) (logrus.FieldLogger, error)

func ParseNameNS

func ParseNameNS(input string) (string, string, error)

ParseNameNS parses a string searching a namespace and name

func ServerHasGVK

func ServerHasGVK(client discovery.ServerResourcesInterface, groupVersion, kind string) (bool, error)

ServerHasGVK returns true iff the Kubernetes API server supports the given resource kind at the given group-version.

func ValidateProtocol

func ValidateProtocol(protocol string) bool

ValidateProtocol returns a bool of whether string is a valid protocol

Types

type ConfigDumpMode

type ConfigDumpMode int
const (
	ConfigDumpModeOff       ConfigDumpMode = iota
	ConfigDumpModeEnabled   ConfigDumpMode = iota
	ConfigDumpModeSensitive ConfigDumpMode = iota
)

func ParseConfigDumpMode

func ParseConfigDumpMode(in string) (ConfigDumpMode, error)

type EnablementStatus added in v1.3.2

type EnablementStatus int

EnablementStatus can be 'enabled', 'disabled' or 'auto'.

const (
	// EnablementStatusDisabled says that the resource it controls is disabled.
	EnablementStatusDisabled EnablementStatus = iota
	// EnablementStatusEnabled says that the resource it controls is enabled.
	EnablementStatusEnabled EnablementStatus = iota
	// EnablementStatusAuto says that whether the resource it controls is enabled
	// or disabled should be decided upon by automation.
	EnablementStatusAuto EnablementStatus = iota
)

func (*EnablementStatus) Set added in v1.3.2

func (e *EnablementStatus) Set(s string) error

Set sets the value of the EnablementStatus to match the provided string value.

func (*EnablementStatus) String added in v1.3.2

func (e *EnablementStatus) String() string

String converts EnablementStatus to a lowercase word.

func (*EnablementStatus) Type added in v1.3.2

func (e *EnablementStatus) Type() string

type Endpoint

type Endpoint struct {
	// Address IP address of the endpoint
	Address string `json:"address"`
	// Port number of the TCP port
	Port string `json:"port"`
}

Endpoint describes a kubernetes endpoint, same as a target in Kong.

type ForeignRelations

type ForeignRelations struct {
	Consumer, Route, Service []string
}

func (*ForeignRelations) GetCombinations

func (relations *ForeignRelations) GetCombinations() []Rel

type Info

type Info struct {
	KubernetesVersion string
	KongVersion       string
	KICVersion        string
	Hostname          string
	KongDB            string
	ID                string
}

Info holds the metadata to be sent as part of a report.

type IngressAPI

type IngressAPI int
const (
	OtherAPI          IngressAPI = iota
	NetworkingV1      IngressAPI = iota
	NetworkingV1beta1 IngressAPI = iota
	ExtensionsV1beta1 IngressAPI = iota
)

func NegotiateResourceAPI

func NegotiateResourceAPI(client discovery.ServerResourcesInterface, kind string, allowedVersions []IngressAPI,
) (IngressAPI, error)

func (IngressAPI) String

func (ia IngressAPI) String() string

type K8sObjectInfo

type K8sObjectInfo struct {
	Name        string
	Namespace   string
	Annotations map[string]string
}

K8sObjectInfo describes a Kubernetes object.

func FromK8sObject

func FromK8sObject(obj metav1.Object) K8sObjectInfo

type PluginSchemaStore

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

PluginSchemaStore retrives a schema of a Plugin from Kong.

func NewPluginSchemaStore

func NewPluginSchemaStore(client *kong.Client) *PluginSchemaStore

NewPluginSchemaStore creates a PluginSchemaStore.

func (*PluginSchemaStore) Schema

func (p *PluginSchemaStore) Schema(ctx context.Context, pluginName string) (map[string]interface{}, error)

Schema retrives schema of a plugin. A cache is used to save the responses and subsequent queries are served from the cache.

type PodInfo

type PodInfo struct {
	Name      string
	Namespace string
	NodeIP    string
	// Labels selectors of the running pod
	// This is used to search for other Ingress controller pods
	Labels map[string]string
}

PodInfo contains runtime information about the pod running the Ingres controller

func GetPodDetails

func GetPodDetails(ctx context.Context, kubeClient clientset.Interface) (*PodInfo, error)

GetPodDetails returns runtime information about the pod: name, namespace and IP of the node where it is running

type RawSSLCert

type RawSSLCert struct {
	Cert []byte
	Key  []byte
}

RawSSLCert represnts TLS cert and key in bytes

type Rel

type Rel struct {
	Consumer, Route, Service string
}

type Reporter

type Reporter struct {
	Info Info

	Logger logrus.FieldLogger
	// contains filtered or unexported fields
}

Reporter sends anonymous reports of runtime properties and errors in Kong.

func (Reporter) Run

func (r Reporter) Run(done <-chan struct{})

Run starts the reporter. It will send reports until done is closed.

type SecretGetterFromK8s added in v1.3.2

type SecretGetterFromK8s struct {
	Reader client.Reader
}

SecretGetterFromK8s is a SecretGetter that reads secrets from Kubernetes API.

func (*SecretGetterFromK8s) GetSecret added in v1.3.2

func (s *SecretGetterFromK8s) GetSecret(namespace string, name string) (*corev1.Secret, error)

GetSecret reads a core v1 Secret from Kubernetes API.

Jump to

Keyboard shortcuts

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