pv for resource with no names assigned
@@ -26,8 +26,11 @@ func newPvBuilder(dclient *client.Client) *pvBuilder {
return &pvb
}
func (pvb *pvBuilder) generate(info Info) []kyverno.PolicyViolation {
+ // https://github.com/nirmata/kyverno/issues/535
var owners []kyverno.ResourceSpec
- if !info.Blocked {
+ // get the owners if the resource is blocked or
+ // the resource does not have a name assigned yet(uses generateName)
+ if info.Blocked || info.Resource.GetName() == "" {
// get resource owners
owners = GetOwners(pvb.dclient, info.Resource)
}
