Skip to content
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

fix: remove argocd-cm plugin warnings #11740

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 0 additions & 55 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (

"github.com/argoproj/argo-cd/v2/cmd/argocd/commands/headless"
cmdutil "github.com/argoproj/argo-cd/v2/cmd/util"
argocommon "github.com/argoproj/argo-cd/v2/common"
"github.com/argoproj/argo-cd/v2/controller"
argocdclient "github.com/argoproj/argo-cd/v2/pkg/apiclient"
"github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
Expand Down Expand Up @@ -150,9 +149,6 @@ func NewApplicationCreateCommand(clientOpts *argocdclient.ClientOptions) *cobra.
c.HelpFunc()(c, args)
os.Exit(1)
}
if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
}
if appNamespace != "" {
app.Namespace = appNamespace
}
Expand Down Expand Up @@ -294,10 +290,6 @@ func NewApplicationGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com
})
errors.CheckError(err)

if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
}

pConn, projIf := headless.NewClientOrDie(clientOpts, c).NewProjectClientOrDie()
defer argoio.Close(pConn)
proj, err := projIf.Get(ctx, &projectpkg.ProjectQuery{Name: app.Spec.Project})
Expand Down Expand Up @@ -625,10 +617,6 @@ func NewApplicationSetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com
app, err := appIf.Get(ctx, &applicationpkg.ApplicationQuery{Name: &appName, AppNamespace: &appNs})
errors.CheckError(err)

if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
}

visited := cmdutil.SetAppSpecOptions(c.Flags(), &app.Spec, &appOpts)
if visited == 0 {
log.Error("Please set at least one option to update")
Expand Down Expand Up @@ -693,10 +681,6 @@ func NewApplicationUnsetCommand(clientOpts *argocdclient.ClientOptions) *cobra.C
app, err := appIf.Get(ctx, &applicationpkg.ApplicationQuery{Name: &appName, AppNamespace: &appNs})
errors.CheckError(err)

if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
}

source := app.Spec.GetSource()
updated, nothingToUnset := unset(&source, opts)
if nothingToUnset {
Expand Down Expand Up @@ -933,10 +917,6 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
})
errors.CheckError(err)

if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
}

resources, err := appIf.ManagedResources(ctx, &applicationpkg.ResourcesQuery{ApplicationName: &appName, AppNamespace: &appNs})
errors.CheckError(err)
conn, settingsIf := clientset.NewSettingsClientOrDie()
Expand Down Expand Up @@ -1301,17 +1281,6 @@ func NewApplicationListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
if cluster != "" {
appList = argo.FilterByCluster(appList, cluster)
}
var appsWithDeprecatedPlugins []string
for _, app := range appList {
if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
appsWithDeprecatedPlugins = append(appsWithDeprecatedPlugins, app.Name)
}
}

if len(appsWithDeprecatedPlugins) > 0 {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
log.Warnf("The following Applications use deprecated plugins: %s", strings.Join(appsWithDeprecatedPlugins, ", "))
}

switch output {
case "yaml", "json":
Expand Down Expand Up @@ -1670,10 +1639,6 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
}

if local != "" {
if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
}

if app.Spec.SyncPolicy != nil && app.Spec.SyncPolicy.Automated != nil && !dryRun {
log.Fatal("Cannot use local sync when Automatic Sync Policy is enabled except with --dry-run")
}
Expand Down Expand Up @@ -1747,10 +1712,6 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
}
}
if diffChanges {
if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
}

resources, err := appIf.ManagedResources(ctx, &applicationpkg.ResourcesQuery{
ApplicationName: &appName,
AppNamespace: &appNs,
Expand Down Expand Up @@ -2208,10 +2169,6 @@ func NewApplicationHistoryCommand(clientOpts *argocdclient.ClientOptions) *cobra
})
errors.CheckError(err)

if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
}

if output == "id" {
printApplicationHistoryIds(app.Status.History)
} else {
Expand Down Expand Up @@ -2272,10 +2229,6 @@ func NewApplicationRollbackCommand(clientOpts *argocdclient.ClientOptions) *cobr
})
errors.CheckError(err)

if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
}

depInfo, err := findRevisionHistory(app, int64(depID))
errors.CheckError(err)

Expand Down Expand Up @@ -2359,10 +2312,6 @@ func NewApplicationManifestsCommand(clientOpts *argocdclient.ClientOptions) *cob
app, err := appIf.Get(context.Background(), &applicationpkg.ApplicationQuery{Name: &appName})
errors.CheckError(err)

if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
}

