Skip to content

Commit

Permalink
fix(executor): Fix compatibility issue with k8s>=1.21 when selfLink i…
Browse files Browse the repository at this point in the history
…s no longer populated (#5992)
  • Loading branch information
terrytangyuan committed May 25, 2021
1 parent a2c6241 commit d7c5cf6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions workflow/executor/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ func (we *WorkflowExecutor) ExecResource(action string, manifestPath string, fla
return "", "", "", errors.New(errors.CodeBadRequest, "Kind and name are both required but at least one of them is missing from the manifest")
}
resourceFullName := fmt.Sprintf("%s.%s/%s", resourceKind, resourceGroup, resourceName)
selfLink := obj.GetSelfLink()
log.Infof("Resource: %s/%s. SelfLink: %s", obj.GetNamespace(), resourceFullName, selfLink)
resourceNamespace := obj.GetNamespace()
// We cannot use `obj.GetSelfLink()` directly since it is deprecated and will be removed after Kubernetes 1.21: https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1164-remove-selflink
selfLink := fmt.Sprintf("apis/%s/namespaces/%s/%s/%s",
obj.GetAPIVersion(), resourceNamespace, resourceKind, resourceName)
log.Infof("Resource: %s/%s. SelfLink: %s", resourceNamespace, resourceFullName, selfLink)
return obj.GetNamespace(), resourceFullName, selfLink, nil
}

Expand Down

0 comments on commit d7c5cf6

Please sign in to comment.