Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Markus Lehtonen <markus.lehtonen@intel.com>
  • Loading branch information
ArangoGutierrez and marquiz committed Oct 1, 2021
1 parent 9817ef6 commit 39d4ce7
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions controllers/nodefeaturediscovery_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ import (
)

// nodeType is either 'worker' or 'master'
type nodeType int
type nfdInstanceType string

const (
worker nodeType = iota
master nodeType
nfdNamespace = "node-feature-discovery-operator"
workerName = "nfd-worker"
masterName = "nfd-master"
nfdNamespace = "node-feature-discovery-operator"
workerInstance nfdInstanceType = "nfd-worker"
masterInstance nfdInstanceType = "nfd-master"
)

const (
Expand Down Expand Up @@ -130,15 +128,8 @@ func (r *NodeFeatureDiscoveryReconciler) updateStatus(nfd *nfdv1.NodeFeatureDisc

// updateDegradedCondition is used to mark a given resource as "degraded" so that
// the reconciler can take steps to rectify the situation.
func (r *NodeFeatureDiscoveryReconciler) updateDegradedCondition(nfd *nfdv1.NodeFeatureDiscovery, condition string, conditionErr error) (ctrl.Result, error) {

// It is already assumed that the resource has been degraded, so the first
// step is to gather the correct list of conditions.
var conditionErrMsg string = "Degraded"
if conditionErr != nil {
conditionErrMsg = conditionErr.Error()
}
degradedCondition := r.getDegradedConditions(condition, conditionErrMsg)
func (r *NodeFeatureDiscoveryReconciler) updateDegradedCondition(nfd *nfdv1.NodeFeatureDiscovery, reason, message string) (ctrl.Result, error) {
degradedCondition := r.getDegradedConditions(reason, message)
if err := r.updateStatus(nfd, degradedCondition); err != nil {
return reconcile.Result{}, err
}
Expand Down

0 comments on commit 39d4ce7

Please sign in to comment.