settingsConn, settingsIf := clientset.NewSettingsClientOrDie()
defer argoio.Close(settingsConn)
argoSettings, err := settingsIf.Get(context.Background(), &settingspkg.SettingsQuery{})
Expand Down Expand Up @@ -2462,10 +2411,6 @@ func NewApplicationEditCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
})
errors.CheckError(err)

if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.Warnf(argocommon.ConfigMapPluginCLIDeprecationWarning)
}

appData, err := json.Marshal(app.Spec)
errors.CheckError(err)
appData, err = yaml.JSONToYAML(appData)
Expand Down
8 changes: 1 addition & 7 deletions common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,7 @@ const (
// DefaultCMPWorkDirName defines the work directory name used by the cmp-server
DefaultCMPWorkDirName = "_cmp_server"

ConfigMapPluginDeprecationWarning = "argocd-cm plugins are deprecated, and support will be removed in v2.6. Upgrade your plugin to be installed via sidecar. https://argo-cd.readthedocs.io/en/stable/user-guide/config-management-plugins/"

ConfigMapPluginCLIDeprecationWarning = "spec.plugin.name is set, which means this Application uses a plugin installed in the " +
"argocd-cm ConfigMap. Installing plugins via that ConfigMap is deprecated in Argo CD v2.5. " +
"Starting in Argo CD v2.6, this Application will fail to sync. Contact your Argo CD admin " +
"to make sure an upgrade plan is in place. More info: " +
"https://argo-cd.readthedocs.io/en/latest/operator-manual/upgrading/2.4-2.5/"
ConfigMapPluginDeprecationWarning = "argocd-cm plugins are deprecated, and support will be removed in v2.7. Upgrade your plugin to be installed via sidecar. https://argo-cd.readthedocs.io/en/stable/user-guide/config-management-plugins/"
)

