Skip to content

Commit

Permalink
Merge pull request #456 from bertinatto/vsphere-problem-detector-avai…
Browse files Browse the repository at this point in the history
…lable-cond

OCPBUGS-29126: vsphere-problem-detector: don't set Available condition
  • Loading branch information
openshift-merge-bot[bot] committed May 7, 2024
2 parents 0669fc4 + c719f2b commit 7e85c80
Show file tree
Hide file tree
Showing 92 changed files with 4,293 additions and 994 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ require (
github.com/go-logr/logr v1.4.1 // indirect
github.com/google/go-cmp v0.6.0
github.com/google/gofuzz v1.2.0 // indirect
github.com/openshift/api v0.0.0-20240415215749-1ddd5804ab3a
github.com/openshift/api v0.0.0-20240424142232-29a704bf5aa2
github.com/openshift/build-machinery-go v0.0.0-20231128094528-1e9b1b0595c8
github.com/openshift/client-go v0.0.0-20240125160436-aa5df63097c4
github.com/openshift/library-go v0.0.0-20240130085015-2ad786549f07
github.com/openshift/client-go v0.0.0-20240405120947-c67c8325cdd8
github.com/openshift/library-go v0.0.0-20240506162756-6301addeda88
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.71.2
github.com/prometheus-operator/prometheus-operator/pkg/client v0.71.2
github.com/prometheus/client_golang v1.18.0
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY
github.com/onsi/ginkgo/v2 v2.14.0/go.mod h1:JkUdW7JkN0V6rFvsHcJ478egV3XH9NxpD27Hal/PhZw=
github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
github.com/openshift/api v0.0.0-20240415215749-1ddd5804ab3a h1:MrdHtbj64cs4aqLEpZdbvR1OR2F0EFynHHB4XQZtQ/8=
github.com/openshift/api v0.0.0-20240415215749-1ddd5804ab3a/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
github.com/openshift/api v0.0.0-20240424142232-29a704bf5aa2 h1:U1BsjJoTsvYjymeMseC8apZnvCgExIIRolpc/xJ7jhM=
github.com/openshift/api v0.0.0-20240424142232-29a704bf5aa2/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
github.com/openshift/build-machinery-go v0.0.0-20231128094528-1e9b1b0595c8 h1:cu3YUMVGsKIyFyJGO3F6BZKGYQZpCKxAv9cBPgQAca8=
github.com/openshift/build-machinery-go v0.0.0-20231128094528-1e9b1b0595c8/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
github.com/openshift/client-go v0.0.0-20240125160436-aa5df63097c4 h1:Ct+/c9d5rjZudN+VBLxRJIQfPy1gJZier1P1KdpvCaM=
github.com/openshift/client-go v0.0.0-20240125160436-aa5df63097c4/go.mod h1:ZS5cpA+0zI/ziDQxAKKvGkRKn9BJppqDYdAph+OUTlo=
github.com/openshift/library-go v0.0.0-20240130085015-2ad786549f07 h1:tJ0nYpJ9gic3G+98kIBlJ7r8MpDcXTWvQPHW60GOKLU=
github.com/openshift/library-go v0.0.0-20240130085015-2ad786549f07/go.mod h1:ePlaOqUiPplRc++6aYdMe+2FmXb2xTNS9Nz5laG2YmI=
github.com/openshift/client-go v0.0.0-20240405120947-c67c8325cdd8 h1:HGfbllzRcrJBSiwzNjBCs7sExLUxC5/1evnvlNGB0Cg=
github.com/openshift/client-go v0.0.0-20240405120947-c67c8325cdd8/go.mod h1:+VvvaMSTUhOt+rBq7NwRLSNxq06hTeRCBqm0j0PQEq8=
github.com/openshift/library-go v0.0.0-20240506162756-6301addeda88 h1:1XfsnHp16oSnZWiBYsCqta8GqWw0YhvhDJYtawG6COQ=
github.com/openshift/library-go v0.0.0-20240506162756-6301addeda88/go.mod h1:lFwyRj0XjUf25Da3Q00y+KuaxCWTJ6YzYPDX1+96nco=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA=
Expand Down
30 changes: 15 additions & 15 deletions pkg/operator/csidriveroperator/driver_starter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"time"

v1 "github.com/openshift/api/config/v1"
"github.com/openshift/api/features"
"github.com/openshift/cluster-storage-operator/pkg/csoclients"
"github.com/openshift/cluster-storage-operator/pkg/operator/csidriveroperator/csioperatorclient"
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"

cfgv1 "github.com/openshift/api/config/v1"
"github.com/openshift/library-go/pkg/operator/events"
"github.com/openshift/library-go/pkg/operator/status"
"github.com/stretchr/testify/assert"
Expand All @@ -35,9 +35,9 @@ type RunControllerTest struct {
}

func TestShouldRunController(t *testing.T) {
testingDefault := featuregates.NewFeatureGate(nil, []v1.FeatureGateName{v1.FeatureGateCSIDriverSharedResource})
testingTechPreview := featuregates.NewFeatureGate([]v1.FeatureGateName{v1.FeatureGateCSIDriverSharedResource}, nil)
customFeatureGate := featuregates.NewFeatureGate([]v1.FeatureGateName{"SomeOtherFeatureGate", v1.FeatureGateCSIDriverSharedResource, "YetAnotherGate"}, nil)
testingDefault := featuregates.NewFeatureGate(nil, []v1.FeatureGateName{features.FeatureGateCSIDriverSharedResource})
testingTechPreview := featuregates.NewFeatureGate([]v1.FeatureGateName{features.FeatureGateCSIDriverSharedResource}, nil)
customFeatureGate := featuregates.NewFeatureGate([]v1.FeatureGateName{"SomeOtherFeatureGate", features.FeatureGateCSIDriverSharedResource, "YetAnotherGate"}, nil)
customWithJustOther := featuregates.NewFeatureGate([]v1.FeatureGateName{"SomeOtherFeatureGate"}, nil)
customWithNothing := featuregates.NewFeatureGate([]v1.FeatureGateName{}, nil)

Expand All @@ -50,7 +50,7 @@ func TestShouldRunController(t *testing.T) {
config: csioperatorclient.CSIOperatorConfig{
CSIDriverName: "csi.sharedresource.openshift.io",
Platform: csioperatorclient.AllPlatforms,
RequireFeatureGate: v1.FeatureGateCSIDriverSharedResource,
RequireFeatureGate: features.FeatureGateCSIDriverSharedResource,
},
isInstalled: false,
expectRun: true,
Expand All @@ -64,7 +64,7 @@ func TestShouldRunController(t *testing.T) {
csioperatorclient.CSIOperatorConfig{
CSIDriverName: "csi.sharedresource.openshift.io",
Platform: v1.AWSPlatformType,
RequireFeatureGate: v1.FeatureGateCSIDriverSharedResource,
RequireFeatureGate: features.FeatureGateCSIDriverSharedResource,
},
false,
true,
Expand All @@ -78,7 +78,7 @@ func TestShouldRunController(t *testing.T) {
csioperatorclient.CSIOperatorConfig{
CSIDriverName: "csi.sharedresource.openshift.io",
Platform: v1.GCPPlatformType,
RequireFeatureGate: v1.FeatureGateCSIDriverSharedResource,
RequireFeatureGate: features.FeatureGateCSIDriverSharedResource,
},
false,
true,
Expand All @@ -92,7 +92,7 @@ func TestShouldRunController(t *testing.T) {
csioperatorclient.CSIOperatorConfig{
CSIDriverName: "csi.sharedresource.openshift.io",
Platform: v1.VSpherePlatformType,
RequireFeatureGate: v1.FeatureGateCSIDriverSharedResource,
RequireFeatureGate: features.FeatureGateCSIDriverSharedResource,
},
false,
true,
Expand Down Expand Up @@ -168,7 +168,7 @@ func TestShouldRunController(t *testing.T) {
csioperatorclient.CSIOperatorConfig{
CSIDriverName: "csi.sharedresource.openshift.io",
Platform: v1.AWSPlatformType,
RequireFeatureGate: v1.FeatureGateCSIDriverSharedResource,
RequireFeatureGate: features.FeatureGateCSIDriverSharedResource,
},
false,
true,
Expand All @@ -182,7 +182,7 @@ func TestShouldRunController(t *testing.T) {
csioperatorclient.CSIOperatorConfig{
CSIDriverName: "csi.sharedresource.openshift.io",
Platform: v1.AWSPlatformType,
RequireFeatureGate: v1.FeatureGateCSIDriverSharedResource,
RequireFeatureGate: features.FeatureGateCSIDriverSharedResource,
},
false,
false,
Expand All @@ -196,7 +196,7 @@ func TestShouldRunController(t *testing.T) {
csioperatorclient.CSIOperatorConfig{
CSIDriverName: "csi.sharedresource.openshift.io",
Platform: v1.AWSPlatformType,
RequireFeatureGate: v1.FeatureGateCSIDriverSharedResource,
RequireFeatureGate: features.FeatureGateCSIDriverSharedResource,
},
false,
false,
Expand All @@ -210,15 +210,15 @@ func TestShouldRunController(t *testing.T) {
csioperatorclient.CSIOperatorConfig{
CSIDriverName: "csi.sharedresource.openshift.io",
Platform: v1.AWSPlatformType,
RequireFeatureGate: v1.FeatureGateCSIDriverSharedResource,
RequireFeatureGate: features.FeatureGateCSIDriverSharedResource,
},
false,
false,
false,
},
{
"Azure File driver should not run on Azure StackHub if not already installed",
&v1.PlatformStatus{Type: v1.AzurePlatformType, Azure: &v1.AzurePlatformStatus{CloudName: cfgv1.AzureStackCloud}},
&v1.PlatformStatus{Type: v1.AzurePlatformType, Azure: &v1.AzurePlatformStatus{CloudName: v1.AzureStackCloud}},
customWithNothing,
nil,
csioperatorclient.CSIOperatorConfig{
Expand All @@ -233,7 +233,7 @@ func TestShouldRunController(t *testing.T) {
},
{
"Azure File driver should keep running on Azure StackHub if already installed",
&v1.PlatformStatus{Type: v1.AzurePlatformType, Azure: &v1.AzurePlatformStatus{CloudName: cfgv1.AzureStackCloud}},
&v1.PlatformStatus{Type: v1.AzurePlatformType, Azure: &v1.AzurePlatformStatus{CloudName: v1.AzureStackCloud}},
customWithNothing,
nil,
csioperatorclient.CSIOperatorConfig{
Expand Down Expand Up @@ -406,7 +406,7 @@ func TestStandAloneStarter(t *testing.T) {

infrInformer := clients.ConfigInformers.Config().V1().Infrastructures().Informer()
infrInformer.GetStore().Add(getInfrastructure(v1.AWSPlatformType))
testingDefault := featuregates.NewFeatureGate(nil, []v1.FeatureGateName{v1.FeatureGateCSIDriverSharedResource})
testingDefault := featuregates.NewFeatureGate(nil, []v1.FeatureGateName{features.FeatureGateCSIDriverSharedResource})

csoclients.StartInformers(clients, finish.Done())
csoclients.WaitForSync(clients, finish.Done())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ func (c *VSphereProblemDetectorStarter) createVSphereProblemDetectorManager(
"vsphere_problem_detector/10_service.yaml",
}

vSphereProblemDetectorName := "VSphereProblemDetectorDeploymentController"
mgr = mgr.WithController(staticresourcecontroller.NewStaticResourceController(
"VSphereProblemDetectorStarterStaticController",
vSphereProblemDetectorName,
assets.ReadFile,
staticAssets,
resourceapply.NewKubeClientHolder(clients.KubeClient),
Expand All @@ -136,20 +137,19 @@ func (c *VSphereProblemDetectorStarter) createVSphereProblemDetectorManager(
panic(err)
}

mgr = mgr.WithController(deploymentcontroller.NewDeploymentController(
vSphereProblemDetectorController, err := deploymentcontroller.NewDeploymentControllerBuilder(
"VSphereProblemDetectorDeploymentController",
deploymentAssets,
c.eventRecorder,
clients.OperatorClient,
clients.KubeClient,
clients.KubeInformers.InformersFor(csoclients.OperatorNamespace).Apps().V1().Deployments(),
[]factory.Informer{
clients.KubeInformers.InformersFor(csoclients.OperatorNamespace).Core().V1().Secrets().Informer(),
clients.ConfigInformers.Config().V1().Infrastructures().Informer(),
},
[]deploymentcontroller.ManifestHookFunc{
c.withReplacerHook(),
},
).WithExtraInformers(
clients.KubeInformers.InformersFor(csoclients.OperatorNamespace).Core().V1().Secrets().Informer(),
clients.ConfigInformers.Config().V1().Infrastructures().Informer(),
).WithManifestHooks(
c.withReplacerHook(),
).WithDeploymentHooks(
csidrivercontrollerservicecontroller.WithControlPlaneTopologyHook(clients.ConfigInformers),
withProxyHook(),
// Restart when credentials change to get a quick retest
Expand All @@ -169,7 +169,17 @@ func (c *VSphereProblemDetectorStarter) createVSphereProblemDetectorManager(
cloudConfigNamespace,
clients.KubeInformers.InformersFor(csoclients.OperatorNamespace).Core().V1().ConfigMaps(),
),
), 1)
).WithConditions(
// No Available Condition
operatorapi.OperatorStatusTypeProgressing,
operatorapi.OperatorStatusTypeDegraded,
).ToController()

if err != nil {
panic(err)
}

mgr = mgr.WithController(vSphereProblemDetectorController, 1)

mgr = mgr.WithController(newMonitoringController(
clients,
Expand Down
15 changes: 6 additions & 9 deletions vendor/github.com/openshift/api/config/v1/types_feature.go

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

0 comments on commit 7e85c80

Please sign in to comment.