Fix missing envs when updating application of content management plugin type (#2331)

Close: #2330
This commit is contained in:
Yujun Zhang 2019-09-20 01:21:43 +08:00 committed by Alexander Matyushentsev
parent affbfe9020
commit 06bab51ee2
2 changed files with 7 additions and 5 deletions

View file

@ -582,7 +582,7 @@ func (s *Server) validateAndNormalizeApp(ctx context.Context, app *appv1.Applica
return err
}
conditions, err := argo.ValidateRepo(ctx, &app.Spec, s.repoClientset, s.db, &kustomizeOptions, plugins, s.kubectl)
conditions, err := argo.ValidateRepo(ctx, app, s.repoClientset, s.db, &kustomizeOptions, plugins, s.kubectl)
if err != nil {
return err
}

View file

@ -130,13 +130,14 @@ func WaitForRefresh(ctx context.Context, appIf v1alpha1.ApplicationInterface, na
// * ksonnet: the specified environment exists
func ValidateRepo(
ctx context.Context,
spec *argoappv1.ApplicationSpec,
app *argoappv1.Application,
repoClientset apiclient.Clientset,
db db.ArgoDB,
kustomizeOptions *argoappv1.KustomizeOptions,
plugins []*argoappv1.ConfigManagementPlugin,
kubectl kube.Kubectl,
) ([]argoappv1.ApplicationCondition, error) {
spec := &app.Spec
conditions := make([]argoappv1.ApplicationCondition, 0)
// Test the repo
@ -219,7 +220,7 @@ func ValidateRepo(
if err != nil {
return nil, err
}
conditions = append(conditions, verifyGenerateManifests(ctx, repo, repos, spec, repoClient, kustomizeOptions, plugins, cluster.ServerVersion)...)
conditions = append(conditions, verifyGenerateManifests(ctx, repo, repos, app, repoClient, kustomizeOptions, plugins, cluster.ServerVersion)...)
return conditions, nil
}
@ -292,13 +293,13 @@ func verifyGenerateManifests(
ctx context.Context,
repoRes *argoappv1.Repository,
repos argoappv1.Repositories,
spec *argoappv1.ApplicationSpec,
app *argoappv1.Application,
repoClient apiclient.RepoServerServiceClient,
kustomizeOptions *argoappv1.KustomizeOptions,
plugins []*argoappv1.ConfigManagementPlugin,
kubeVersion string,
) []argoappv1.ApplicationCondition {
spec := &app.Spec
var conditions []argoappv1.ApplicationCondition
if spec.Destination.Server == "" || spec.Destination.Namespace == "" {
conditions = append(conditions, argoappv1.ApplicationCondition{
@ -315,6 +316,7 @@ func verifyGenerateManifests(
},
Repos: repos,
Revision: spec.Source.TargetRevision,
AppLabelValue: app.Name,
Namespace: spec.Destination.Namespace,
ApplicationSource: &spec.Source,
Plugins: plugins,