helper

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminUserExists added in v1.3.10

func AdminUserExists(ctx context.Context, harborClient *h.RESTClient) (bool, error)

AdminUserExists checks whether the preconfigured 'admin' user already exists and returns accordingly. The user ID of the administrator account is fixed to '1'.

func BoolToString

func BoolToString(b bool) string

BoolToString returns a string depending on the given boolean value.

func CreateSpecHash

func CreateSpecHash(spec *helmclient.ChartSpec) (string, error)

CreateSpecHash returns a hash string constructed with the helm chart spec.

func GetValueFromSecret

func GetValueFromSecret(sec *corev1.Secret, key string) (string, error)

GetValueFromSecret returns a specific value of a secret key.

func InstanceToChartSpec

func InstanceToChartSpec(ctx context.Context, c client.Client, instance *v1alpha2.Instance) (*helmclient.ChartSpec, error)

func NewRandomPassword

func NewRandomPassword(passwordStrength int32) (string, error)

NewRandomPassword returns a random secret string with a given length.

func ObjExists

func ObjExists(ctx context.Context, cl client.Client, name, namespace string, obj client.Object) (bool, error)

ObjExists returns a boolean value based on the existence of a runtime object.

func ToHarborRegistry

func ToHarborRegistry(spec v1alpha2.RegistrySpec, id int64, credential *model.RegistryCredential) *model.Registry

ToHarborRegistry returns a Harbor registry constructed from the provided spec.

func ToHarborRegistryCredential

func ToHarborRegistryCredential(ctx context.Context, c client.Client, namespace string, cred v1alpha2.RegistryCredential) (*model.RegistryCredential, error)

Types

type InterfaceHash

type InterfaceHash []byte

func GenerateHashFromInterfaces

func GenerateHashFromInterfaces(interfaces []interface{}) (InterfaceHash, error)

GenerateHashFromInterfaces returns a hash sum based on a slice of given interfaces.

func (*InterfaceHash) Short

func (hash *InterfaceHash) Short() string

Short returns the first 8 characters of an interface hash.

func (*InterfaceHash) String

func (hash *InterfaceHash) String() string

String returns the string value of an interface hash.

type JSONPatch

type JSONPatch struct {
	Ops []jsonPatchOp
}

func (*JSONPatch) AddOp

func (p *JSONPatch) AddOp(op, path string, value interface{})

func (*JSONPatch) Data

func (p *JSONPatch) Data(obj runtime.Object) ([]byte, error)

func (*JSONPatch) Type

func (p *JSONPatch) Type() types.PatchType

Jump to

Keyboard shortcuts

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