Documentation
¶
Index ¶
- Constants
- func BuildCapabilityProviderConfig(imagesByName ArchsByImage) *runtime.RawExtension
- func CompletedRun(phase argov1.WorkflowPhase) bool
- func CompletedStep(phase argov1.NodePhase) bool
- func ContainsCloudprovider(cloudproviders []common.CloudProvider, cloudprovider common.CloudProvider) bool
- func ConvertStringArrayToVersions(versions []string) []gardencorev1beta1.ExpirableVersion
- func ConvertStringToVersion(v string) gardencorev1beta1.ExpirableVersion
- func CreateKubeconfigFromInternal() ([]byte, error)
- func DecMinorVersion(v *semver.Version) (*semver.Version, error)
- func DocExists(log logr.Logger, esClient elasticsearch.Client, ...) (docExists bool)
- func DomainMatches(s string, domains ...string) bool
- func DownloadFile(client *http.Client, url string) ([]byte, error)
- func FilterExpiredMachineImageVersions(versions []gardencorev1beta1.MachineImageVersion) []gardencorev1beta1.MachineImageVersion
- func FilterExpiredVersions(versions []gardencorev1beta1.ExpirableVersion) []gardencorev1beta1.ExpirableVersion
- func FilterInPlaceMachineImageVersions(versions []gardencorev1beta1.MachineImageVersion) []gardencorev1beta1.MachineImageVersion
- func FilterMachineImageVersionsByArch(cloudprofile gardencorev1beta1.CloudProfile, imageName string, ...) []gardencorev1beta1.MachineImageVersion
- func FilterPatchVersions(cloudProfileVersions []gardencorev1beta1.ExpirableVersion) ([]gardencorev1beta1.ExpirableVersion, error)
- func FormatArtifactName(name string) string
- func GetCloudProfile(k8sClient client.Client, ...) (gardencorev1beta1.CloudProfile, error)
- func GetCloudProfileFromCluster(k8sClient client.Client, profileName string) (gardencorev1beta1.CloudProfile, error)
- func GetCloudProfileFromMap(cloudProfiles map[string]gardencorev1beta1.CloudProfile, profileName string) (gardencorev1beta1.CloudProfile, error)
- func GetClusterDomainURL(tmClient client.Client) (string, error)
- func GetGitHubClient(apiURL, username, password, uploadURL string, skipTLS bool) (*github.Client, error)
- func GetHTTPClient(username, password string, skipTLS bool) *http.Client
- func GetK8sVersions(cloudprofile gardencorev1beta1.CloudProfile, ...) ([]gardencorev1beta1.ExpirableVersion, error)
- func GetLatestK8sVersion(cloudprofile gardencorev1beta1.CloudProfile) (gardencorev1beta1.ExpirableVersion, error)
- func GetLatestMachineImageVersion(cloudprofile gardencorev1beta1.CloudProfile, imageName, arch string, ...) (gardencorev1beta1.MachineImageVersion, error)
- func GetLatestPreviousVersionForInPlaceUpdate(cloudprofile gardencorev1beta1.CloudProfile, ...) (string, error)
- func GetLatestVersion(rawVersions []gardencorev1beta1.ExpirableVersion) (gardencorev1beta1.ExpirableVersion, error)
- func GetLatestVersionFromConstraint(versions []*semver.Version, constraintString string) (*semver.Version, error)
- func GetMachineImage(cloudprofile gardencorev1beta1.CloudProfile, imageName string) (gardencorev1beta1.MachineImage, error)
- func GetMachineImageVersion(cloudprofile gardencorev1beta1.CloudProfile, worker *gardencorev1beta1.Worker) (gardencorev1beta1.MachineImageVersion, error)
- func GetPreviousKubernetesVersions(cloudprofile gardencorev1beta1.CloudProfile, ...) (gardencorev1beta1.ExpirableVersion, gardencorev1beta1.ExpirableVersion, error)
- func GetXMajorsBeforeLatestMachineImageVersion(cloudprofile gardencorev1beta1.CloudProfile, imageName, arch string, x uint64, ...) (gardencorev1beta1.MachineImageVersion, error)
- func GetXMinorsBeforeLatestK8sVersion(cloudprofile gardencorev1beta1.CloudProfile, x uint64) (*string, error)
- func Getenv(key, defaultValue string) string
- func GetenvBool(key string, defaultValue bool) bool
- func HasLabel(obj metav1.ObjectMeta, label string) bool
- func IsAnnotationSubset(src, target map[string]string) bool
- func IsLastElementOfBucket(value, bucketSize int) bool
- func IsSystemStep(step *tmv1beta1.StepStatus) bool
- func JSONPath(data interface{}, path string) (interface{}, error)
- func MarshalMap(annotations map[string]string) string
- func MarshalNoHTMLEscape(v interface{}) ([]byte, error)
- func MaxTimeExceeded(startTime time.Time, maxWaitTime int64) bool
- func OrderStepsStatus(steps []*tmv1beta1.StepStatus)
- func ParseRepoURL(url *url.URL) (repoOwner, repoName string, err error)
- func ParseRepoURLFromString(repoURL string) (repoOwner, repoName string, err error)
- func ParseTestDef(data []byte) (tmv1beta1.TestDefinition, error)
- func PrettyPrintStruct(obj interface{}) string
- func RandomString(n int) string
- func RawJSONPath(content []byte, path string, dest interface{}) ([]byte, error)
- func ReadLines(document []byte) <-chan []byte
- func RenderTableForSlack(log logr.Logger, items TableItems) (string, error)
- func ResumeTestrun(ctx context.Context, k8sClient client.Client, tr *tmv1beta1.Testrun) error
- func ReturnMultiError(err error) error
- func SetMetaDataLabel(obj *metav1.ObjectMeta, label string, value string)
- func SplitString(text string, size int) []string
- func StringArrayContains(ar []string, elem string) bool
- func StringDefault(value, def string) string
- func TestrunProgress(tr *tmv1beta1.Testrun) string
- func TestrunStatusPhase(tr *tmv1beta1.Testrun) argov1alpha1.WorkflowPhase
- func UnmarshalMap(cfg string) (map[string]string, error)
- func Unzip(archive, target string) error
- func WorkflowPhase(wf *argov1.Workflow) argov1.WorkflowPhase
- func Zipit(source, target string) error
- type AdvancedWaitGroup
- type ArchsByImage
- type ArchsByVersion
- type ESHits
- type ItemMeta
- type StatusSymbol
- type TableItem
- type TableItems
Constants ¶
const SymbolOffset = " "
SymbolOffset is the offset that the symbol is prefixed for better readability
Variables ¶
This section is empty.
Functions ¶
func BuildCapabilityProviderConfig ¶
func BuildCapabilityProviderConfig(imagesByName ArchsByImage) *runtime.RawExtension
BuildCapabilityProviderConfig builds a *runtime.RawExtension carrying machine-image architecture data in the capability-flavor format. It is exposed for cross-package tests that need to populate cloudprofile.Spec.ProviderConfig in the schema this package consumes.
One capability flavor is emitted per version, listing all archs.
This helper is test-only: it asserts via Gomega that JSON marshaling succeeds, so it must be called from within a Ginkgo spec.
func CompletedRun ¶
func CompletedRun(phase argov1.WorkflowPhase) bool
CompletedRun checks if the testrun is in a completed phase
func CompletedStep ¶
CompletedStep checks if the teststep is in a completed phase
func ContainsCloudprovider ¶
func ContainsCloudprovider(cloudproviders []common.CloudProvider, cloudprovider common.CloudProvider) bool
ContainsCloudprovider checks whether a cloudprovier is part of an array of cloudproviders
func ConvertStringArrayToVersions ¶
func ConvertStringArrayToVersions(versions []string) []gardencorev1beta1.ExpirableVersion
ConvertStringArrayToVersions converts a string array of versions to gardener experable versions
func ConvertStringToVersion ¶
func ConvertStringToVersion(v string) gardencorev1beta1.ExpirableVersion
ConvertStringToVersion converts a string to gardener experable versions
func CreateKubeconfigFromInternal ¶
CreateKubeconfigFromClient creates a new kubeocnfig file from a resclient config
func DecMinorVersion ¶
DecMinorVersion decreases the minor version of 1 and sets the patch version to 0.
func DocExists ¶
func DocExists(log logr.Logger, esClient elasticsearch.Client, testrunID, testrunStartTime string) (docExists bool)
DocExists checks whether an elasticsearch doc of a testrun exists in the testmachinery-* index
func DomainMatches ¶
DomainMatches returns true if one of the given domains or subdomains match.
func DownloadFile ¶
DownloadFile downloads a file from the given url and return the content.
func FilterExpiredMachineImageVersions ¶
func FilterExpiredMachineImageVersions(versions []gardencorev1beta1.MachineImageVersion) []gardencorev1beta1.MachineImageVersion
FilterExpiredMachineImageVersions removes all expired versions from the list.
func FilterExpiredVersions ¶
func FilterExpiredVersions(versions []gardencorev1beta1.ExpirableVersion) []gardencorev1beta1.ExpirableVersion
FilterExpiredVersions removes all expired versions from the list.
func FilterInPlaceMachineImageVersions ¶
func FilterInPlaceMachineImageVersions(versions []gardencorev1beta1.MachineImageVersion) []gardencorev1beta1.MachineImageVersion
FilterInPlaceMachineImageVersions filters the machine image versions to only include those that support in-place updates.
func FilterMachineImageVersionsByArch ¶
func FilterMachineImageVersionsByArch(cloudprofile gardencorev1beta1.CloudProfile, imageName string, versions []gardencorev1beta1.MachineImageVersion, architecture string) []gardencorev1beta1.MachineImageVersion
FilterMachineImageVersionsByArch returns versions of imageName that support the given architecture, based on cloudprofile.Spec.ProviderConfig. If cloudprofile.Spec.MachineCapabilities defines "architecture" with exactly one value, every version is considered to support that single arch and the providerConfig is not consulted.
func FilterPatchVersions ¶
func FilterPatchVersions(cloudProfileVersions []gardencorev1beta1.ExpirableVersion) ([]gardencorev1beta1.ExpirableVersion, error)
FilterPatchVersions keeps only versions with newest patch versions. E.g. 1.15.1, 1.14.4, 1.14.3, will result in 1.15.1, 1.14.4
func FormatArtifactName ¶
FormatArtifactName replaces all invalid artifact name characters. It replaces everything that is not an alphan-numeric character or "-" with a "-".
func GetCloudProfile ¶
func GetCloudProfile(k8sClient client.Client, cloudProfiles map[string]gardencorev1beta1.CloudProfile, profileName string) (gardencorev1beta1.CloudProfile, error)
GetCloudProfile returns the cloudprofile
func GetCloudProfileFromCluster ¶
func GetCloudProfileFromCluster(k8sClient client.Client, profileName string) (gardencorev1beta1.CloudProfile, error)
func GetCloudProfileFromMap ¶
func GetCloudProfileFromMap(cloudProfiles map[string]gardencorev1beta1.CloudProfile, profileName string) (gardencorev1beta1.CloudProfile, error)
func GetClusterDomainURL ¶
GetClusterDomainURL tries to derive the cluster domain url from a plutono ingress if possible. Returns an error if the ingress cannot be found or is in unexpected form.
func GetGitHubClient ¶
func GetGitHubClient(apiURL, username, password, uploadURL string, skipTLS bool) (*github.Client, error)
GetGitHubClient returns a new github enterprise client with basic auth and optional tls verification
func GetHTTPClient ¶
GetHTTPClient returns a new http client with basic auth and optional tls verification
func GetK8sVersions ¶
func GetK8sVersions(cloudprofile gardencorev1beta1.CloudProfile, config common.ShootKubernetesVersionFlavor, filterPatchVersions bool) ([]gardencorev1beta1.ExpirableVersion, error)
GetK8sVersions returns all K8s version that should be rendered by the chart
func GetLatestK8sVersion ¶
func GetLatestK8sVersion(cloudprofile gardencorev1beta1.CloudProfile) (gardencorev1beta1.ExpirableVersion, error)
GetLatestK8sVersion returns the latest available kubernetes version from the cloudprofile
func GetLatestMachineImageVersion ¶
func GetLatestMachineImageVersion(cloudprofile gardencorev1beta1.CloudProfile, imageName, arch string, inPlace bool) (gardencorev1beta1.MachineImageVersion, error)
GetLatestMachineImageVersion returns the latest available machine image version from the cloudprofile
func GetLatestPreviousVersionForInPlaceUpdate ¶
func GetLatestPreviousVersionForInPlaceUpdate(cloudprofile gardencorev1beta1.CloudProfile, currentMachineImage gardencorev1beta1.ShootMachineImage, arch string) (string, error)
GetLatestPreviousVersionForInPlaceUpdate determines the latest previous machine image version that supports in-place updates to the current version. It filters the machine image versions based on architecture, expiration, and in-place update compatibility, and ensures the version satisfies the minimum version requirement for in-place updates.
func GetLatestVersion ¶
func GetLatestVersion(rawVersions []gardencorev1beta1.ExpirableVersion) (gardencorev1beta1.ExpirableVersion, error)
GetLatestVersion returns the latest image from a list of expirable versions
func GetLatestVersionFromConstraint ¶
func GetLatestVersionFromConstraint(versions []*semver.Version, constraintString string) (*semver.Version, error)
GetLatestVersionFromConstraint returns the latest version that matches a constraint
func GetMachineImage ¶
func GetMachineImage(cloudprofile gardencorev1beta1.CloudProfile, imageName string) (gardencorev1beta1.MachineImage, error)
func GetMachineImageVersion ¶
func GetMachineImageVersion(cloudprofile gardencorev1beta1.CloudProfile, worker *gardencorev1beta1.Worker) (gardencorev1beta1.MachineImageVersion, error)
GetMachineImageVersion returns a version identified by a pattern or defaults to the version string handed over
func GetPreviousKubernetesVersions ¶
func GetPreviousKubernetesVersions(cloudprofile gardencorev1beta1.CloudProfile, currentVersion gardencorev1beta1.ExpirableVersion) (gardencorev1beta1.ExpirableVersion, gardencorev1beta1.ExpirableVersion, error)
GetPreviousKubernetesVersions returns the 2 latest previous minor patch versions.
func GetXMajorsBeforeLatestMachineImageVersion ¶
func GetXMajorsBeforeLatestMachineImageVersion(cloudprofile gardencorev1beta1.CloudProfile, imageName, arch string, x uint64, inPlace bool) (gardencorev1beta1.MachineImageVersion, error)
GetXMajorsBeforeLatestMachineImageVersion extracts the latest-x major version from a list of relevant versions found in a cloudprofile
func GetXMinorsBeforeLatestK8sVersion ¶
func GetXMinorsBeforeLatestK8sVersion(cloudprofile gardencorev1beta1.CloudProfile, x uint64) (*string, error)
GetXMinorsBeforeLatestK8sVersion returns a version with the minor decreased by x from the latest major.minor version and the patch being a wildcard "*", returns an error if minor would become negative.
func Getenv ¶
Getenv returns the string value of the environment variable with the provided key if the env var exists. Otherwise, the default value is returned
func GetenvBool ¶
GetenvBool returns the boolean value of the environment variable with the provided key if the env var exists and can be parsed. Otherwise, the default value is returned
func HasLabel ¶
func HasLabel(obj metav1.ObjectMeta, label string) bool
HasLabel returns a bool if passed in label exists
func IsAnnotationSubset ¶
IsAnnotationSubset checks if all items in target are deep equal in src with the same key
func IsLastElementOfBucket ¶
IsIsEndOfBucket returns if the current value is the last integer value of its bucket Examples (bucket size: 3): 0: false 1: false 2: true 3: false 5: true
func IsSystemStep ¶
func IsSystemStep(step *tmv1beta1.StepStatus) bool
func MarshalMap ¶
MarshalMap encodes the given map into a string similar to kubectl --selectors: map '{a:b,c:d}' becomes string 'a=b,c=d'
func MarshalNoHTMLEscape ¶
MarshalNoHTMLEscape is nearly same as json.Marshal but does NOT HTLM-escape <, > or & However it does add a newline char at the end (as done by json.Encoder.Encode)
func MaxTimeExceeded ¶
MaxTimeExceeded checks if the max time is exceeded.
func OrderStepsStatus ¶
func OrderStepsStatus(steps []*tmv1beta1.StepStatus)
OrderStepsStatus orders a list of step status of a testrun
func ParseRepoURL ¶
ParseRepoURL returns the repository owner and name of a github repo url
func ParseRepoURLFromString ¶
ParseRepoURLFromString returns the repository owner and name of a github repo url
func ParseTestDef ¶
func ParseTestDef(data []byte) (tmv1beta1.TestDefinition, error)
ParseTestDef parses a file into a TestDefinition.
func PrettyPrintStruct ¶
func PrettyPrintStruct(obj interface{}) string
PrettyPrintStruct returns an obj as pretty printed yaml.
func RandomString ¶
RandomString generates a random string out of "abcdefghijklmnopqrstuvwxyz1234567890" with a given length.RandomString The generated string is compatible to k8s name conventions
func ReadLines ¶
ReadLines reads a byte array line by line ('\n' or '\r\n'); and return the content without the line end.
func RenderTableForSlack ¶
func RenderTableForSlack(log logr.Logger, items TableItems) (string, error)
RenderTableForSlack renders a string table of given table items
func ResumeTestrun ¶
Resume testruns resumes a testrun by adding the appropriate annotation to it
func ReturnMultiError ¶
ReturnMultiError takes an err object and returns a multierror with a custom format.
func SetMetaDataLabel ¶
func SetMetaDataLabel(obj *metav1.ObjectMeta, label string, value string)
SetMetaDataLabel sets the label and value
func SplitString ¶
SplitString splits a string into byte slices of the given length. Tt will try to split only on newlines.
func StringArrayContains ¶
StringArrayContains checks if a string array contains the string elem
func StringDefault ¶
StringDefault checks if a string is defined. If the value is empty the default string is returned
func TestrunProgress ¶
TestrunProgress returns the progress of a testrun
func TestrunStatusPhase ¶
func TestrunStatusPhase(tr *tmv1beta1.Testrun) argov1alpha1.WorkflowPhase
TestrunStatusPhase determines the real testrun phase of a testrun by ignoring exit handler failures and system component failures if all other tests passed.
func UnmarshalMap ¶
UnmarshalMap does the opposite of MarshalMap. It decodes the given string into a map, return an error if the string is not in the expected format 'key1=value1,key2=value2'
func WorkflowPhase ¶
func WorkflowPhase(wf *argov1.Workflow) argov1.WorkflowPhase
WorkflowPhase calculates the phase for a completed workflow. In contrast to the argo status, we need to also consider continueOn steps as failures.
Types ¶
type AdvancedWaitGroup ¶
type AdvancedWaitGroup struct {
// contains filtered or unexported fields
}
AdvancedWaitGroup implements the same interface as sync.WaitGroup. In addition a wait can be canceled during runtime when using the WaitWithCancel function
func (*AdvancedWaitGroup) Add ¶
func (wg *AdvancedWaitGroup) Add(delta int)
Add adds delta to the wait counter. delta may be negative but the counter cannot be less then 0.
func (*AdvancedWaitGroup) Done ¶
func (wg *AdvancedWaitGroup) Done()
Done removes one element from the wait counter
func (*AdvancedWaitGroup) Lock ¶
func (*AdvancedWaitGroup) Lock()
Lock is a no-op used by -copylocks checker from `go vet`.
func (*AdvancedWaitGroup) Wait ¶
func (wg *AdvancedWaitGroup) Wait()
Wait waits until the counter is 0
func (*AdvancedWaitGroup) WaitWithCancelFunc ¶
func (wg *AdvancedWaitGroup) WaitWithCancelFunc(cancel func() bool)
WaitWithCancelFunc waits until the wait group count is zero or the cancel function returns true
type ArchsByImage ¶
type ArchsByImage = map[string]ArchsByVersion
ArchsByImage maps a machine-image name to its per-version architectures.
type ArchsByVersion ¶
ArchsByVersion maps a machine-image version to its supported architectures.
type ESHits ¶
type ESHits struct {
Hits struct {
Total struct {
Value int `json:"value"`
} `json:"total"`
} `json:"hits"`
}
type StatusSymbol ¶
type StatusSymbol string
StatusSymbol is a unicode symbol for displaying in a table
const ( StatusSymbolSuccess StatusSymbol = "✅" StatusSymbolFailure StatusSymbol = "❌" StatusSymbolNA StatusSymbol = "N/A" StatusSymbolError StatusSymbol = "🔥" StatusSymbolUnknown StatusSymbol = "❓" )
type TableItem ¶
type TableItem struct {
Meta ItemMeta
StatusSymbol StatusSymbol
}
type TableItems ¶
type TableItems []*TableItem