Skip to content

Commit da008eb

Browse files
Merge pull request openstack-k8s-operators#204 from ashu-011/horizontest_debug_mode
Add debug mode for Horizontest
2 parents 8d8bbfb + 88403b3 commit da008eb

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

api/bases/test.openstack.org_horizontests.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ spec:
7070
dashboardUrl:
7171
description: DashboardUrl is the URL of the Horizon dashboard.
7272
type: string
73+
debug:
74+
default: false
75+
description: Activate debug mode. When debug mode is activated any
76+
error encountered inside the test-pod causes that the pod will be
77+
kept alive indefinitely (stuck in "Running" phase) or until the
78+
corresponding HorizonTest CR is deleted. This allows the user to
79+
debug any potential troubles with `oc rsh`.
80+
type: boolean
7381
extraConfigmapsMounts:
7482
description: Extra configmaps for mounting inside the pod
7583
items:

api/v1beta1/horizontest_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ import (
2828
type HorizonTestSpec struct {
2929
CommonOptions `json:",inline"`
3030

31+
// +kubebuilder:validation:Optional
32+
// +kubebuilder:default=false
33+
// Activate debug mode. When debug mode is activated any error encountered
34+
// inside the test-pod causes that the pod will be kept alive indefinitely
35+
// (stuck in "Running" phase) or until the corresponding HorizonTest CR is deleted.
36+
// This allows the user to debug any potential troubles with `oc rsh`.
37+
Debug bool `json:"debug"`
38+
3139
// AdminUsername is the username for the OpenStack admin user.
3240
// +kubebuilder:validation:Required
3341
// +operator-sdk:csv:customresourcedefinitions:type=spec

config/crd/bases/test.openstack.org_horizontests.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ spec:
7070
dashboardUrl:
7171
description: DashboardUrl is the URL of the Horizon dashboard.
7272
type: string
73+
debug:
74+
default: false
75+
description: Activate debug mode. When debug mode is activated any
76+
error encountered inside the test-pod causes that the pod will be
77+
kept alive indefinitely (stuck in "Running" phase) or until the
78+
corresponding HorizonTest CR is deleted. This allows the user to
79+
debug any potential troubles with `oc rsh`.
80+
type: boolean
7381
extraConfigmapsMounts:
7482
description: Extra configmaps for mounting inside the pod
7583
items:

config/samples/test_v1beta1_horizontest.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ metadata:
1010
name: horizontest-sample
1111
spec:
1212
containerImage: ""
13+
# debug: false
1314

1415
# OpenStack admin credentials
1516
adminUsername: "admin"

controllers/horizontest_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ func (r *HorizonTestReconciler) PrepareHorizonTestEnvVars(
352352
envVars["PASSWORD"] = env.SetValue("horizontest")
353353
envVars["FLAVOR_NAME"] = env.SetValue("m1.tiny")
354354
envVars["HORIZON_KEYS_FOLDER"] = env.SetValue("/etc/test_operator")
355+
envVars["HORIZONTEST_DEBUG_MODE"] = env.SetValue(r.GetDefaultBool(instance.Spec.Debug))
355356

356357
return envVars
357358
}

0 commit comments

Comments
 (0)