Skip to content

Commit

Permalink
Add okteto manifest annotations to every resource created by okteto (#…
Browse files Browse the repository at this point in the history
…972)

Signed-off-by: Pablo Chico de Guzman <pchico83@gmail.com>
  • Loading branch information
pchico83 committed Jul 8, 2020
1 parent a5e192e commit ff12035
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/push.go
Expand Up @@ -155,6 +155,12 @@ func runPush(dev *model.Dev, autoDeploy bool, imageTag, oktetoRegistryURL, progr
if *tr.Deployment.Spec.Replicas == 0 {
tr.Deployment.Spec.Replicas = &model.DevReplicas
}

if tr.Deployment.Annotations[model.OktetoAutoCreateAnnotation] == model.OktetoPushCmd {
for k, v := range tr.Annotations {
tr.Deployment.Annotations[k] = v
}
}
}

if d != nil && deployments.IsDevModeOn(d) {
Expand Down
1 change: 1 addition & 0 deletions pkg/k8s/services/crud.go
Expand Up @@ -44,6 +44,7 @@ func CreateDev(dev *model.Dev, c *kubernetes.Clientset) error {
} else {
log.Infof("updating service '%s'", s.Name)
old.Spec.Ports = s.Spec.Ports
old.Annotations = s.Annotations
_, err = sClient.Update(old)
if err != nil {
return fmt.Errorf("error updating kubernetes service: %s", err)
Expand Down
3 changes: 3 additions & 0 deletions pkg/k8s/services/translate.go
Expand Up @@ -29,6 +29,9 @@ func translate(dev *model.Dev) *apiv1.Service {
if len(dev.Services) == 0 {
annotations[oktetoAutoIngressAnnotation] = "true"
}
for k, v := range dev.Annotations {
annotations[k] = v
}
return &apiv1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: dev.Name,
Expand Down

0 comments on commit ff12035

Please sign in to comment.