Skip to content

Commit

Permalink
disable sdc-monito and health-monitor by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kumarp20 committed Aug 7, 2024
1 parent af95978 commit 89310ad
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
32 changes: 28 additions & 4 deletions pkg/drivers/commonconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ func GetController(ctx context.Context, cr csmv1.ContainerStorageModule, operato

controllerYAML := driverYAML.(utils.ControllerYAML)
controllerYAML.Deployment.Spec.Replicas = &cr.Spec.Driver.Replicas
var defaultReplicas int32 = 1
if *(controllerYAML.Deployment.Spec.Replicas) == 0 {
controllerYAML.Deployment.Spec.Replicas = &defaultReplicas
}

if len(cr.Spec.Driver.Controller.Tolerations) != 0 {
tols := make([]acorev1.TolerationApplyConfiguration, 0)
Expand Down Expand Up @@ -151,15 +155,26 @@ func GetController(ctx context.Context, cr csmv1.ContainerStorageModule, operato
}

removeContainer := false
if string(*c.Name) == "csi-external-health-monitor-controller" {
removeContainer = true
}
for _, s := range cr.Spec.Driver.SideCars {
if s.Name == *c.Name {
if s.Enabled == nil {
log.Infow("Container to be enabled", "name", *c.Name)
break
if string(*c.Name) == "csi-external-health-monitor-controller" {
removeContainer = true
log.Infow("Container to be removed", "name", *c.Name)
break
} else {

Check warning on line 168 in pkg/drivers/commonconfig.go

View workflow job for this annotation

GitHub Actions / golangci-lint

superfluous-else: if block ends with a break statement, so drop this else and outdent its block (revive)
removeContainer = false
log.Infow("Container to be enabled", "name", *c.Name)
break
}
} else if !*s.Enabled {
removeContainer = true
log.Infow("Container to be removed", "name", *c.Name)
} else {
removeContainer = false
log.Infow("Container to be enabled", "name", *c.Name)
}
break
Expand Down Expand Up @@ -368,15 +383,24 @@ func GetNode(ctx context.Context, cr csmv1.ContainerStorageModule, operatorConfi
}
}
removeContainer := false
if string(*c.Name) == "sdc-monitor" {
removeContainer = true
}
for _, s := range cr.Spec.Driver.SideCars {
if s.Name == *c.Name {
if s.Enabled == nil {
log.Infow("Container to be enabled", "name", *c.Name)
break
if string(*c.Name) == "sdc-monitor" {
removeContainer = true
log.Infow("Container to be removed", "name", *c.Name)
} else {
removeContainer = false
log.Infow("Container to be enabled", "name", *c.Name)
}
} else if !*s.Enabled {
removeContainer = true
log.Infow("Container to be removed", "name", *c.Name)
} else {
removeContainer = false
log.Infow("Container to be enabled", "name", *c.Name)
}
break
Expand Down
4 changes: 2 additions & 2 deletions pkg/drivers/powerflex.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ func ModifyPowerflexCR(yamlString string, cr csmv1.ContainerStorageModule, fileT
storageCapacity := "false"
enableQuota := ""
powerflexExternalAccess := ""
healthMonitorController := ""
healthMonitorNode := ""
healthMonitorController := "false"
healthMonitorNode := "false"

// nolint:gosec
switch fileType {
Expand Down

1 comment on commit 89310ad

@harishp8889
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kumarp20 I think we may have to set default path for KUBELET_CONFIG_DIR also.

Please sign in to comment.