const (
Expand Down
108 changes: 0 additions & 108 deletions server/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,6 @@ func (s *Server) Create(ctx context.Context, q *application.ApplicationCreateReq

created, err := s.appclientset.ArgoprojV1alpha1().Applications(appNs).Create(ctx, a, metav1.CreateOptions{})
if err == nil {
if a.Spec.GetSource().Plugin != nil && a.Spec.GetSource().Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": a.Spec.GetSource().Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

s.logAppEvent(created, ctx, argo.EventReasonResourceCreated, "created application")
s.waitSync(created)
return created, nil
Expand Down Expand Up @@ -336,12 +329,6 @@ func (s *Server) GetManifests(ctx context.Context, q *application.ApplicationMan
}

source := a.Spec.GetSource()
if source.Plugin != nil && source.Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": source.Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

if !s.isNamespaceEnabled(a.Namespace) {
return nil, security.NamespaceNotPermittedError(a.Namespace)
Expand Down Expand Up @@ -562,13 +549,6 @@ func (s *Server) Get(ctx context.Context, q *application.ApplicationQuery) (*app
return nil, err
}

if a.Spec.GetSource().Plugin != nil && a.Spec.GetSource().Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": a.Spec.GetSource().Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

s.inferResourcesStatusHealth(a)

if q.Refresh == nil {
Expand Down Expand Up @@ -657,13 +637,6 @@ func (s *Server) ListResourceEvents(ctx context.Context, q *application.Applicat
return nil, err
}

if a.Spec.GetSource().Plugin != nil && a.Spec.GetSource().Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": a.Spec.GetSource().Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

var (
kubeClientset kubernetes.Interface
fieldSelector string
Expand Down Expand Up @@ -830,13 +803,6 @@ func (s *Server) Update(ctx context.Context, q *application.ApplicationUpdateReq
return nil, err
}

if a.Spec.GetSource().Plugin != nil && a.Spec.GetSource().Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": a.Spec.GetSource().Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

validate := true
if q.Validate != nil {
validate = *q.Validate
Expand All @@ -859,13 +825,6 @@ func (s *Server) UpdateSpec(ctx context.Context, q *application.ApplicationUpdat
return nil, err
}

if a.Spec.GetSource().Plugin != nil && a.Spec.GetSource().Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": a.Spec.GetSource().Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

a.Spec = *q.GetSpec()
validate := true
if q.Validate != nil {
Expand All @@ -891,13 +850,6 @@ func (s *Server) Patch(ctx context.Context, q *application.ApplicationPatchReque
return nil, err
}

if app.Spec.GetSource().Plugin != nil && app.Spec.GetSource().Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": app.Name,
"plugin": app.Spec.GetSource().Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

jsonApp, err := json.Marshal(app)
if err != nil {
return nil, fmt.Errorf("error marshaling application: %w", err)
Expand Down Expand Up @@ -948,13 +900,6 @@ func (s *Server) Delete(ctx context.Context, q *application.ApplicationDeleteReq
return nil, err
}

if a.Spec.GetSource().Plugin != nil && a.Spec.GetSource().Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": a.Spec.GetSource().Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

if q.Cascade != nil && !*q.Cascade && q.GetPropagationPolicy() != "" {
return nil, status.Error(codes.InvalidArgument, "cannot set propagation policy when cascading is disabled")
}
Expand Down Expand Up @@ -1353,14 +1298,6 @@ func (s *Server) ResourceTree(ctx context.Context, q *application.ResourcesQuery
return nil, err
}

source := a.Spec.GetSource()
if source.Plugin != nil && source.Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": source.Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

return s.getAppResources(ctx, a)
}

Expand Down Expand Up @@ -1398,13 +1335,6 @@ func (s *Server) RevisionMetadata(ctx context.Context, q *application.RevisionMe
}

source := a.Spec.GetSource()
if source.Plugin != nil && source.Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": source.Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

repo, err := s.db.GetRepository(ctx, source.RepoURL)
if err != nil {
return nil, fmt.Errorf("error getting repository by URL: %w", err)
Expand Down Expand Up @@ -1445,14 +1375,6 @@ func (s *Server) ManagedResources(ctx context.Context, q *application.ResourcesQ
return nil, fmt.Errorf("error verifying rbac: %w", err)
}

source := a.Spec.GetSource()
if source.Plugin != nil && source.Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": source.Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

items := make([]*appv1.ResourceDiff, 0)
err = s.getCachedAppState(ctx, a, func() error {
return s.cache.GetAppManagedResources(a.InstanceName(s.ns), &items)
Expand Down Expand Up @@ -1516,14 +1438,6 @@ func (s *Server) PodLogs(q *application.ApplicationPodLogsQuery, ws application.
return err
}

source := a.Spec.GetSource()
if source.Plugin != nil && source.Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": source.Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

// Logs RBAC will be enforced only if an internal var serverRBACLogEnforceEnable (representing server.rbac.log.enforce.enable env var)
// is defined and has a "true" value
// Otherwise, no RBAC enforcement for logs will take place (meaning, PodLogs will return the logs,
Expand Down Expand Up @@ -1738,12 +1652,6 @@ func (s *Server) Sync(ctx context.Context, syncReq *application.ApplicationSyncR
}

source := a.Spec.GetSource()
if source.Plugin != nil && source.Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": source.Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

if syncReq.Manifests != nil {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceApplications, rbacpolicy.ActionOverride, a.RBACName(s.ns)); err != nil {
Expand Down Expand Up @@ -1837,14 +1745,6 @@ func (s *Server) Rollback(ctx context.Context, rollbackReq *application.Applicat
return nil, err
}

source := a.Spec.GetSource()
if source.Plugin != nil && source.Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": source.Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

s.inferResourcesStatusHealth(a)

if a.DeletionTimestamp != nil {
Expand Down Expand Up @@ -2274,14 +2174,6 @@ func (s *Server) GetApplicationSyncWindows(ctx context.Context, q *application.A
return nil, err
}

source := a.Spec.GetSource()
if source.Plugin != nil && source.Plugin.Name != "" {
log.WithFields(map[string]interface{}{
"application": a.Name,
"plugin": source.Plugin.Name,
}).Warnf(argocommon.ConfigMapPluginDeprecationWarning)
}

proj, err := argo.GetAppProject(a, applisters.NewAppProjectLister(s.projInformer.GetIndexer()), s.ns, s.settingsMgr, s.db, ctx)
if err != nil {
return nil, fmt.Errorf("error getting app project: %w", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,6 @@ export const ApplicationSummary = (props: ApplicationSummaryProps) => {

return (
<div className='application-summary'>
{source.plugin && typeof source.plugin.name === 'string' && source.plugin.name !== '' && (
<div className='white-box'>
<i className='fa fa-exclamation-triangle' style={{color: ARGO_WARNING_COLOR}} /> This Application uses a plugin which will no longer be supported starting with
Argo CD version 2.6. Contact your Argo CD administrator to make sure they upgrade the '{source.plugin.name}' plugin before upgrading to Argo CD 2.6. See the{' '}
<a href='https://argo-cd.readthedocs.io/en/latest/operator-manual/upgrading/2.4-2.5/'>2.4-to-2.5 upgrade notes</a> for details.
</div>
)}
<EditablePanel
save={updateApp}
validate={input => ({
Expand Down