Skip to content

Commit

Permalink
fix(deploy): bundle apply not overriding project.werf.io/env annotation
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
  • Loading branch information
ilya-lesikov committed Jun 5, 2024
1 parent 8e6463c commit 937b452
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
14 changes: 6 additions & 8 deletions cmd/werf/bundle/apply/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,7 @@ func runApply(ctx context.Context) error {
saveRollbackGraphPath := rollbackGraphPath != ""
networkParallelism := common.GetNetworkParallelism(&commonCmdData)

serviceAnnotations := map[string]string{
"werf.io/version": werf.Version,
}

if *commonCmdData.Environment != "" {
serviceAnnotations["project.werf.io/env"] = *commonCmdData.Environment
}

serviceAnnotations := map[string]string{}
extraAnnotations := map[string]string{}
for key, value := range bundle.ExtraAnnotationsAndLabelsPostRenderer.ExtraAnnotations {
if strings.HasPrefix(key, "project.werf.io/") ||
Expand All @@ -306,6 +299,11 @@ func runApply(ctx context.Context) error {
}
}

serviceAnnotations["werf.io/version"] = werf.Version
if *commonCmdData.Environment != "" {
serviceAnnotations["project.werf.io/env"] = *commonCmdData.Environment
}

extraLabels := bundle.ExtraAnnotationsAndLabelsPostRenderer.ExtraLabels

clientFactory, err := kubeclnt.NewClientFactory()
Expand Down
14 changes: 6 additions & 8 deletions cmd/werf/bundle/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,7 @@ func runRender(ctx context.Context) error {

networkParallelism := common.GetNetworkParallelism(&commonCmdData)

serviceAnnotations := map[string]string{
"werf.io/version": werf.Version,
}

if *commonCmdData.Environment != "" {
serviceAnnotations["project.werf.io/env"] = *commonCmdData.Environment
}

serviceAnnotations := map[string]string{}
extraAnnotations := map[string]string{}
for key, value := range bundle.ExtraAnnotationsAndLabelsPostRenderer.ExtraAnnotations {
if strings.HasPrefix(key, "project.werf.io/") ||
Expand All @@ -264,6 +257,11 @@ func runRender(ctx context.Context) error {
}
}

serviceAnnotations["werf.io/version"] = werf.Version
if *commonCmdData.Environment != "" {
serviceAnnotations["project.werf.io/env"] = *commonCmdData.Environment
}

extraLabels := bundle.ExtraAnnotationsAndLabelsPostRenderer.ExtraLabels

var clientFactory *kubeclnt.ClientFactory
Expand Down

0 comments on commit 937b452

Please sign in to comment.