mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-24 09:50:08 +00:00
Label hooks so that the cluster resource watch will be notified about completions (#387)
This commit is contained in:
parent
543ae3cf13
commit
f65859bc25
1 changed files with 7 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ import (
|
|||
)
|
||||
|
||||
type syncContext struct {
|
||||
appName string
|
||||
comparison *appv1.ComparisonResult
|
||||
config *rest.Config
|
||||
dynClientPool dynamic.ClientPool
|
||||
|
|
@ -139,6 +140,7 @@ func (s *ksonnetAppStateManager) SyncAppState(app *appv1.Application, state *app
|
|||
}
|
||||
|
||||
syncCtx := syncContext{
|
||||
appName: app.Name,
|
||||
comparison: comparison,
|
||||
config: restConfig,
|
||||
dynClientPool: dynClientPool,
|
||||
|
|
@ -542,6 +544,11 @@ func (sc *syncContext) runHook(hook *unstructured.Unstructured, hookType appv1.H
|
|||
if !apierr.IsNotFound(err) {
|
||||
return false, fmt.Errorf("Failed to get status of %s hook %s '%s': %v", hookType, gvk, hook.GetName(), err)
|
||||
}
|
||||
hook = hook.DeepCopy()
|
||||
err = kube.SetLabel(hook, common.LabelApplicationName, sc.appName)
|
||||
if err != nil {
|
||||
sc.log.Warnf("Failed to set application label on hook %v: %v", hook, err)
|
||||
}
|
||||
_, err := kube.ApplyResource(sc.config, hook, sc.namespace, false, false)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("Failed to create %s hook %s '%s': %v", hookType, gvk, hook.GetName(), err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue