util

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendConfigMapFromSourceIfMissing

func AppendConfigMapFromSourceIfMissing(envFroms []corev1.EnvFromSource, envFrom corev1.EnvFromSource) []corev1.EnvFromSource

func AppendContainerIfMissing

func AppendContainerIfMissing(containers []corev1.Container, container corev1.Container) []corev1.Container

func AppendEnvIfMissing

func AppendEnvIfMissing(envs []corev1.EnvVar, env corev1.EnvVar) []corev1.EnvVar

func AppendEnvIfMissingOverrideIfPresent

func AppendEnvIfMissingOverrideIfPresent(envs []corev1.EnvVar, env corev1.EnvVar) []corev1.EnvVar

func AppendImagePullSecretIfMissing

func AppendImagePullSecretIfMissing(imagePullSecrets []corev1.LocalObjectReference, imagePullSecret corev1.LocalObjectReference) []corev1.LocalObjectReference

func AppendPullSecretIfMissing

func AppendPullSecretIfMissing(pullSecrets []corev1.LocalObjectReference, pullSecret string) []corev1.LocalObjectReference

func AppendStringIfMissing

func AppendStringIfMissing(array []string, newEle string) []string

func AppendVolumeIfMissing

func AppendVolumeIfMissing(volumes []corev1.Volume, volume corev1.Volume) []corev1.Volume

func AppendVolumeMountIfMissing

func AppendVolumeMountIfMissing(volumeMounts []corev1.VolumeMount, volumeMount corev1.VolumeMount) []corev1.VolumeMount

func AppendVolumeMountWithSubPathIfMissing

func AppendVolumeMountWithSubPathIfMissing(volumeMounts []corev1.VolumeMount, volumeMount corev1.VolumeMount) []corev1.VolumeMount

func Base64ToBytes

func Base64ToBytes(base64str string) ([]byte, error)

func BytesToBase64

func BytesToBase64(b []byte) string

func CheckIfZoneOrRegionUpdated

func CheckIfZoneOrRegionUpdated(oldValue string, newValue string) bool

func ContainsValue

func ContainsValue(find string, in []string) bool

func ConvertSpec

func ConvertSpec(in interface{}, out interface{}) error

func ConvertToJsonMessage

func ConvertToJsonMessage(in interface{}) (*json.RawMessage, error)

func ConvertYamlFileToJson

func ConvertYamlFileToJson(file string) ([]byte, error)

func EnsureDir

func EnsureDir(dirName string) error

func EnvExists

func EnvExists(envs []corev1.EnvVar, key string) bool

func FileExists

func FileExists(path string) bool

func FileToBytes

func FileToBytes(file string) ([]byte, error)

func FindStringInArray

func FindStringInArray(str string, slice []string) bool

func GenerateRandomString

func GenerateRandomString(length int) string

func GetCRDFromFile

func GetCRDFromFile(file string) (*extv1.CustomResourceDefinition, error)

func GetCertificateFromPEMBytes

func GetCertificateFromPEMBytes(bytes []byte) (*x509.Certificate, error)

func GetClusterRoleBindingFromFile

func GetClusterRoleBindingFromFile(file string) (*rbacv1.ClusterRoleBinding, error)

func GetClusterRoleFromFile

func GetClusterRoleFromFile(file string) (*rbacv1.ClusterRole, error)

func GetConfigMapFromFile

func GetConfigMapFromFile(file string) (*corev1.ConfigMap, error)

func GetContainerFromFile

func GetContainerFromFile(file string) (*corev1.Container, error)

func GetDeploymentFromFile

func GetDeploymentFromFile(file string) (*appsv1.Deployment, error)

func GetEnvValue

func GetEnvValue(envs []corev1.EnvVar, key string) string

func GetIngressFromFile

func GetIngressFromFile(file string) (*networkingv1.Ingress, error)

func GetIngressv1beta1FromFile

func GetIngressv1beta1FromFile(file string) (*networkingv1beta1.Ingress, error)

func GetNetworkPolicyFromFile

func GetNetworkPolicyFromFile(file string) (*networkingv1.NetworkPolicy, error)

func GetPVCFromFile

func GetPVCFromFile(file string) (*corev1.PersistentVolumeClaim, error)

func GetPodFromFile

func GetPodFromFile(file string) (*corev1.Pod, error)

func GetRegion

func GetRegion(client Client) string

func GetResourcePatch

func GetResourcePatch(current, new *corev1.ResourceRequirements) (*corev1.ResourceRequirements, error)

func GetResourceVerFromSecret

func GetResourceVerFromSecret(client Client, name, namespace string) (string, error)

func GetRoleBindingFromFile

func GetRoleBindingFromFile(file string) (*rbacv1.RoleBinding, error)

func GetRoleFromFile

func GetRoleFromFile(file string) (*rbacv1.Role, error)

func GetRouteFromFile

func GetRouteFromFile(file string) (*routev1.Route, error)

func GetSecretFromFile

func GetSecretFromFile(file string) (*corev1.Secret, error)

func GetServerVersion

func GetServerVersion() (*version.Info, error)

func GetServiceAccountFromFile

func GetServiceAccountFromFile(file string) (*corev1.ServiceAccount, error)

func GetServiceFromFile

func GetServiceFromFile(file string) (*corev1.Service, error)

func GetZone

func GetZone(client Client) string

func HealthCheck

func HealthCheck(healthURL string, cert []byte, timeout time.Duration) error

func HealthCheck(caURL *url.URL, cert []byte) error {

func IgnoreAlreadyExistError

func IgnoreAlreadyExistError(err error) error

func IgnoreOutdatedResourceVersion

func IgnoreOutdatedResourceVersion(err error) error

Ignore benign error

func IntermediateSecretExists

func IntermediateSecretExists(client Client, namespace, secretName string) bool

func IsSecretEcert

func IsSecretEcert(secretName string) bool

func IsSecretTLSCert

func IsSecretTLSCert(secretName string) bool

func IsTCPReachable

func IsTCPReachable(url string) bool

func JoinMaps

func JoinMaps(m1, m2 map[string][]byte) map[string][]byte

func PemStringToBytes

func PemStringToBytes(pem string) []byte

func ReplaceEnvIfDiff

func ReplaceEnvIfDiff(envs []corev1.EnvVar, key, replace string) ([]corev1.EnvVar, bool)

func SelectRandomValue

func SelectRandomValue(values []string) string

func UpdateEnvVar

func UpdateEnvVar(name string, value string, envs []corev1.EnvVar) []corev1.EnvVar

func ValidateHSMProxyURL

func ValidateHSMProxyURL(endpoint string) error

func ValidateRegion

func ValidateRegion(client Client, requestedRegion string) error

func ValidateZone

func ValidateZone(client Client, requestedZone string) error

func ValidationChecks

func ValidationChecks(typedata metav1.TypeMeta, metadata metav1.ObjectMeta, expectedKind string, maxNameLength *int) error

func WriteFile

func WriteFile(file string, buf []byte, perm os.FileMode) error

Types

type Client

type Client interface {
	Get(ctx context.Context, namespacedName types.NamespacedName, obj k8sclient.Object) error
	List(ctx context.Context, list k8sclient.ObjectList, opts ...k8sclient.ListOption) error
}

Directories

Path Synopsis
* Copyright contributors to the Hyperledger Fabric Operator project * * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
* Copyright contributors to the Hyperledger Fabric Operator project * * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.

Jump to

Keyboard shortcuts

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