Skip to content
Draft
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
10 changes: 10 additions & 0 deletions api/bases/test.openstack.org_ansibletests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,11 @@ spec:
description: OpenStackConfigSecret is the name of the Secret containing
the secure.yaml
type: string
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
privileged:
default: false
description: |-
Expand Down Expand Up @@ -1110,6 +1115,11 @@ spec:
description: OpenStackConfigSecret is the name of the Secret
containing the secure.yaml
type: string
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
privileged:
description: |-
Use with caution! This parameter specifies whether test-operator should spawn test
Expand Down
5 changes: 5 additions & 0 deletions api/bases/test.openstack.org_horizontests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,11 @@ spec:
default: false
description: Parallel
type: boolean
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
privileged:
default: false
description: |-
Expand Down
10 changes: 10 additions & 0 deletions api/bases/test.openstack.org_tempests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,11 @@ spec:
instances of test-operator related CRs exist. If you want to turn off this
behaviour then set this option to true.
type: boolean
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
privileged:
default: false
description: |-
Expand Down Expand Up @@ -1451,6 +1456,11 @@ spec:
instances of test-operator related CRs exist. If you want to turn off this
behaviour then set this option to true.
type: boolean
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
privileged:
description: |-
Use with caution! This parameter specifies whether test-operator should spawn test
Expand Down
10 changes: 10 additions & 0 deletions api/bases/test.openstack.org_tobikoes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,11 @@ spec:
format: uri
type: string
type: object
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
preventCreate:
default: false
description: Boolean specifying whether tobiko tests create new resources
Expand Down Expand Up @@ -1144,6 +1149,11 @@ spec:
format: uri
type: string
type: object
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
preventCreate:
description: Boolean specifying whether tobiko tests create
new resources or re-use those previously created
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/ansibletest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ func (instance *AnsibleTest) GetConditions() *condition.Conditions {
return &instance.Status.Conditions
}

// GetPendingTimeout - return the pending timeout
func (instance *AnsibleTest) GetPendingTimeout() int {
return instance.Spec.PendingTimeout
}

