Skip to content

Commit

Permalink
Merge pull request #404 from vyzigold/switch_enabled_to_ptr
Browse files Browse the repository at this point in the history
Switch "Enabled" to pointers
  • Loading branch information
openshift-merge-bot[bot] authored Jun 12, 2024
2 parents e96daa2 + e183f90 commit a06d499
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
12 changes: 6 additions & 6 deletions api/v1beta1/telemetry_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ type CeilometerSection struct {
// +kubebuilder:default=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// Enabled - Whether OpenStack Ceilometer service should be deployed and managed
Enabled bool `json:"enabled"`
Enabled *bool `json:"enabled"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
Expand All @@ -93,7 +93,7 @@ type CeilometerSectionCore struct {
// +kubebuilder:default=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// Enabled - Whether OpenStack Ceilometer service should be deployed and managed
Enabled bool `json:"enabled"`
Enabled *bool `json:"enabled"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
Expand All @@ -107,7 +107,7 @@ type AutoscalingSection struct {
// +kubebuilder:default=false
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// Enabled - Whether OpenStack autoscaling service should be deployed and managed
Enabled bool `json:"enabled"`
Enabled *bool `json:"enabled"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
Expand All @@ -121,7 +121,7 @@ type AutoscalingSectionCore struct {
// +kubebuilder:default=false
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// Enabled - Whether OpenStack autoscaling service should be deployed and managed
Enabled bool `json:"enabled"`
Enabled *bool `json:"enabled"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
Expand All @@ -135,7 +135,7 @@ type MetricStorageSection struct {
// +kubebuilder:default=false
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// Enabled - Whether a MetricStorage should be deployed and managed
Enabled bool `json:"enabled"`
Enabled *bool `json:"enabled"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
Expand All @@ -149,7 +149,7 @@ type LoggingSection struct {
// +kubebuilder:default=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// Enabled - Whether OpenStack logging service should be deployed and managed
Enabled bool `json:"enabled"`
Enabled *bool `json:"enabled"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
Expand Down
30 changes: 30 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.

8 changes: 4 additions & 4 deletions controllers/telemetry_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (r TelemetryReconciler) reconcileCeilometer(ctx context.Context, instance *
},
}

if !instance.Spec.Ceilometer.Enabled {
if instance.Spec.Ceilometer.Enabled == nil || !*instance.Spec.Ceilometer.Enabled {
if res, err := utils.EnsureDeleted(ctx, helper, ceilometerInstance); err != nil {
return res, err
}
Expand Down Expand Up @@ -321,7 +321,7 @@ func (r TelemetryReconciler) reconcileAutoscaling(ctx context.Context, instance
},
}

if !instance.Spec.Autoscaling.Enabled {
if instance.Spec.Autoscaling.Enabled == nil || !*instance.Spec.Autoscaling.Enabled {
if res, err := utils.EnsureDeleted(ctx, helper, autoscalingInstance); err != nil {
return res, err
}
Expand Down Expand Up @@ -396,7 +396,7 @@ func (r TelemetryReconciler) reconcileMetricStorage(ctx context.Context, instanc
},
}

if !instance.Spec.MetricStorage.Enabled {
if instance.Spec.MetricStorage.Enabled == nil || !*instance.Spec.MetricStorage.Enabled {
if res, err := utils.EnsureDeleted(ctx, helper, metricStorageInstance); err != nil {
return res, err
}
Expand Down Expand Up @@ -482,7 +482,7 @@ func (r TelemetryReconciler) reconcileLogging(ctx context.Context, instance *tel
},
}

if !instance.Spec.Logging.Enabled {
if instance.Spec.Logging.Enabled == nil || !*instance.Spec.Logging.Enabled {
if res, err := utils.EnsureDeleted(ctx, helper, loggingInstance); err != nil {
return res, err
}
Expand Down

0 comments on commit a06d499

Please sign in to comment.