utils

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MPL-2.0 Imports: 16 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 *gwv1beta1.Gateway) map[string]string

func NamespacedName

func NamespacedName(o client.Object) types.NamespacedName

func ProtocolToConsul

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

func ReferencesGateway

func ReferencesGateway(namespace string, ref gwv1alpha2.ParentReference) (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
}

K8sSecret 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