utils

package
v0.0.0-...-4b75dde Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package utils provides generic utility routines used within OSM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExternalAuthConfigFromMeshConfig

func ExternalAuthConfigFromMeshConfig(mc v1alpha2.MeshConfig) auth.ExtAuthConfig

ExternalAuthConfigFromMeshConfig returns the External Authentication configuration for incoming traffic, if any

func GetCertKeyBitSize

func GetCertKeyBitSize(mc v1alpha2.MeshConfig) int

GetCertKeyBitSize returns the certificate key bit size to be used

func GetEnv

func GetEnv(envVar string, defaultValue string) string

GetEnv is a convenience wrapper for os.Getenv() with additional default value return when empty or unset

func GetEnvoyImage

func GetEnvoyImage(mc v1alpha2.MeshConfig) string

GetEnvoyImage returns the envoy image

func GetEnvoyWindowsImage

func GetEnvoyWindowsImage(mc v1alpha2.MeshConfig) string

GetEnvoyWindowsImage returns the envoy windows image

func GetIPFromContext

func GetIPFromContext(ctx context.Context) net.Addr

GetIPFromContext obtains the IP address of the caller from the context.

func GetIngressGatewayCertValidityPeriod

func GetIngressGatewayCertValidityPeriod(mc v1alpha2.MeshConfig) time.Duration

GetIngressGatewayCertValidityPeriod returns the validity duration for ingress gateway certificates, and a default in case of unspecified or invalid duration

func GetInitContainerImage

func GetInitContainerImage(mc v1alpha2.MeshConfig) string

GetInitContainerImage returns the init container image

func GetLastChunkOfSlashed

func GetLastChunkOfSlashed(s string) string

GetLastChunkOfSlashed splits a string by slash and returns the last chunk.

func GetServiceCertValidityPeriod

func GetServiceCertValidityPeriod(mc v1alpha2.MeshConfig) time.Duration

GetServiceCertValidityPeriod returns the validity duration for service certificates, and a default in case of invalid duration

func GetTracingEndpoint

func GetTracingEndpoint(mc v1alpha2.MeshConfig) string

GetTracingEndpoint returns the listener's collector endpoint

func GetTracingHost

func GetTracingHost(mc v1alpha2.MeshConfig) string

GetTracingHost is the host to which we send tracing spans

func GetTracingPort

func GetTracingPort(mc v1alpha2.MeshConfig) uint32

GetTracingPort returns the tracing listener port

func HashFromString

func HashFromString(s string) (uint64, error)

HashFromString calculates an FNV-1 hash from a given string, returns it as a uint64 and error, if any

func MeshConfigToJSON

func MeshConfigToJSON(mc v1alpha2.MeshConfig) (string, error)

MeshConfigToJSON returns the MeshConfig in pretty JSON.

func PrettyJSON

func PrettyJSON(js []byte, prefix string) ([]byte, error)

PrettyJSON Unmarshals and Marshall again with Indent so it is human readable

func ProtoToYAML

func ProtoToYAML(m protoreflect.ProtoMessage) ([]byte, error)

ProtoToYAML converts a Proto message to it's YAML representation in bytes

func SvcAccountToK8sSvcAccount

func SvcAccountToK8sSvcAccount(svcAccount *corev1.ServiceAccount) identity.K8sServiceAccount

SvcAccountToK8sSvcAccount converts a Kubernetes service to a MeshService.

func YAMLToProto

func YAMLToProto(configYAML []byte, message protoreflect.ProtoMessage) error

YAMLToProto converts yaml to the provided proto message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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