Skip to content

Commit

Permalink
fix: preserve VC annotations when updating plugin hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerGillson committed Aug 31, 2023
1 parent 1aada24 commit 19c9463
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/controller/valid8orconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,19 @@ func (r *Valid8orConfigReconciler) redeployIfNeeded(ctx context.Context, vc *v1a
// indicating whether the values have changed or not since the last reconciliation
func (r *Valid8orConfigReconciler) updatePluginHash(vc *v1alpha1.Valid8orConfig, p v1alpha1.HelmRelease) bool {
valuesUnchanged := false

pluginValuesHashLatest := sha256.Sum256([]byte(p.Values))
pluginValuesHashLatestB64 := base64.StdEncoding.EncodeToString(pluginValuesHashLatest[:])

pluginValuesHashKey := fmt.Sprintf("%s-%s", PluginValuesHash, p.Chart.Name)

if vc.Annotations == nil {
vc.Annotations = make(map[string]string)
}
pluginValuesHash, ok := vc.Annotations[pluginValuesHashKey]
if !ok {
vc.Annotations = make(map[string]string, 0)
} else {
if ok {
valuesUnchanged = pluginValuesHash == pluginValuesHashLatestB64
}

vc.Annotations[pluginValuesHashKey] = pluginValuesHashLatestB64

return valuesUnchanged
}

Expand Down

0 comments on commit 19c9463

Please sign in to comment.