utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	K8sSecretScheme = "k8s"
)
View Source
const (
	ManagedLabel = "api-gateway.consul.hashicorp.com/managed"
)

Variables

View Source
var (
	ErrNotK8sSecret     = errors.New("not a kubernetes secret")
	ErrInvalidK8sSecret = errors.New("invalid kubernetes secret")
)

Functions

func GatewayByLabels

func GatewayByLabels(object client.Object) types.NamespacedName

func IsManagedGateway

func IsManagedGateway(labels map[string]string) (string, bool)

func LabelsForGateway

func LabelsForGateway(gw *gateway.Gateway) map[string]string

func NamespacedName

func NamespacedName(o client.Object) types.NamespacedName

func ProtocolToConsul

func ProtocolToConsul(protocolType gateway.ProtocolType) (proto string, tls bool)

func ReferencesGateway

func ReferencesGateway(namespace string, ref gw.ParentRef) (types.NamespacedName, bool)

func ResourceVersionGreater

func ResourceVersionGreater(a, b string) bool

func WriteSecretCertFile

func WriteSecretCertFile(restConfig *rest.Config, secret, file, namespace string) error

WriteSecretCertFile retrieves a consul CA file stored in a K8s secret

Types

type K8sSecret

type K8sSecret struct {
	Namespace string
	Name      string
}

KK8sSecret is a wrapper to a Kubernetes certificate secret

func NewK8sSecret

func NewK8sSecret(namespace, name string) K8sSecret

NewK8sSecret returns an K8sSecret object

func ParseK8sSecret

func ParseK8sSecret(encoded string) (K8sSecret, error)

ParseK8sSecret parses an encoded kubernetes secret. If the encoded secret is not a Kubernetes secret or it can't be parsed, it returns an error.

func (K8sSecret) String

func (k K8sSecret) String() string

String returns a kubernetes secret encoded as a string

Jump to

Keyboard shortcuts

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