Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

syncer: check meta equality for sa type token secret #83

Merged
merged 1 commit into from
Jun 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions virtualcluster/pkg/syncer/conversion/equality.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,24 @@ func (e vcEquality) CheckBinaryDataEquality(pObj, vObj map[string][]byte) (map[s
}

func (e vcEquality) CheckSecretEquality(pObj, vObj *v1.Secret) *v1.Secret {
// ignore service account token type secret.
if vObj.Type == v1.SecretTypeServiceAccountToken {
return nil
var updatedObj *v1.Secret
labels, equal := e.checkDWKVEquality(pObj.Labels, vObj.Labels)
if !equal {
if updatedObj == nil {
updatedObj = pObj.DeepCopy()
}
updatedObj.Labels = labels
}

annotations, equal := e.checkDWKVEquality(pObj.Annotations, vObj.Annotations)
if !equal {
if updatedObj == nil {
updatedObj = pObj.DeepCopy()
}
updatedObj.Annotations = annotations
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 537, should we return nil or updatedObj?

return updatedObj
}

var updated *v1.Secret
Expand Down