Safe encode template hash value to make it consistent with resource name

This commit is contained in:
Janet Kuo
2018-07-11 17:01:38 -07:00
parent 24ee75e265
commit 666a41c2ea
10 changed files with 23 additions and 20 deletions

View File

@@ -681,6 +681,10 @@ func checkRSHashLabels(rs *apps.ReplicaSet) (string, error) {
return "", fmt.Errorf("unexpected replicaset %s missing required pod-template-hash labels", rs.Name)
}
if !strings.HasSuffix(rs.Name, hash) {
return "", fmt.Errorf("unexpected replicaset %s name suffix doesn't match hash %s", rs.Name, hash)
}
return hash, nil
}