8000 feat: add depends_on annotation support for services by jLopezbarb · Pull Request #4686 · okteto/okteto · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add depends_on annotation support for services #4686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2025
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
17 changes: 15 additions & 2 deletions pkg/cmd/stack/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package stack
import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"os"
"sort"
Expand Down Expand Up @@ -57,6 +58,9 @@ const (

// oktetoComposeVolumeAffinityEnabledEnvVar represents whether the feature flag to enable volume affinity is enabled or not
oktetoComposeVolumeAffinityEnabledEnvVar = "OKTETO_COMPOSE_VOLUME_AFFINITY_ENABLED"

// dependsOnAnnotation represents the annotation to define the depends_on field
dependsOnAnnotation = "dev.okteto.com/depends-on"
)

// +enum
Expand Down Expand Up @@ -554,18 +558,27 @@ func translateLabelSelector(svcName string, s *model.Stack) map[string]string {
}

func translateAnnotations(svc *model.Service) map[string]string {
result := getAnnotations()
result := getAnnotations(svc)
for k, v := range svc.Annotations {
result[k] = v
}
return result
}

func getAnnotations() map[string]string {
func getAnnotations(svc *model.Service) map[string]string {
annotations := map[string]string{}
if utils.IsOktetoRepo() {
annotations[model.OktetoSampleAnnotation] = "true"
}
if len(svc.DependsOn) > 0 {
dependsOn, err := json.Marshal(svc.DependsOn)
if err != nil {
oktetoLog.Infof("error marshalling depends_on annotation: %s", err)
} else {
annotations[dependsOnAnnotation] = string(dependsOn)
}
}

return annotations
}

Expand Down
Loading
0