Skip to content

Commit

Permalink
pass Run CR's timeout field as env var to the container running test …
Browse files Browse the repository at this point in the history
…suites (#13)

Together with the modification of run-cnf-suites.sh in cnf repo
([PR#1846](redhat-best-practices-for-k8s/certsuite#1846)),
setting Run CR's timeout field as an env var in the container running
the test suites, will allow modifying default timeout to the given.
  • Loading branch information
shirmoran authored Jan 31, 2024
1 parent 36986a6 commit 16ff4b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion controllers/cnf-cert-job/cnfcertjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ type Config struct {
CertSuiteConfigRunName string
LabelsFilter string
LogLevel string
TimeOut string
ConfigMapName string
PreflightSecretName string
SideCarAppImage string
}

func NewConfig(podName, namespace, certSuiteConfigRunName, labelsFilter, logLevel, configMapName, preflightSecretName, sideCarAppImage string) *Config {
func NewConfig(podName, namespace, certSuiteConfigRunName, labelsFilter, logLevel, timeOut, configMapName, preflightSecretName, sideCarAppImage string) *Config {
return &Config{
PodName: podName,
Namespace: namespace,
CertSuiteConfigRunName: certSuiteConfigRunName,
LabelsFilter: labelsFilter,
LogLevel: logLevel,
TimeOut: timeOut,
ConfigMapName: configMapName,
PreflightSecretName: preflightSecretName,
SideCarAppImage: sideCarAppImage,
Expand Down Expand Up @@ -110,6 +112,10 @@ func New(config *Config) *corev1.Pod {
Name: "TNF_NON_INTRUSIVE_ONLY",
Value: "true",
},
{
Name: "TIMEOUT",
Value: config.TimeOut,
},
},
ImagePullPolicy: "Always",
VolumeMounts: []corev1.VolumeMount{
Expand Down
2 changes: 1 addition & 1 deletion controllers/cnfcertificationsuiterun_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ func (r *CnfCertificationSuiteRunReconciler) Reconcile(ctx context.Context, req
logrus.Infof("Reconciling CnfCertificationSuiteRun CRD.")

reqCertificationRun := certificationRun{name: req.Name, namespace: req.Namespace}

var cnfrun cnfcertificationsv1alpha1.CnfCertificationSuiteRun
if getErr := r.Get(ctx, req.NamespacedName, &cnfrun); getErr != nil {
logrus.Infof("CnfCertificationSuiteRun CR %s (ns %s) not found.", req.Name, req.NamespacedName)
Expand Down Expand Up @@ -241,6 +240,7 @@ func (r *CnfCertificationSuiteRunReconciler) Reconcile(ctx context.Context, req
cnfrun.Name,
cnfrun.Spec.LabelsFilter,
cnfrun.Spec.LogLevel,
cnfrun.Spec.TimeOut,
cnfrun.Spec.ConfigMapName,
cnfrun.Spec.PreflightSecretName,
sideCarImage)
Expand Down

0 comments on commit 16ff4b5

Please sign in to comment.