Skip to content

Commit

Permalink
fix deploy annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
pPrecel committed Dec 27, 2024
1 parent de4fe9a commit 8fbe612
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,25 +386,20 @@ func (s *systemState) podAnnotations() map[string]string {
if s.instance.Spec.Annotations != nil {
result = labels.Merge(s.instance.Spec.Annotations, result)
}
result = labels.Merge(s.specialDeploymentAnnotations(), result)

// merge old and new annotations to allow other components to annotate functions deployment
// for example in case when someone use `kubectl rollout restart` on it
result = labels.Merge(s.currentAnnotations(), result)
return result
}

func (s *systemState) specialDeploymentAnnotations() map[string]string {
func (s *systemState) currentAnnotations() map[string]string {
deployments := s.deployments.Items
if len(deployments) == 0 {
return map[string]string{}
}
deploymentAnnotations := deployments[0].Spec.Template.GetAnnotations()
specialDeploymentAnnotations := map[string]string{}
for _, k := range []string{
"kubectl.kubernetes.io/restartedAt",
} {
if v, found := deploymentAnnotations[k]; found {
specialDeploymentAnnotations[k] = v
}
}
return specialDeploymentAnnotations

return deployments[0].Spec.Template.GetAnnotations()
}

type buildDeploymentArgs struct {
Expand Down

0 comments on commit 8fbe612

Please sign in to comment.