Skip to content

Commit

Permalink
PVCs with label selectors are logged only when the PVCs are in the pe…
Browse files Browse the repository at this point in the history
…nding phase and the debug mode is enabled

(cherry picked from commit 0941d46)
  • Loading branch information
kangarlou authored and adkerr committed Jul 26, 2017
1 parent 80d8393 commit 0ad7faa
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions frontend/kubernetes/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,6 @@ func (p *KubernetesPlugin) processClaim(
"was specified!")
return
}
// As of Kubernetes 1.6, selector and storage class are mutally exclusive.
if claim.Spec.Selector != nil {
message := "Kubernetes frontend ignores PVCs with label selectors!"
p.updateClaimWithEvent(claim, v1.EventTypeWarning,
"IgnoredClaim", message)
log.WithFields(log.Fields{
"PVC": claim.Name,
}).Warn(message)
return
}

// It's a valid PVC.
switch eventType {
Expand All @@ -398,7 +388,7 @@ func (p *KubernetesPlugin) processClaim(
log.WithFields(log.Fields{
"PVC": claim.Name,
"event": eventType,
}).Warn("Kubernetes frontend didn't recognize the notification event ",
}).Error("Kubernetes frontend didn't recognize the notification event ",
"corresponding to the PVC!")
return
}
Expand All @@ -413,12 +403,22 @@ func (p *KubernetesPlugin) processClaim(
p.processLostClaim(claim)
return
case v1.ClaimPending:
// As of Kubernetes 1.6, selector and storage class are mutually exclusive.
if claim.Spec.Selector != nil {
message := "Kubernetes frontend ignores PVCs with label selectors!"
p.updateClaimWithEvent(claim, v1.EventTypeWarning, "IgnoredClaim",
message)
log.WithFields(log.Fields{
"PVC": claim.Name,
}).Debug(message)
return
}
p.processPendingClaim(claim)
default:
log.WithFields(log.Fields{
"PVC": claim.Name,
"PVC_phase": claim.Status.Phase,
}).Warn("Kubernetes frontend doesn't recognize the claim phase.")
}).Error("Kubernetes frontend doesn't recognize the claim phase.")
}
}

Expand Down Expand Up @@ -705,7 +705,7 @@ func (p *KubernetesPlugin) createVolumeAndPV(uniqueName string,
"volume": vol.Config.Name,
"type": p.orchestrator.GetVolumeType(vol),
"driver": driverType,
}).Warn("Kubernetes frontend doesn't recognize this type of volume; ",
}).Error("Kubernetes frontend doesn't recognize this type of volume; ",
"deleting the provisioned volume.")
err = fmt.Errorf("Unrecognized volume type by Kubernetes")
return
Expand Down Expand Up @@ -805,7 +805,7 @@ func (p *KubernetesPlugin) processVolume(
log.WithFields(log.Fields{
"PV": volume.Name,
"event": eventType,
}).Warn("Kubernetes frontend didn't recognize the notification event ",
}).Error("Kubernetes frontend didn't recognize the notification event ",
"corresponding to the PV!")
return
}
Expand Down Expand Up @@ -870,7 +870,7 @@ func (p *KubernetesPlugin) processUpdatedVolume(volume *v1.PersistentVolume) {
log.WithFields(log.Fields{
"PV": volume.Name,
"PV_phase": volume.Status.Phase,
}).Warn("Kubernetes frontend doesn't recognize the volume phase.")
}).Error("Kubernetes frontend doesn't recognize the volume phase.")
}
}

Expand Down Expand Up @@ -1017,7 +1017,7 @@ func (p *KubernetesPlugin) processClass(
log.WithFields(log.Fields{
"storageClass": class.Name,
"event": eventType,
}).Warn("Kubernetes frontend didn't recognize the notification event corresponding to the storage class!")
}).Error("Kubernetes frontend didn't recognize the notification event corresponding to the storage class!")
return
}
}
Expand Down

0 comments on commit 0ad7faa

Please sign in to comment.