utils

package
v0.0.0-...-5914884 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Copyright Contributors to the Open Cluster Management project.

Index

Constants

View Source
const CurrentAnsibleJob = "active-ansible-job"
View Source
const CurrentCuratorContainer = "curating-with-container"
View Source
const CurrentCuratorJob = "curatorJob"
View Source
const CurrentHiveJob = "hive-provisioning-job"
View Source
const DefaultImageURI = "registry.ci.openshift.org/open-cluster-management/cluster-curator-controller:latest"
View Source
const Destroying = "uninstall"
View Source
const HypershiftClusterType = "hypershift"
View Source
const Installing = "provision"
View Source
const JobFailed = "Job_failed"
View Source
const JobHasFinished = "Job_has_finished"
View Source
const LogVerbosity = 2
View Source
const PauseFiveSeconds = PauseTenSeconds / 2
View Source
const PauseSixtySeconds = 60 * time.Second
View Source
const PauseTenSeconds = PauseTwoSeconds * 5
View Source
const PauseTwoSeconds = 2 * time.Second
View Source
const StandaloneClusterType = "standalone"

Variables

View Source
var CCGVR = schema.GroupVersionResource{
	Group:    "cluster.open-cluster-management.io",
	Version:  "v1beta1",
	Resource: "clustercurators",
}
View Source
var HCGVR = schema.GroupVersionResource{
	Group:    "hypershift.openshift.io",
	Version:  "v1beta1",
	Resource: "hostedclusters",
}
View Source
var NPGVR = schema.GroupVersionResource{
	Group:    "hypershift.openshift.io",
	Version:  "v1beta1",
	Resource: "nodepools",
}

Functions

func CheckError

func CheckError(err error)

Simple error function

func ConvertMap

func ConvertMap(m interface{}) interface{}

Because Unmarshal for map[string]interface{}, uses map[interface{}]interface{} above the root leaf, runtime client does not support it.

func DeleteClusterNamespace

func DeleteClusterNamespace(client kubernetes.Interface, clusterName string) error

func GetClient

func GetClient() (clientv1.Client, error)

func GetClusterCurator

func GetClusterCurator(
	client clientv1.Client,
	clusterName string,
	clusterNamespace string) (*clustercuratorv1.ClusterCurator, error)

func GetClusterType

func GetClusterType(
	hiveset hiveclient.Interface,
	dc dynamic.Interface,
	clusterName string,
	clusterNamespace string,
	isUpgrade bool) (string, error)

func GetCurrentVersionInfo

func GetCurrentVersionInfo(curator *clustercuratorv1.ClusterCurator) string

func GetDynset

func GetDynset(dynset dynamic.Interface) (dynamic.Interface, error)

func GetKubeset

func GetKubeset() (kubernetes.Interface, error)

func GetMonitorAttempts

func GetMonitorAttempts(jobType string, curator *clustercuratorv1.ClusterCurator) int

func GetRetryTimes

func GetRetryTimes(timeout, defaultTimeout int, interval time.Duration) int

func InitKlog

func InitKlog(logLevel int)

func LogError

func LogError(err error) error

func LogWarning

func LogWarning(err error)

func NeedToUpgrade

func NeedToUpgrade(curator clustercuratorv1.ClusterCurator) (bool, error)

func PathSplitterFromEnv

func PathSplitterFromEnv(path string) (namespace string, resource string, err error)

Path splitter NAMSPACE/RESOURCE_NAME

func RecordAnsibleJobStatusUrlCondition

func RecordAnsibleJobStatusUrlCondition(
	client clientv1.Client,
	clusterName string,
	clusterNamespace string,
	containerName string,
	conditionStatus v1.ConditionStatus,
	url string) error

func RecordCuratorJob

func RecordCuratorJob(clusterName, containerName string) error

func RecordCuratorJobName

func RecordCuratorJobName(
	client clientv1.Client,
	clusterName string,
	clusterNamespace string,
	curatorJobName string) error

func RecordCurrentStatusCondition

func RecordCurrentStatusCondition(
	client clientv1.Client,
	clusterName string,
	clusterNamespace string,
	containerName string,
	conditionStatus v1.ConditionStatus,
	message string) error

func RecordFailedCuratorStatusCondition

func RecordFailedCuratorStatusCondition(
	client clientv1.Client,
	clusterName string,
	clusterNamespace string,
	containerName string,
	conditionStatus v1.ConditionStatus,
	message string) error

Types

type PatchStringValue

type PatchStringValue struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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