Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CRI Name to testmachinery metadata #360

Merged
merged 1 commit into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ const (
// AnnotationCloudProvider is the annotation to specify the cloudprovider the testrun is testing
AnnotationCloudProvider = "metadata.testmachinery.gardener.cloud/cloudprovider"

// AnnotationContainerRuntime is the annotation to specify the container runtime of the shoot nodes the testrun is testing
AnnotationContainerRuntime = "metadata.testmachinery.gardener.cloud/container-runtime"

// AnnotationOperatingSystem is the annotation to specify the operating system of the shoot nodes the testrun is testing
AnnotationOperatingSystem = "metadata.testmachinery.gardener.cloud/operating-system"

Expand Down
3 changes: 3 additions & 0 deletions pkg/testmachinery/collector/precompute.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ func PreComputeTeststepFields(phase argov1.NodePhase, meta metadata.Metadata, cl
if meta.AllowPrivilegedContainers != nil && !*meta.AllowPrivilegedContainers {
providerEnhanced += "(NoPrivCtrs)"
}
if meta.ContainerRuntime != "" {
providerEnhanced += fmt.Sprintf("{%s}", meta.ContainerRuntime)
}
preComputed.ProviderEnhanced = providerEnhanced

return &preComputed
Expand Down
2 changes: 2 additions & 0 deletions pkg/testmachinery/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func (m *Metadata) CreateAnnotations() map[string]string {
common.AnnotationCloudProvider: m.CloudProvider,
common.AnnotationOperatingSystem: m.OperatingSystem,
common.AnnotationOperatingSystemVersion: m.OperatingSystemVersion,
common.AnnotationContainerRuntime: m.ContainerRuntime,
common.AnnotationRegion: m.Region,
common.AnnotationZone: m.Zone,
common.AnnotationFlavorDescription: m.FlavorDescription,
Expand Down Expand Up @@ -77,6 +78,7 @@ func FromTestrun(tr *tmv1beta1.Testrun) *Metadata {
CloudProvider: tr.Annotations[common.AnnotationCloudProvider],
OperatingSystem: tr.Annotations[common.AnnotationOperatingSystem],
OperatingSystemVersion: tr.Annotations[common.AnnotationOperatingSystemVersion],
ContainerRuntime: tr.Annotations[common.AnnotationContainerRuntime],
Region: tr.Annotations[common.AnnotationRegion],
Zone: tr.Annotations[common.AnnotationZone],
FlavorDescription: tr.Annotations[common.AnnotationFlavorDescription],
Expand Down
1 change: 1 addition & 0 deletions pkg/testmachinery/metadata/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Metadata struct {
// todo: schrodit - add support to better persist multiple worker pools with multiple oss, versions and zones
OperatingSystem string `json:"operating_system,omitempty"`
OperatingSystemVersion string `json:"operating_system_version,omitempty"`
ContainerRuntime string `json:"container_runtime,omitempty"`
Zone string `json:"zone,omitempty"`
AllowPrivilegedContainers *bool `json:"allow_privileged_containers,omitempty"`
ShootAnnotations map[string]string `json:"shoot_annotations,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions pkg/testrunner/template/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func (r *shootValueRenderer) GetMetadata(shoot *common.ExtendedShoot) (*metadata
AllowPrivilegedContainers: shoot.AllowPrivilegedContainers,
OperatingSystem: shoot.Workers[0].Machine.Image.Name, // todo: check if there a possible multiple workerpools with different images
OperatingSystemVersion: operatingsystemversion,
ContainerRuntime: string(shoot.Workers[0].CRI.Name),
Annotations: shoot.AdditionalAnnotations,
}, nil
}