Documentation ¶
Overview ¶
Package utils provides generic utility routines used within OSM.
Index ¶
- func ExternalAuthConfigFromMeshConfig(mc v1alpha2.MeshConfig) auth.ExtAuthConfig
- func GetCertKeyBitSize(mc v1alpha2.MeshConfig) int
- func GetEnv(envVar string, defaultValue string) string
- func GetEnvoyImage(mc v1alpha2.MeshConfig) string
- func GetEnvoyWindowsImage(mc v1alpha2.MeshConfig) string
- func GetIPFromContext(ctx context.Context) net.Addr
- func GetIngressGatewayCertValidityPeriod(mc v1alpha2.MeshConfig) time.Duration
- func GetInitContainerImage(mc v1alpha2.MeshConfig) string
- func GetLastChunkOfSlashed(s string) string
- func GetServiceCertValidityPeriod(mc v1alpha2.MeshConfig) time.Duration
- func GetTracingEndpoint(mc v1alpha2.MeshConfig) string
- func GetTracingHost(mc v1alpha2.MeshConfig) string
- func GetTracingPort(mc v1alpha2.MeshConfig) uint32
- func HashFromString(s string) (uint64, error)
- func MeshConfigToJSON(mc v1alpha2.MeshConfig) (string, error)
- func PrettyJSON(js []byte, prefix string) ([]byte, error)
- func ProtoToYAML(m protoreflect.ProtoMessage) ([]byte, error)
- func SvcAccountToK8sSvcAccount(svcAccount *corev1.ServiceAccount) identity.K8sServiceAccount
- func YAMLToProto(configYAML []byte, message protoreflect.ProtoMessage) error
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.