// GetStorageClass - return the storage class name
func (instance *AnsibleTest) GetStorageClass() string {
return instance.Spec.StorageClass
Expand Down
12 changes: 12 additions & 0 deletions api/v1beta1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ type CommonOptions struct {
// ExtraMounts containing conf files, credentials and storage volumes
ExtraMounts []ExtraVolMounts `json:"extraMounts,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Optional
// Timeout after which a test pod in the Pending state is considered
// stuck and its execution is terminated.
PendingTimeout int `json:"pendingTimeout"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// This value contains a nodeSelector value that is applied to test pods
Expand Down Expand Up @@ -186,6 +192,12 @@ type WorkflowCommonOptions struct {
// Please use ExtraMounts parameter instead!
ExtraConfigmapsMounts *[]ExtraConfigmapsMounts `json:"extraConfigmapsMounts,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Optional
// Timeout after which a test pod in the Pending state is considered
// stuck and its execution is terminated.
PendingTimeout *int `json:"pendingTimeout,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// This value contains a nodeSelector value that is applied to test pods
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/horizontest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ func (instance *HorizonTest) GetConditions() *condition.Conditions {
return &instance.Status.Conditions
}

// GetPendingTimeout - return the pending timeout
func (instance *HorizonTest) GetPendingTimeout() int {
return instance.Spec.PendingTimeout
}

// GetStorageClass - return the storage class name
func (instance *HorizonTest) GetStorageClass() string {
return instance.Spec.StorageClass
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/tempest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,11 @@ func (instance *Tempest) GetConditions() *condition.Conditions {
return &instance.Status.Conditions
}

// GetPendingTimeout - return the pending timeout
func (instance *Tempest) GetPendingTimeout() int {
return instance.Spec.PendingTimeout
}

// GetStorageClass - return the storage class name
func (instance *Tempest) GetStorageClass() string {
return instance.Spec.StorageClass
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/tobiko_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ func (instance *Tobiko) GetConditions() *condition.Conditions {
return &instance.Status.Conditions
}

// GetPendingTimeout - return the pending timeout
func (instance *Tobiko) GetPendingTimeout() int {
return instance.Spec.PendingTimeout
}

// GetStorageClass - return the storage class name
func (instance *Tobiko) GetStorageClass() string {
return instance.Spec.StorageClass
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions config/crd/bases/test.openstack.org_ansibletests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,11 @@ spec:
description: OpenStackConfigSecret is the name of the Secret containing
the secure.yaml
type: string
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
privileged:
default: false
description: |-
Expand Down Expand Up @@ -1110,6 +1115,11 @@ spec:
description: OpenStackConfigSecret is the name of the Secret
containing the secure.yaml
type: string
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
privileged:
description: |-
Use with caution! This parameter specifies whether test-operator should spawn test
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/test.openstack.org_horizontests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,11 @@ spec:
default: false
description: Parallel
type: boolean
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
privileged:
default: false
description: |-
Expand Down
10 changes: 10 additions & 0 deletions config/crd/bases/test.openstack.org_tempests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,11 @@ spec:
instances of test-operator related CRs exist. If you want to turn off this
behaviour then set this option to true.
type: boolean
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
privileged:
default: false
description: |-
Expand Down Expand Up @@ -1451,6 +1456,11 @@ spec:
instances of test-operator related CRs exist. If you want to turn off this
behaviour then set this option to true.
type: boolean
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
privileged:
description: |-
Use with caution! This parameter specifies whether test-operator should spawn test
Expand Down
10 changes: 10 additions & 0 deletions config/crd/bases/test.openstack.org_tobikoes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,11 @@ spec:
format: uri
type: string
type: object
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
preventCreate:
default: false
description: Boolean specifying whether tobiko tests create new resources
Expand Down Expand Up @@ -1144,6 +1149,11 @@ spec:
format: uri
type: string
type: object
pendingTimeout:
description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
type: integer
preventCreate:
description: Boolean specifying whether tobiko tests create
new resources or re-use those previously created
Expand Down
35 changes: 35 additions & 0 deletions config/manifests/bases/test-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ spec:
secure.yaml
displayName: Open Stack Config Secret
path: openStackConfigSecret
- description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
displayName: Pending Timeout
path: pendingTimeout
- description: |-
Use with caution! This parameter specifies whether test-operator should spawn
test pods with allowedPrivilegedEscalation: true, readOnlyRootFilesystem: false,
Expand Down Expand Up @@ -209,6 +214,11 @@ spec:
secure.yaml
displayName: Open Stack Config Secret
path: workflow[0].openStackConfigSecret
- description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
displayName: Pending Timeout
path: workflow[0].pendingTimeout
- description: |-
Use with caution! This parameter specifies whether test-operator should spawn test
pods with allowedPrivilegedEscalation: true and the default capabilities on
Expand Down Expand Up @@ -337,6 +347,11 @@ spec:
- description: Parallel
displayName: Parallel
path: parallel
- description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
displayName: Pending Timeout
path: pendingTimeout
- description: |-
Use with caution! This parameter specifies whether test-operator should spawn
test pods with allowedPrivilegedEscalation: true, readOnlyRootFilesystem: false,
Expand Down Expand Up @@ -461,6 +476,11 @@ spec:
behaviour then set this option to true.
displayName: Parallel
path: parallel
- description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
displayName: Pending Timeout
path: pendingTimeout
- description: |-
Use with caution! This parameter specifies whether test-operator should spawn
test pods with allowedPrivilegedEscalation: true, readOnlyRootFilesystem: false,
Expand Down Expand Up @@ -777,6 +797,11 @@ spec:
behaviour then set this option to true.
displayName: Parallel
path: workflow[0].parallel
- description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
displayName: Pending Timeout
path: workflow[0].pendingTimeout
- description: |-
Use with caution! This parameter specifies whether test-operator should spawn test
pods with allowedPrivilegedEscalation: true and the default capabilities on
Expand Down Expand Up @@ -1108,6 +1133,11 @@ spec:
- description: Optional patch to apply to the Tobiko repository.
displayName: Patch
path: patch
- description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
displayName: Pending Timeout
path: pendingTimeout
- description: Boolean specifying whether tobiko tests create new resources
or re-use those previously created
displayName: Prevent Create
Expand Down Expand Up @@ -1221,6 +1251,11 @@ spec:
- description: Optional patch to apply to the Tobiko repository for this step.
displayName: Patch
path: workflow[0].patch
- description: |-
Timeout after which a test pod in the Pending state is considered
stuck and its execution is terminated.
displayName: Pending Timeout
path: workflow[0].pendingTimeout
- description: Boolean specifying whether tobiko tests create new resources
or re-use those previously created
displayName: Prevent Create
Expand Down
12 changes: 12 additions & 0 deletions internal/controller/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const (
workflowStepLabel = "workflowStep"
instanceNameLabel = "instanceName"
operatorNameLabel = "operator"
pendingTimeoutAnnotation = "test.openstack.org/pending-timeout"
testOperatorLockName = "test-operator-lock"
testOperatorLockOwnerField = "owner"
testOperatorBaseDir = "/etc/test_operator/"
Expand All @@ -59,6 +60,8 @@ const (
InfoWaitingOnPod = "Waiting on either pod to finish or release of the lock."
// InfoPendingPod is the info message when waiting for a pending pod to start
InfoPendingPod = "Waiting for pending pod to start running."
// InfoPendingPodTimeout is the info message when a pending pod exceeds its timeout
InfoPendingPodTimeout = "Pod exceeded pending timeout."
// InfoTestingCompleted is the info message when all testing is completed
InfoTestingCompleted = "Testing completed. All pods spawned by the test-operator finished."
// InfoCreatingFirstPod is the info message when creating the first test pod
Expand Down Expand Up @@ -204,6 +207,15 @@ func (r *Reconciler) NextAction(
return Failure, workflowStepIdx, err
}

// if the last pod has exceeded pending timeout
if lastPod.Annotations[pendingTimeoutAnnotation] == "true" {
if !isLastPodIndex(workflowStepIdx, workflowLength) {
workflowStepIdx++
return CreateNextPod, workflowStepIdx, nil
}
return EndTesting, workflowStepIdx, nil
}

switch lastPod.Status.Phase {
case corev1.PodPending:
// If the last pod is in Pending state -> CheckPending
Expand Down
Loading