util

package
v1.1.2-rc5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: Apache-2.0 Imports: 23 Imported by: 23

Documentation

Index

Constants

View Source
const (
	RemovedPVCsAnnotationKey       = prefix + "/removedPersistentVolumeClaims"
	AdditionalCASecretName         = "harvester-additional-ca"
	AdditionalCAFileName           = "additional-ca.pem"
	AnnotationMigrationTarget      = prefix + "/migrationTargetNodeName"
	AnnotationMigrationUID         = prefix + "/migrationUID"
	AnnotationMigrationState       = prefix + "/migrationState"
	AnnotationTimestamp            = prefix + "/timestamp"
	AnnotationVolumeClaimTemplates = prefix + "/volumeClaimTemplates"
	AnnotationImageID              = prefix + "/imageId"
	AnnotationReservedMemory       = prefix + "/reservedMemory"
	AnnotationHash                 = prefix + "/hash"
	AnnotationRunStrategy          = prefix + "/vmRunStrategy"
	LabelImageDisplayName          = prefix + "/imageDisplayName"

	AnnotationStorageClassName          = prefix + "/storageClassName"
	AnnotationStorageProvisioner        = prefix + "/storageProvisioner"
	AnnotationIsDefaultStorageClassName = "storageclass.kubernetes.io/is-default-class"

	AnnotationDefaultUserdataSecret = prefix + "/default-userdata-secret"

	ContainerdRegistrySecretName = "harvester-containerd-registry"
	ContainerdRegistryFileName   = "registries.yaml"

	BackupTargetSecretName            = "harvester-backup-target-secret"
	InternalTLSSecretName             = "tls-rancher-internal"
	Rke2IngressNginxAppName           = "rke2-ingress-nginx"
	CattleSystemNamespaceName         = "cattle-system"
	LonghornSystemNamespaceName       = "longhorn-system"
	LonghornDefaultManagerURL         = "http://longhorn-backend.longhorn-system:9500/v1"
	KubeSystemNamespace               = "kube-system"
	FleetLocalNamespaceName           = "fleet-local"
	LocalClusterName                  = "local"
	HarvesterSystemNamespaceName      = "harvester-system"
	RancherLoggingName                = "rancher-logging"
	CattleLoggingSystemNamespaceName  = "cattle-logging-system"
	HarvesterUpgradeImageRepository   = "rancher/harvester-upgrade"
	HarvesterLonghornStorageClassName = "harvester-longhorn"

	HTTPProxyEnv  = "HTTP_PROXY"
	HTTPSProxyEnv = "HTTPS_PROXY"
	NoProxyEnv    = "NO_PROXY"

	LonghornOptionBackingImageName = "backingImage"
	LonghornOptionMigratable       = "migratable"
	AddonValuesAnnotation          = "harvesterhci.io/addon-defaults"

	LabelUpgradeReadMessage          = prefix + "/read-message"
	LabelUpgradeState                = prefix + "/upgradeState"
	UpgradeStateLoggingInfraPrepared = "LoggingInfraPrepared"

	AnnotationArchiveName         = prefix + "/archiveName"
	LabelUpgradeLog               = prefix + "/upgradeLog"
	LabelUpgradeLogComponent      = prefix + "/upgradeLogComponent"
	UpgradeLogInfraComponent      = "infra"
	UpgradeLogShipperComponent    = "shipper"
	UpgradeLogAggregatorComponent = "aggregator"
	UpgradeLogDownloaderComponent = "downloader"
	UpgradeLogFlowComponent       = "clusterflow"
	UpgradeLogArchiveComponent    = "log-archive"
	UpgradeLogOperatorComponent   = "operator"
	UpgradeLogOutputComponent     = "clusteroutput"
	UpgradeLogPackagerComponent   = "packager"
)
View Source
const (
	AnnStorageProvisioner     = "volume.kubernetes.io/storage-provisioner"
	AnnBetaStorageProvisioner = "volume.beta.kubernetes.io/storage-provisioner"
)
View Source
const (
	StatusReasonStillExists metav1.StatusReason = "StillExists"
)

Variables

View Source
var (
	PersistentVolumeClaimsKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "PersistentVolumeClaim"}
)

Functions

func AddBuiltInNoProxy added in v1.0.0

func AddBuiltInNoProxy(noProxy string) string

func AddFinalizer added in v1.1.2

func AddFinalizer(obj metav1.Object, finalizer string)

func ContainsFinalizer added in v1.1.2

func ContainsFinalizer(obj metav1.Object, finalizer string) bool

func EncodePrivateKeyToPEM

func EncodePrivateKeyToPEM(privateKey *rsa.PrivateKey) []byte

EncodePrivateKeyToPEM encodes Private Key from RSA to PEM format

func EncodeVars added in v1.1.2

func EncodeVars(vars map[string]string) map[string]string

func GeneratePrivateKey

func GeneratePrivateKey(bitSize int) (*rsa.PrivateKey, error)

GeneratePrivateKey creates a RSA Private Key of specified byte size

func GeneratePublicKey

func GeneratePublicKey(publicKey *rsa.PublicKey) ([]byte, error)

GeneratePublicKey take a rsa.PublicKey and return bytes suitable for writing to .pub file returns in the format "ssh-rsa ..."

func GetBackingImageName added in v1.1.0

func GetBackingImageName(image *harvesterv1.VirtualMachineImage) string

func GetImageDefaultStorageClassParameters added in v1.1.0

func GetImageDefaultStorageClassParameters() map[string]string

func GetImageStorageClassName added in v1.1.0

func GetImageStorageClassName(imageName string) string

func GetImageStorageClassParameters added in v1.1.0

func GetImageStorageClassParameters(image *harvesterv1.VirtualMachineImage) map[string]string

func GetProvisionedPVCProvisioner added in v1.1.0

func GetProvisionedPVCProvisioner(pvc *corev1.PersistentVolumeClaim) string

GetProvisionedPVCProvisioner do not use this function when the PVC is just created

func IsRetriableNetworkError added in v1.1.2

func IsRetriableNetworkError(err error) bool

func IsStillExists added in v1.0.1

func IsStillExists(err error) bool

func NewStillExists added in v1.0.1

func NewStillExists(qualifiedResource schema.GroupResource, name string) *apierrors.StatusError

func RemoveFinalizer added in v1.1.2

func RemoveFinalizer(obj metav1.Object, finalizer string)

func ResponseBody

func ResponseBody(obj interface{}) []byte

func ResponseError

func ResponseError(rw http.ResponseWriter, statusCode int, err error)

func ResponseErrorMsg

func ResponseErrorMsg(rw http.ResponseWriter, statusCode int, errMsg string)

func ResponseOK

func ResponseOK(rw http.ResponseWriter)

func ResponseOKWithBody

func ResponseOKWithBody(rw http.ResponseWriter, obj interface{})

func VirtClientUpdateVmi

func VirtClientUpdateVmi(ctx context.Context, client rest.Interface, managementNamespace, namespace, name string, obj runtime.Object) error

Types

type HTTPProxyConfig added in v1.0.0

type HTTPProxyConfig struct {
	HTTPProxy  string `json:"httpProxy,omitempty"`
	HTTPSProxy string `json:"httpsProxy,omitempty"`
	NoProxy    string `json:"noProxy,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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