Skip to content

Commit feeba2e

Browse files
authored
Reorganize repository (#337)
* Reorganize repository Move workloads to their own folder Signed-off-by: Raul Sevilla <rsevilla@redhat.com> * Rename commmon to clusterhealth Signed-off-by: Raul Sevilla <rsevilla@redhat.com> * Rename import Signed-off-by: Raul Sevilla <rsevilla@redhat.com> --------- Signed-off-by: Raul Sevilla <rsevilla@redhat.com>
1 parent 6db1542 commit feeba2e

28 files changed

+75
-71
lines changed

cmd/ocp.go

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import (
2121
"time"
2222

2323
uid "github.com/google/uuid"
24-
ocp "github.com/kube-burner/kube-burner-ocp"
24+
"github.com/kube-burner/kube-burner-ocp/pkg/clusterhealth"
25+
ocpWorkloads "github.com/kube-burner/kube-burner-ocp/pkg/workloads"
2526
"github.com/kube-burner/kube-burner/pkg/config"
2627
"github.com/kube-burner/kube-burner/pkg/util"
2728
"github.com/kube-burner/kube-burner/pkg/workloads"
@@ -83,14 +84,14 @@ func openShiftCmd() *cobra.Command {
8384
util.SetupFileLogging("ocp-" + workloadConfig.UUID)
8485
}
8586
if cmd.Name() != "cluster-health" && cmd.Name() != "index" {
86-
ocp.ClusterHealthCheck(ignoreHealthCheck)
87+
clusterhealth.ClusterHealthCheck(ignoreHealthCheck)
8788
}
8889
kubeClientProvider := config.NewKubeClientProvider("", "")
8990
workloadDir := filepath.Join(rootDir, cmd.Name())
9091
wh = workloads.NewWorkloadHelper(workloadConfig, &ocpConfig, workloadDir, metricsProfilesDir, alertsDir, scriptsDir, kubeClientProvider)
9192

9293
// Set common variables that all workloads can use
93-
ocp.AdditionalVars = map[string]any{
94+
ocpWorkloads.AdditionalVars = map[string]any{
9495
"UUID": workloadConfig.UUID,
9596
"QPS": QPS,
9697
"BURST": burst,
@@ -99,52 +100,52 @@ func openShiftCmd() *cobra.Command {
99100
"LOCAL_INDEXING": localIndexing,
100101
}
101102
if alerting {
102-
ocp.AdditionalVars["ALERTS"] = "alerts.yml"
103+
ocpWorkloads.AdditionalVars["ALERTS"] = "alerts.yml"
103104
} else {
104-
ocp.AdditionalVars["ALERTS"] = ""
105+
ocpWorkloads.AdditionalVars["ALERTS"] = ""
105106
}
106107
if workloadConfig.MetricsEndpoint == "" {
107-
ocp.AdditionalVars["ES_SERVER"] = esServer
108-
ocp.AdditionalVars["ES_INDEX"] = esIndex
108+
ocpWorkloads.AdditionalVars["ES_SERVER"] = esServer
109+
ocpWorkloads.AdditionalVars["ES_INDEX"] = esIndex
109110
}
110111

111-
if err := ocp.GatherMetadata(&wh, alerting); err != nil {
112+
if err := ocpWorkloads.GatherMetadata(&wh, alerting); err != nil {
112113
log.Fatal(err.Error())
113114
}
114115
}
115116
ocpCmd.AddCommand(
116-
ocp.NewClusterDensity(&wh, "cluster-density-v2"),
117-
ocp.NewClusterDensity(&wh, "cluster-density-ms"),
118-
ocp.NewCrdScale(&wh),
119-
ocp.NewUdnBgp(&wh, "udn-bgp"),
120-
ocp.NewNetworkPolicy(&wh, "network-policy"),
121-
ocp.NewOLMv1(&wh, "olm"),
122-
ocp.NewNodeDensity(&wh, "node-density"),
123-
ocp.NewNodeDensity(&wh, "node-density-heavy"),
124-
ocp.NewNodeDensity(&wh, "node-density-cni"),
125-
ocp.NewNodeScale(&wh, "node-scale"),
126-
ocp.NewUDNDensityPods(&wh),
127-
ocp.NewIndex(&wh, ocpConfig),
128-
ocp.NewPVCDensity(&wh),
129-
ocp.NewRDSCore(&wh),
130-
ocp.NewWebBurner(&wh, "web-burner-init"),
131-
ocp.NewWebBurner(&wh, "web-burner-node-density"),
132-
ocp.NewWebBurner(&wh, "web-burner-cluster-density"),
133-
ocp.NewEgressIP(&wh, "egressip"),
134-
ocp.NewWhereabouts(&wh),
135-
ocp.NewVirtDensity(&wh),
136-
ocp.NewVirtUDNDensity(&wh),
137-
ocp.ClusterHealth(),
138-
ocp.CustomWorkload(&wh),
139-
ocp.NewVirtCapacityBenchmark(&wh),
140-
ocp.NewVirtClone(&wh),
141-
ocp.NewVirtEphemeralRestart(&wh),
142-
ocp.NewDVClone(&wh),
143-
ocp.NewVirtMigration(&wh),
144-
ocp.NewKueueOperator(&wh, "kueue-operator-pods"),
145-
ocp.NewKueueOperator(&wh, "kueue-operator-jobs"),
146-
ocp.NewKueueOperator(&wh, "kueue-operator-jobs-shared"),
147-
ocp.NewANPDensityPods(&wh, "anp-density-pods"),
117+
ocpWorkloads.NewClusterDensity(&wh, "cluster-density-v2"),
118+
ocpWorkloads.NewClusterDensity(&wh, "cluster-density-ms"),
119+
ocpWorkloads.NewCrdScale(&wh),
120+
ocpWorkloads.NewUdnBgp(&wh, "udn-bgp"),
121+
ocpWorkloads.NewNetworkPolicy(&wh, "network-policy"),
122+
ocpWorkloads.NewOLMv1(&wh, "olm"),
123+
ocpWorkloads.NewNodeDensity(&wh, "node-density"),
124+
ocpWorkloads.NewNodeDensity(&wh, "node-density-heavy"),
125+
ocpWorkloads.NewNodeDensity(&wh, "node-density-cni"),
126+
ocpWorkloads.NewNodeScale(&wh, "node-scale"),
127+
ocpWorkloads.NewUDNDensityPods(&wh),
128+
ocpWorkloads.NewIndex(&wh, ocpConfig),
129+
ocpWorkloads.NewPVCDensity(&wh),
130+
ocpWorkloads.NewRDSCore(&wh),
131+
ocpWorkloads.NewWebBurner(&wh, "web-burner-init"),
132+
ocpWorkloads.NewWebBurner(&wh, "web-burner-node-density"),
133+
ocpWorkloads.NewWebBurner(&wh, "web-burner-cluster-density"),
134+
ocpWorkloads.NewEgressIP(&wh, "egressip"),
135+
ocpWorkloads.NewWhereabouts(&wh),
136+
ocpWorkloads.NewVirtDensity(&wh),
137+
ocpWorkloads.NewVirtUDNDensity(&wh),
138+
clusterhealth.ClusterHealth(),
139+
ocpWorkloads.CustomWorkload(&wh),
140+
ocpWorkloads.NewVirtCapacityBenchmark(&wh),
141+
ocpWorkloads.NewVirtClone(&wh),
142+
ocpWorkloads.NewVirtEphemeralRestart(&wh),
143+
ocpWorkloads.NewDVClone(&wh),
144+
ocpWorkloads.NewVirtMigration(&wh),
145+
ocpWorkloads.NewKueueOperator(&wh, "kueue-operator-pods"),
146+
ocpWorkloads.NewKueueOperator(&wh, "kueue-operator-jobs"),
147+
ocpWorkloads.NewKueueOperator(&wh, "kueue-operator-jobs-shared"),
148+
ocpWorkloads.NewANPDensityPods(&wh, "anp-density-pods"),
148149
)
149150
util.SetupCmd(ocpCmd)
150151
return ocpCmd
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package ocp
15+
package clusterhealth
1616

1717
import (
1818
"context"
@@ -98,7 +98,7 @@ func isClusterHealthy(clientset kubernetes.Interface, openshiftClientset *versio
9898
return isHealthy
9999
}
100100

101-
func isClusterImageRegistryAvailable(clientset kubernetes.Interface) error {
101+
func IsClusterImageRegistryAvailable(clientset kubernetes.Interface) error {
102102
deployment, err := clientset.AppsV1().Deployments("openshift-image-registry").Get(context.TODO(), "image-registry", metav1.GetOptions{})
103103
if err != nil {
104104
return fmt.Errorf("Error getting deployment: %v", err)
@@ -110,7 +110,7 @@ func isClusterImageRegistryAvailable(clientset kubernetes.Interface) error {
110110
return fmt.Errorf("Deployment image-registry in namespace openshift-image-registry doesn't have available replicas")
111111
}
112112

113-
func isOLMv1Enabled(clientset kubernetes.Interface) error {
113+
func IsOLMv1Enabled(clientset kubernetes.Interface) error {
114114
deployment, err := clientset.AppsV1().Deployments("openshift-catalogd").Get(context.TODO(), "catalogd-controller-manager", metav1.GetOptions{})
115115
if err != nil {
116116
return fmt.Errorf("Error getting deployment: %v", err)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package ocp
15+
package workloads
1616

1717
import (
1818
"bytes"
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package ocp
15+
package workloads
1616

1717
import (
1818
"fmt"
1919
"os"
2020
"time"
2121

22+
"github.com/kube-burner/kube-burner-ocp/pkg/clusterhealth"
2223
"github.com/kube-burner/kube-burner/pkg/config"
24+
2325
"github.com/kube-burner/kube-burner/pkg/workloads"
2426
log "github.com/sirupsen/logrus"
2527
"github.com/spf13/cobra"
@@ -41,7 +43,7 @@ func NewClusterDensity(wh *workloads.WorkloadHelper, variant string) *cobra.Comm
4143
if cmd.Name() == "cluster-density-v2" {
4244
kubeClientProvider := config.NewKubeClientProvider("", "")
4345
clientSet, _ := kubeClientProvider.ClientSet(0, 0)
44-
if err := isClusterImageRegistryAvailable(clientSet); err != nil {
46+
if err := clusterhealth.IsClusterImageRegistryAvailable(clientSet); err != nil {
4547
log.Fatal(err.Error())
4648
}
4749
}

crd-scale.go renamed to pkg/workloads/crd-scale.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package ocp
15+
package workloads
1616

1717
import (
1818
"os"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package ocp
15+
package workloads
1616

1717
import (
1818
"os"

dv-clone.go renamed to pkg/workloads/dv-clone.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package ocp
15+
package workloads
1616

1717
import (
1818
"os"

egressip.go renamed to pkg/workloads/egressip.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package ocp
15+
package workloads
1616

1717
import (
1818
"context"

common.go renamed to pkg/workloads/helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package ocp
15+
package workloads
1616

1717
import (
1818
"context"

index.go renamed to pkg/workloads/index.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package ocp
15+
package workloads
1616

1717
import (
1818
"embed"

0 commit comments

Comments
 (0)