Skip to content

Commit

Permalink
Add CRI Name to testmachinery metadata (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
dguendisch authored Jul 29, 2021
1 parent c25737e commit 44f6e3e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
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
}

0 comments on commit 44f6e3e

Please sign in to comment.