From bb88a1c975b43a94da34c4516deaec44f32ac790 Mon Sep 17 00:00:00 2001 From: pasha-codefresh Date: Tue, 28 Sep 2021 18:35:17 +0300 Subject: [PATCH] feat: rename app identifier (#7251) feat: rename app identifier (#7251) Signed-off-by: pashavictorovich --- assets/swagger.json | 3 + cmd/argocd/commands/admin/app.go | 4 +- cmd/argocd/commands/app.go | 11 +- controller/appcontroller.go | 2 +- controller/cache/cache.go | 28 ++- controller/state.go | 2 + pkg/apiclient/settings/settings.pb.go | 179 +++++++++----- pkg/apis/application/v1alpha1/types.go | 2 + reposerver/apiclient/repository.pb.go | 283 ++++++++++++++++------- reposerver/cache/cache.go | 17 +- reposerver/cache/cache_test.go | 10 +- reposerver/repository/repository.go | 14 +- reposerver/repository/repository.proto | 2 + reposerver/repository/repository_test.go | 4 +- reposerver/server.go | 4 +- server/application/application.go | 4 +- server/settings/settings.go | 6 + server/settings/settings.proto | 1 + util/argo/argo.go | 6 +- util/argo/argo_test.go | 29 ++- util/argo/resource_tracking.go | 63 +++++ util/argo/resource_tracking_test.go | 60 +++++ util/argo/testdata/svc.yaml | 11 + util/kube/kube.go | 28 +++ util/kube/kube_test.go | 45 ++++ util/settings/settings.go | 10 + 26 files changed, 637 insertions(+), 191 deletions(-) create mode 100644 util/argo/resource_tracking.go create mode 100644 util/argo/resource_tracking_test.go create mode 100644 util/argo/testdata/svc.yaml diff --git a/assets/swagger.json b/assets/swagger.json index aa2e7f2e4dc90..2a0af5a655341 100644 --- a/assets/swagger.json +++ b/assets/swagger.json @@ -3660,6 +3660,9 @@ "statusBadgeEnabled": { "type": "boolean" }, + "trackingMethod": { + "type": "string" + }, "uiBannerContent": { "type": "string" }, diff --git a/cmd/argocd/commands/admin/app.go b/cmd/argocd/commands/admin/app.go index 51a2073c143ee..d3202492b46c5 100644 --- a/cmd/argocd/commands/admin/app.go +++ b/cmd/argocd/commands/admin/app.go @@ -10,6 +10,8 @@ import ( "sort" "time" + "github.com/argoproj/argo-cd/v2/util/argo" + "github.com/ghodss/yaml" "github.com/spf13/cobra" apiv1 "k8s.io/api/core/v1" @@ -408,5 +410,5 @@ func reconcileApplications( } func newLiveStateCache(argoDB db.ArgoDB, appInformer kubecache.SharedIndexInformer, settingsMgr *settings.SettingsManager, server *metrics.MetricsServer) cache.LiveStateCache { - return cache.NewLiveStateCache(argoDB, appInformer, settingsMgr, kubeutil.NewKubectl(), server, func(managedByApp map[string]bool, ref apiv1.ObjectReference) {}, nil) + return cache.NewLiveStateCache(argoDB, appInformer, settingsMgr, kubeutil.NewKubectl(), server, func(managedByApp map[string]bool, ref apiv1.ObjectReference) {}, nil, argo.NewResourceTracking()) } diff --git a/cmd/argocd/commands/app.go b/cmd/argocd/commands/app.go index 782f278170905..da601b7741e8b 100644 --- a/cmd/argocd/commands/app.go +++ b/cmd/argocd/commands/app.go @@ -733,8 +733,8 @@ func liveObjects(resources []*argoappv1.ResourceDiff) ([]*unstructured.Unstructu } func getLocalObjects(app *argoappv1.Application, local, localRepoRoot, appLabelKey, kubeVersion string, kustomizeOptions *argoappv1.KustomizeOptions, - configManagementPlugins []*argoappv1.ConfigManagementPlugin) []*unstructured.Unstructured { - manifestStrings := getLocalObjectsString(app, local, localRepoRoot, appLabelKey, kubeVersion, kustomizeOptions, configManagementPlugins) + configManagementPlugins []*argoappv1.ConfigManagementPlugin, trackingMethod string) []*unstructured.Unstructured { + manifestStrings := getLocalObjectsString(app, local, localRepoRoot, appLabelKey, kubeVersion, kustomizeOptions, configManagementPlugins, trackingMethod) objs := make([]*unstructured.Unstructured, len(manifestStrings)) for i := range manifestStrings { obj := unstructured.Unstructured{} @@ -746,7 +746,7 @@ func getLocalObjects(app *argoappv1.Application, local, localRepoRoot, appLabelK } func getLocalObjectsString(app *argoappv1.Application, local, localRepoRoot, appLabelKey, kubeVersion string, kustomizeOptions *argoappv1.KustomizeOptions, - configManagementPlugins []*argoappv1.ConfigManagementPlugin) []string { + configManagementPlugins []*argoappv1.ConfigManagementPlugin, trackingMethod string) []string { res, err := repository.GenerateManifests(local, localRepoRoot, app.Spec.Source.TargetRevision, &repoapiclient.ManifestRequest{ Repo: &argoappv1.Repository{Repo: app.Spec.Source.RepoURL}, @@ -757,6 +757,7 @@ func getLocalObjectsString(app *argoappv1.Application, local, localRepoRoot, app KustomizeOptions: kustomizeOptions, KubeVersion: kubeVersion, Plugins: configManagementPlugins, + TrackingMethod: trackingMethod, }, true) errors.CheckError(err) @@ -842,7 +843,7 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co defer argoio.Close(conn) cluster, err := clusterIf.Get(context.Background(), &clusterpkg.ClusterQuery{Name: app.Spec.Destination.Name, Server: app.Spec.Destination.Server}) errors.CheckError(err) - localObjs := groupObjsByKey(getLocalObjects(app, local, localRepoRoot, argoSettings.AppLabelKey, cluster.ServerVersion, argoSettings.KustomizeOptions, argoSettings.ConfigManagementPlugins), liveObjs, app.Spec.Destination.Namespace) + localObjs := groupObjsByKey(getLocalObjects(app, local, localRepoRoot, argoSettings.AppLabelKey, cluster.ServerVersion, argoSettings.KustomizeOptions, argoSettings.ConfigManagementPlugins, argoSettings.TrackingMethod), liveObjs, app.Spec.Destination.Namespace) items = groupObjsForDiff(resources, localObjs, items, argoSettings, appName) } else if revision != "" { var unstructureds []*unstructured.Unstructured @@ -1377,7 +1378,7 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co cluster, err := clusterIf.Get(context.Background(), &clusterpkg.ClusterQuery{Name: app.Spec.Destination.Name, Server: app.Spec.Destination.Server}) errors.CheckError(err) argoio.Close(conn) - localObjsStrings = getLocalObjectsString(app, local, localRepoRoot, argoSettings.AppLabelKey, cluster.ServerVersion, argoSettings.KustomizeOptions, argoSettings.ConfigManagementPlugins) + localObjsStrings = getLocalObjectsString(app, local, localRepoRoot, argoSettings.AppLabelKey, cluster.ServerVersion, argoSettings.KustomizeOptions, argoSettings.ConfigManagementPlugins, argoSettings.TrackingMethod) } syncReq := applicationpkg.ApplicationSyncRequest{ diff --git a/controller/appcontroller.go b/controller/appcontroller.go index 6626602d9f20b..d7e63fa451382 100644 --- a/controller/appcontroller.go +++ b/controller/appcontroller.go @@ -195,7 +195,7 @@ func NewApplicationController( return nil, err } } - stateCache := statecache.NewLiveStateCache(db, appInformer, ctrl.settingsMgr, kubectl, ctrl.metricsServer, ctrl.handleObjectUpdated, clusterFilter) + stateCache := statecache.NewLiveStateCache(db, appInformer, ctrl.settingsMgr, kubectl, ctrl.metricsServer, ctrl.handleObjectUpdated, clusterFilter, argo.NewResourceTracking()) appStateManager := NewAppStateManager(db, applicationClientset, repoClientset, namespace, kubectl, ctrl.settingsMgr, stateCache, projInformer, ctrl.metricsServer, argoCache, ctrl.statusRefreshTimeout) ctrl.appInformer = appInformer ctrl.appLister = appLister diff --git a/controller/cache/cache.go b/controller/cache/cache.go index 781eaea7c1d7a..4529a46d9220c 100644 --- a/controller/cache/cache.go +++ b/controller/cache/cache.go @@ -105,7 +105,8 @@ func NewLiveStateCache( kubectl kube.Kubectl, metricsServer *metrics.MetricsServer, onObjectUpdated ObjectUpdatedHandler, - clusterFilter func(cluster *appv1.Cluster) bool) LiveStateCache { + clusterFilter func(cluster *appv1.Cluster) bool, + resourceTracking argo.ResourceTracking) LiveStateCache { return &liveStateCache{ appInformer: appInformer, @@ -116,8 +117,9 @@ func NewLiveStateCache( settingsMgr: settingsMgr, metricsServer: metricsServer, // The default limit of 50 is chosen based on experiments. - listSemaphore: semaphore.NewWeighted(50), - clusterFilter: clusterFilter, + listSemaphore: semaphore.NewWeighted(50), + clusterFilter: clusterFilter, + resourceTracking: resourceTracking, } } @@ -127,13 +129,14 @@ type cacheSettings struct { } type liveStateCache struct { - db db.ArgoDB - appInformer cache.SharedIndexInformer - onObjectUpdated ObjectUpdatedHandler - kubectl kube.Kubectl - settingsMgr *settings.SettingsManager - metricsServer *metrics.MetricsServer - clusterFilter func(cluster *appv1.Cluster) bool + db db.ArgoDB + appInformer cache.SharedIndexInformer + onObjectUpdated ObjectUpdatedHandler + kubectl kube.Kubectl + settingsMgr *settings.SettingsManager + metricsServer *metrics.MetricsServer + clusterFilter func(cluster *appv1.Cluster) bool + resourceTracking argo.ResourceTracking // listSemaphore is used to limit the number of concurrent memory consuming operations on the // k8s list queries results across all clusters to avoid memory spikes during cache initialization. @@ -285,6 +288,8 @@ func (c *liveStateCache) getCluster(server string) (clustercache.ClusterCache, e return nil, fmt.Errorf("controller is configured to ignore cluster %s", cluster.Server) } + trackingMethod := argo.GetTrackingMethod(c.settingsMgr) + clusterCache = clustercache.NewClusterCache(cluster.RESTConfig(), clustercache.SetListSemaphore(c.listSemaphore), clustercache.SetResyncTimeout(K8SClusterResyncDuration), @@ -295,7 +300,8 @@ func (c *liveStateCache) getCluster(server string) (clustercache.ClusterCache, e res := &ResourceInfo{} populateNodeInfo(un, res) res.Health, _ = health.GetResourceHealth(un, cacheSettings.clusterSettings.ResourceHealthOverride) - appName := kube.GetAppInstanceLabel(un, cacheSettings.appInstanceLabelKey) + + appName := c.resourceTracking.GetAppName(un, cacheSettings.appInstanceLabelKey, trackingMethod) if isRoot && appName != "" { res.AppName = appName } diff --git a/controller/state.go b/controller/state.go index a6819a88afb55..f164c52103b0c 100644 --- a/controller/state.go +++ b/controller/state.go @@ -148,6 +148,7 @@ func (m *appStateManager) getRepoObjs(app *v1alpha1.Application, source v1alpha1 if err != nil { return nil, nil, err } + kustomizeOptions, err := kustomizeSettings.GetOptions(app.Spec.Source) if err != nil { return nil, nil, err @@ -174,6 +175,7 @@ func (m *appStateManager) getRepoObjs(app *v1alpha1.Application, source v1alpha1 ApiVersions: argo.APIGroupsToVersions(apiGroups), VerifySignature: verifySignature, HelmRepoCreds: permittedHelmCredentials, + TrackingMethod: string(argo.GetTrackingMethod(m.settingsMgr)), }) if err != nil { return nil, nil, err diff --git a/pkg/apiclient/settings/settings.pb.go b/pkg/apiclient/settings/settings.pb.go index 054eca11ff258..f608640196691 100644 --- a/pkg/apiclient/settings/settings.pb.go +++ b/pkg/apiclient/settings/settings.pb.go @@ -93,6 +93,7 @@ type Settings struct { UiBannerContent string `protobuf:"bytes,15,opt,name=uiBannerContent,proto3" json:"uiBannerContent,omitempty"` UiBannerURL string `protobuf:"bytes,16,opt,name=uiBannerURL,proto3" json:"uiBannerURL,omitempty"` PasswordPattern string `protobuf:"bytes,17,opt,name=passwordPattern,proto3" json:"passwordPattern,omitempty"` + TrackingMethod string `protobuf:"bytes,18,opt,name=trackingMethod,proto3" json:"trackingMethod,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -250,6 +251,13 @@ func (m *Settings) GetPasswordPattern() string { return "" } +func (m *Settings) GetTrackingMethod() string { + if m != nil { + return m.TrackingMethod + } + return "" +} + type GoogleAnalyticsConfig struct { TrackingID string `protobuf:"bytes,1,opt,name=trackingID,proto3" json:"trackingID,omitempty"` AnonymizeUsers bool `protobuf:"varint,2,opt,name=anonymizeUsers,proto3" json:"anonymizeUsers,omitempty"` @@ -617,70 +625,70 @@ func init() { func init() { proto.RegisterFile("server/settings/settings.proto", fileDescriptor_a480d494da040caa) } var fileDescriptor_a480d494da040caa = []byte{ - // 996 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0x97, 0x9b, 0x6e, 0x9b, 0xbc, 0x6c, 0x9b, 0x76, 0x80, 0x62, 0xa2, 0x55, 0x1a, 0x72, 0x58, - 0x05, 0x09, 0x6c, 0x9a, 0x15, 0x02, 0x21, 0x24, 0x20, 0xce, 0x6a, 0x37, 0x6c, 0x96, 0x96, 0xd9, + // 1008 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x6f, 0xe3, 0x44, + 0x14, 0x97, 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d, 0xe1, 0xbf, 0xb2, 0x3a, 0x5b, 0xb4, 0x4e, + 0xf9, 0x52, 0x48, 0x37, 0x96, 0x63, 0xe2, 0x57, 0xe8, 0x3b, 0xf8, 0x06, 0x5a, 0xc5, 0xe2, 0x79, + 0x46, 0xe5, 0x8c, 0xf9, 0x14, 0x7d, 0x01, 0xb5, 0xc7, 0x54, 0xa3, 0xfd, 0x95, 0xcd, 0x64, 0xb6, + 0x71, 0x7b, 0x6f, 0x05, 0xef, 0xd9, 0x3f, 0xfc, 0xf1, 0xd7, 0xcf, 0x77, 0x10, 0xda, 0x35, 0x2f, + 0x8c, 0xd9, 0x61, 0xb9, 0xdd, 0x87, 0xde, 0x6f, 0x8b, 0x8e, 0xf5, 0xfb, 0xa2, 0x63, 0xfd, 0xb9, + 0xe8, 0x58, 0x5f, 0x7f, 0xf0, 0xff, 0x5e, 0x1a, 0xd9, 0x37, 0x2c, 0x83, 0x5c, 0x6c, 0x9a, 0x77, + 0xc1, 0xc3, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x16, 0xf9, 0xe1, 0x89, 0x06, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -816,6 +824,15 @@ func (m *Settings) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.TrackingMethod) > 0 { + i -= len(m.TrackingMethod) + copy(dAtA[i:], m.TrackingMethod) + i = encodeVarintSettings(dAtA, i, uint64(len(m.TrackingMethod))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 + } if len(m.PasswordPattern) > 0 { i -= len(m.PasswordPattern) copy(dAtA[i:], m.PasswordPattern) @@ -1409,6 +1426,10 @@ func (m *Settings) Size() (n int) { if l > 0 { n += 2 + l + sovSettings(uint64(l)) } + l = len(m.TrackingMethod) + if l > 0 { + n += 2 + l + sovSettings(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2282,6 +2303,38 @@ func (m *Settings) Unmarshal(dAtA []byte) error { } m.PasswordPattern = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrackingMethod", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSettings + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSettings + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSettings + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TrackingMethod = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSettings(dAtA[iNdEx:]) diff --git a/pkg/apis/application/v1alpha1/types.go b/pkg/apis/application/v1alpha1/types.go index bdcaa5a59f048..af27f8b8aa098 100644 --- a/pkg/apis/application/v1alpha1/types.go +++ b/pkg/apis/application/v1alpha1/types.go @@ -74,6 +74,8 @@ type ApplicationSpec struct { RevisionHistoryLimit *int64 `json:"revisionHistoryLimit,omitempty" protobuf:"bytes,7,name=revisionHistoryLimit"` } +type TrackingMethod string + // ResourceIgnoreDifferences contains resource filter and list of json paths which should be ignored during comparison with live state. type ResourceIgnoreDifferences struct { Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"` diff --git a/reposerver/apiclient/repository.pb.go b/reposerver/apiclient/repository.pb.go index e14d0a99f558a..e8c1ad1baa8b2 100644 --- a/reposerver/apiclient/repository.pb.go +++ b/reposerver/apiclient/repository.pb.go @@ -50,6 +50,7 @@ type ManifestRequest struct { VerifySignature bool `protobuf:"varint,16,opt,name=verifySignature,proto3" json:"verifySignature,omitempty"` HelmRepoCreds []*v1alpha1.RepoCreds `protobuf:"bytes,17,rep,name=helmRepoCreds,proto3" json:"helmRepoCreds,omitempty"` NoRevisionCache bool `protobuf:"varint,18,opt,name=noRevisionCache,proto3" json:"noRevisionCache,omitempty"` + TrackingMethod string `protobuf:"bytes,19,opt,name=trackingMethod,proto3" json:"trackingMethod,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -193,6 +194,13 @@ func (m *ManifestRequest) GetNoRevisionCache() bool { return false } +func (m *ManifestRequest) GetTrackingMethod() string { + if m != nil { + return m.TrackingMethod + } + return "" +} + // TestRepositoryRequest is a query to test repository is valid or not and has valid access. type TestRepositoryRequest struct { Repo *v1alpha1.Repository `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"` @@ -595,6 +603,7 @@ type RepoServerAppDetailsQuery struct { AppName string `protobuf:"bytes,5,opt,name=appName,proto3" json:"appName,omitempty"` NoCache bool `protobuf:"varint,6,opt,name=noCache,proto3" json:"noCache,omitempty"` NoRevisionCache bool `protobuf:"varint,7,opt,name=noRevisionCache,proto3" json:"noRevisionCache,omitempty"` + TrackingMethod string `protobuf:"bytes,8,opt,name=trackingMethod,proto3" json:"trackingMethod,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -682,6 +691,13 @@ func (m *RepoServerAppDetailsQuery) GetNoRevisionCache() bool { return false } +func (m *RepoServerAppDetailsQuery) GetTrackingMethod() string { + if m != nil { + return m.TrackingMethod + } + return "" +} + // RepoAppDetailsResponse application details type RepoAppDetailsResponse struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` @@ -1367,95 +1383,96 @@ func init() { } var fileDescriptor_dd8723cfcc820480 = []byte{ - // 1399 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0x4b, 0x6f, 0xdb, 0xc6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, 0x95, 0x70, 0x8c, 0xdf, 0x34, 0x68, 0x66, 0xa0, 0x14, 0x1b, 0xd9, 0x80, 0xfa, - 0x38, 0xa6, 0x05, 0xba, 0x26, 0x2f, 0x2e, 0x23, 0xe4, 0x7b, 0xbc, 0x52, 0xec, 0xf1, 0xcb, 0xb0, - 0x1c, 0xa1, 0xb7, 0x84, 0x95, 0xba, 0x15, 0xef, 0x72, 0x58, 0x54, 0x2d, 0x60, 0x51, 0x1b, 0x20, - 0x90, 0x2d, 0xfa, 0xec, 0x98, 0xa3, 0xbe, 0x2c, 0xb9, 0x0a, 0x85, 0x18, 0x70, 0x2e, 0xaa, 0x08, - 0x0b, 0x83, 0xc9, 0x28, 0xd4, 0x6b, 0x52, 0x22, 0x47, 0x33, 0x3c, 0x58, 0x7b, 0xcc, 0xc4, 0x19, - 0x8e, 0x82, 0xb3, 0xb9, 0x83, 0x0f, 0xa1, 0x2a, 0x9c, 0x89, 0x83, 0x1d, 0xfa, 0xd4, 0xb5, 0x07, - 0x98, 0xe4, 0x2a, 0xdd, 0x13, 0x02, 0xd5, 0x90, 0x3a, 0x81, 0x5e, 0x91, 0x74, 0xb9, 0x36, 0x7e, - 0xd0, 0xa2, 0x48, 0x7b, 0x9c, 0x07, 0xef, 0xfc, 0x19, 0x30, 0x26, 0x50, 0xeb, 0x71, 0x2e, 0xe2, - 0x21, 0x37, 0xa1, 0x4a, 0x39, 0x8f, 0x0e, 0xd1, 0xe8, 0x5e, 0x31, 0x95, 0x27, 0x37, 0x16, 0x11, - 0xff, 0x83, 0x07, 0x6e, 0x28, 0x2c, 0x0b, 0xd1, 0xd6, 0x47, 0x50, 0x4f, 0x49, 0xa4, 0x09, 0x8b, - 0x43, 0x8c, 0x6a, 0xad, 0x6e, 0x89, 0x25, 0xb9, 0x08, 0x4b, 0x53, 0x3a, 0x9a, 0x24, 0x55, 0x12, - 0x6d, 0xee, 0x56, 0xee, 0x68, 0xc6, 0xcf, 0x55, 0xf8, 0xaf, 0x88, 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0xfc, 0x5e, 0x81, 0xd5, 0xfc, 0x45, 0x88, 0x9b, 0x14, 0xcf, 0x46, 0x72, 0x93, 0x62, - 0x4d, 0xf6, 0xe1, 0x1c, 0xba, 0x53, 0xe6, 0x7b, 0xae, 0x18, 0x78, 0x92, 0xce, 0xf9, 0xe0, 0xe4, - 0xeb, 0x34, 0x1f, 0x28, 0xe2, 0x11, 0x34, 0xe5, 0x2c, 0x10, 0x17, 0x80, 0x53, 0x9f, 0x8e, 0x31, - 0x44, 0x5f, 0xb4, 0xc7, 0xe2, 0x1b, 0x68, 0x8f, 0x28, 0x82, 0xfd, 0xc4, 0xac, 0xa5, 0x78, 0x68, - 0xbd, 0x80, 0xf5, 0x99, 0x90, 0x4a, 0xa0, 0xf1, 0xb6, 0x0a, 0x8d, 0x8d, 0x6e, 0xbb, 0xe4, 0x84, - 0x8a, 0x19, 0x15, 0x3a, 0x7f, 0xa9, 0x40, 0x43, 0xa9, 0xcf, 0xd2, 0x34, 0xb6, 0x01, 0xa4, 0xc2, - 0x43, 0x36, 0xc2, 0x28, 0x89, 0x75, 0x4b, 0xa1, 0x90, 0x61, 0x49, 0x52, 0x76, 0xe7, 0x4b, 0x8a, - 0x08, 0xa9, 0x34, 0x23, 0x62, 0x22, 0x90, 0xae, 0x83, 0x18, 0x29, 0xe2, 0x1d, 0xf9, 0x06, 0x56, - 0x8f, 0xd8, 0x08, 0xf7, 0xb3, 0x40, 0x96, 0x65, 0x20, 0x7b, 0xf3, 0x07, 0xf2, 0x50, 0xb5, 0x6b, - 0x15, 0xdc, 0x18, 0xef, 0x43, 0xb3, 0xd8, 0xae, 0x22, 0x48, 0x36, 0xa6, 0x4e, 0x9a, 0xad, 0x78, - 0x67, 0xfc, 0xa8, 0x01, 0x99, 0xbd, 0x8f, 0x93, 0x92, 0x3e, 0xbc, 0x13, 0x24, 0x13, 0x71, 0xd4, - 0x28, 0x0a, 0x85, 0xec, 0x42, 0xa3, 0x8f, 0x41, 0xc8, 0x5c, 0x19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0x9d, 0x9c, 0x30, 0xf7, 0xe5, 0x8f, 0x56, 0xfe, 0xfe, 0x1b, 0x0b, 0xe4, 0x27, 0x0d, 0x2e, - 0xec, 0x60, 0x58, 0x7c, 0x0b, 0xc9, 0x8d, 0x72, 0x27, 0x27, 0xbc, 0x99, 0xad, 0xa7, 0xf3, 0xd6, - 0x6c, 0xde, 0xac, 0xb1, 0x40, 0xf6, 0xe5, 0xb1, 0xb3, 0xda, 0x23, 0x57, 0x4a, 0x8b, 0x2c, 0xcd, - 0x5e, 0xfb, 0x24, 0x76, 0x72, 0xd4, 0x4f, 0x7a, 0x7f, 0xbc, 0x6e, 0x6b, 0x7f, 0xbe, 0x6e, 0x6b, - 0x7f, 0xbf, 0x6e, 0x6b, 0x5f, 0xde, 0xfa, 0x97, 0x9f, 0xa3, 0x94, 0x5f, 0xce, 0x28, 0x67, 0xf6, - 0x88, 0xa1, 0x1b, 0x1e, 0x2e, 0xcb, 0x1f, 0x9f, 0x6e, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0x9e, - 0x66, 0xb6, 0xa2, 0x58, 0x13, 0x00, 0x00, + // 1423 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0x5b, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0x26, 0x4e, 0x62, 0x1f, 0xb7, 0x89, 0x33, 0xbd, 0xfc, 0xf7, 0x6f, 0x52, 0x2b, 0x5d, + 0x89, 0x2a, 0x50, 0xba, 0x56, 0xdd, 0x0a, 0xaa, 0x56, 0x42, 0x32, 0x69, 0x9b, 0x4a, 0x69, 0x9a, + 0xb0, 0x29, 0x48, 0xa0, 0x8a, 0x6a, 0xb2, 0x3e, 0x59, 0x0f, 0xb6, 0x77, 0xa7, 0xbb, 0x6b, 0xa3, + 0x54, 0xe2, 0x11, 0xf1, 0xc0, 0x33, 0x7c, 0x1d, 0x5e, 0xb8, 0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x27, 0xb3, 0x39, 0xde, 0x29, 0x58, 0xb5, 0xa6, 0xfc, 0x88, 0x22, 0x19, 0x8c, + 0x0f, 0xf1, 0x73, 0xf4, 0x65, 0x75, 0xad, 0x44, 0x45, 0xa2, 0x90, 0xa2, 0x32, 0x62, 0xf1, 0x2e, + 0xd0, 0x57, 0x37, 0x16, 0xa2, 0x32, 0x4a, 0x49, 0x64, 0x13, 0x56, 0x27, 0xe8, 0xb3, 0xa3, 0xe3, + 0x03, 0xe6, 0xb8, 0x34, 0x1c, 0xfb, 0xa8, 0x37, 0x64, 0x29, 0x16, 0xc9, 0x64, 0x04, 0xe7, 0xfb, + 0x38, 0x1c, 0x89, 0x94, 0x6f, 0xf9, 0xd8, 0x0b, 0xf4, 0x35, 0x99, 0xdf, 0xed, 0xd9, 0x6f, 0x50, + 0x9a, 0xb3, 0xf2, 0xd6, 0x45, 0x60, 0xae, 0x67, 0xc5, 0x2f, 0x25, 0x7a, 0x23, 0x24, 0x0a, 0xac, + 0x40, 0x26, 0xd7, 0x60, 0x25, 0xf4, 0xa9, 0x3d, 0x60, 0xae, 0xb3, 0x8b, 0x61, 0xdf, 0xeb, 0xe9, + 0x17, 0x64, 0x26, 0x0a, 0x54, 0x63, 0x0c, 0x97, 0x9e, 0xca, 0x67, 0x9f, 0xd6, 0xcc, 0x59, 0x00, + 0x80, 0xf1, 0x08, 0x2e, 0x17, 0xdd, 0x06, 0xdc, 0x73, 0x03, 0x24, 0x26, 0x10, 0x99, 0x64, 0x86, + 0xbd, 0x8c, 0x2b, 0xa3, 0xa8, 0x5a, 0x25, 0x1c, 0xe3, 0x37, 0x0d, 0x1a, 0x19, 0x78, 0xc5, 0x46, + 0xd6, 0xa1, 0x36, 0x8a, 0x69, 0x81, 0xae, 0xc9, 0x0b, 0xce, 0x08, 0x79, 0x2c, 0x98, 0x2f, 0x62, + 0xc1, 0x65, 0x58, 0x8a, 0x50, 0x5e, 0xc2, 0x4f, 0xcd, 0x8a, 0x77, 0x39, 0xcc, 0xaa, 0x14, 0x30, + 0xab, 0x05, 0x10, 0xc8, 0xa7, 0xfc, 0xf4, 0x98, 0xa3, 0xbe, 0x24, 0xb9, 0x0a, 0x85, 0x18, 0x70, + 0x2e, 0xaa, 0x1c, 0x0b, 0x83, 0xf1, 0x30, 0xd4, 0x97, 0xa5, 0x44, 0x8e, 0x66, 0x78, 0xb0, 0xfa, + 0x98, 0x89, 0x33, 0x1c, 0x05, 0x67, 0x73, 0x07, 0x1f, 0x42, 0x45, 0x38, 0x13, 0x07, 0x3b, 0xf4, + 0xa9, 0x6b, 0xf7, 0x31, 0xc9, 0x55, 0xba, 0x27, 0x04, 0x2a, 0x21, 0x75, 0x02, 0x7d, 0x5e, 0xd2, + 0xe5, 0xda, 0xf8, 0x41, 0x8b, 0x22, 0xed, 0x72, 0x1e, 0xbc, 0xf5, 0x76, 0x61, 0x8c, 0x61, 0xb9, + 0xcb, 0xb9, 0x88, 0x87, 0xdc, 0x84, 0x0a, 0xe5, 0x3c, 0x3a, 0x44, 0xbd, 0x73, 0xc5, 0x54, 0x5a, + 0x73, 0x2c, 0x22, 0xfe, 0x07, 0x0f, 0xdc, 0x50, 0x58, 0x16, 0xa2, 0xcd, 0x8f, 0xa0, 0x96, 0x92, + 0x48, 0x03, 0x16, 0x06, 0x18, 0xd5, 0x5a, 0xcd, 0x12, 0x4b, 0x72, 0x11, 0x16, 0x27, 0x74, 0x38, + 0x4e, 0xaa, 0x24, 0xda, 0xdc, 0x9d, 0xbf, 0xa3, 0x19, 0xbf, 0x54, 0xe0, 0xff, 0x22, 0xce, 0x03, + 0x59, 0x1c, 0x5d, 0xce, 0xef, 0x63, 0x48, 0xd9, 0x30, 0xf8, 0x74, 0x8c, 0xfe, 0xf1, 0x1b, 0x4e, + 0x87, 0x03, 0x4b, 0x51, 0x6d, 0xc9, 0xb0, 0xde, 0x40, 0x8b, 0x8a, 0xcd, 0x67, 0x7d, 0x69, 0xe1, + 0xcd, 0xf4, 0xa5, 0xb2, 0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d6, 0x6c, 0xde, 0xac, 0x31, 0x47, 0xf6, 0xe5, 0xb1, + 0xb3, 0xda, 0x23, 0x57, 0x4a, 0x8b, 0x2c, 0xcd, 0x5e, 0xeb, 0x24, 0x76, 0x72, 0xd4, 0x4f, 0xba, + 0x7f, 0xbc, 0x6a, 0x69, 0x7f, 0xbe, 0x6a, 0x69, 0x7f, 0xbd, 0x6a, 0x69, 0x5f, 0xde, 0xfa, 0x97, + 0xcf, 0x5b, 0xca, 0x97, 0x38, 0xca, 0x99, 0x3d, 0x64, 0xe8, 0x86, 0x87, 0x4b, 0xf2, 0x63, 0xd6, + 0xad, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x25, 0x4e, 0x84, 0xa1, 0xa8, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1792,6 +1809,15 @@ func (m *ManifestRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.TrackingMethod) > 0 { + i -= len(m.TrackingMethod) + copy(dAtA[i:], m.TrackingMethod) + i = encodeVarintRepository(dAtA, i, uint64(len(m.TrackingMethod))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a + } if m.NoRevisionCache { i-- if m.NoRevisionCache { @@ -2300,6 +2326,13 @@ func (m *RepoServerAppDetailsQuery) MarshalToSizedBuffer(dAtA []byte) (int, erro i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.TrackingMethod) > 0 { + i -= len(m.TrackingMethod) + copy(dAtA[i:], m.TrackingMethod) + i = encodeVarintRepository(dAtA, i, uint64(len(m.TrackingMethod))) + i-- + dAtA[i] = 0x42 + } if m.NoRevisionCache { i-- if m.NoRevisionCache { @@ -3032,6 +3065,10 @@ func (m *ManifestRequest) Size() (n int) { if m.NoRevisionCache { n += 3 } + l = len(m.TrackingMethod) + if l > 0 { + n += 2 + l + sovRepository(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -3221,6 +3258,10 @@ func (m *RepoServerAppDetailsQuery) Size() (n int) { if m.NoRevisionCache { n += 2 } + l = len(m.TrackingMethod) + if l > 0 { + n += 1 + l + sovRepository(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -3982,6 +4023,38 @@ func (m *ManifestRequest) Unmarshal(dAtA []byte) error { } } m.NoRevisionCache = bool(v != 0) + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrackingMethod", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRepository + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRepository + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRepository + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TrackingMethod = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRepository(dAtA[iNdEx:]) @@ -5147,6 +5220,38 @@ func (m *RepoServerAppDetailsQuery) Unmarshal(dAtA []byte) error { } } m.NoRevisionCache = bool(v != 0) + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrackingMethod", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRepository + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRepository + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRepository + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TrackingMethod = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRepository(dAtA[iNdEx:]) diff --git a/reposerver/cache/cache.go b/reposerver/cache/cache.go index 273be2ee92539..265d9a0aabab6 100644 --- a/reposerver/cache/cache.go +++ b/reposerver/cache/cache.go @@ -10,6 +10,8 @@ import ( "strings" "time" + "github.com/argoproj/argo-cd/v2/util/argo" + "github.com/go-git/go-git/v5/plumbing" "github.com/go-redis/redis/v8" log "github.com/sirupsen/logrus" @@ -190,16 +192,19 @@ func (c *Cache) DeleteManifests(revision string, appSrc *appv1.ApplicationSource return c.cache.SetItem(manifestCacheKey(revision, appSrc, namespace, appLabelKey, appName, clusterInfo), "", c.repoCacheExpiration, true) } -func appDetailsCacheKey(revision string, appSrc *appv1.ApplicationSource) string { - return fmt.Sprintf("appdetails|%s|%d", revision, appSourceKey(appSrc)) +func appDetailsCacheKey(revision string, appSrc *appv1.ApplicationSource, trackingMethod appv1.TrackingMethod) string { + if trackingMethod == "" { + trackingMethod = argo.TrackingMethodLabel + } + return fmt.Sprintf("appdetails|%s|%d|%s", revision, appSourceKey(appSrc), trackingMethod) } -func (c *Cache) GetAppDetails(revision string, appSrc *appv1.ApplicationSource, res *apiclient.RepoAppDetailsResponse) error { - return c.cache.GetItem(appDetailsCacheKey(revision, appSrc), res) +func (c *Cache) GetAppDetails(revision string, appSrc *appv1.ApplicationSource, res *apiclient.RepoAppDetailsResponse, trackingMethod appv1.TrackingMethod) error { + return c.cache.GetItem(appDetailsCacheKey(revision, appSrc, trackingMethod), res) } -func (c *Cache) SetAppDetails(revision string, appSrc *appv1.ApplicationSource, res *apiclient.RepoAppDetailsResponse) error { - return c.cache.SetItem(appDetailsCacheKey(revision, appSrc), res, c.repoCacheExpiration, res == nil) +func (c *Cache) SetAppDetails(revision string, appSrc *appv1.ApplicationSource, res *apiclient.RepoAppDetailsResponse, trackingMethod appv1.TrackingMethod) error { + return c.cache.SetItem(appDetailsCacheKey(revision, appSrc, trackingMethod), res, c.repoCacheExpiration, res == nil) } func revisionMetadataKey(repoURL, revision string) string { diff --git a/reposerver/cache/cache_test.go b/reposerver/cache/cache_test.go index b7cfef0ea67cf..46841c00a229c 100644 --- a/reposerver/cache/cache_test.go +++ b/reposerver/cache/cache_test.go @@ -104,19 +104,19 @@ func TestCache_GetAppDetails(t *testing.T) { cache := newFixtures().Cache // cache miss value := &apiclient.RepoAppDetailsResponse{} - err := cache.GetAppDetails("my-revision", &ApplicationSource{}, value) + err := cache.GetAppDetails("my-revision", &ApplicationSource{}, value, "") assert.Equal(t, ErrCacheMiss, err) res := &apiclient.RepoAppDetailsResponse{Type: "my-type"} - err = cache.SetAppDetails("my-revision", &ApplicationSource{}, res) + err = cache.SetAppDetails("my-revision", &ApplicationSource{}, res, "") assert.NoError(t, err) //cache miss - err = cache.GetAppDetails("other-revision", &ApplicationSource{}, value) + err = cache.GetAppDetails("other-revision", &ApplicationSource{}, value, "") assert.Equal(t, ErrCacheMiss, err) //cache miss - err = cache.GetAppDetails("my-revision", &ApplicationSource{Path: "other-path"}, value) + err = cache.GetAppDetails("my-revision", &ApplicationSource{Path: "other-path"}, value, "") assert.Equal(t, ErrCacheMiss, err) // cache hit - err = cache.GetAppDetails("my-revision", &ApplicationSource{}, value) + err = cache.GetAppDetails("my-revision", &ApplicationSource{}, value, "") assert.NoError(t, err) assert.Equal(t, &apiclient.RepoAppDetailsResponse{Type: "my-type"}, value) } diff --git a/reposerver/repository/repository.go b/reposerver/repository/repository.go index ff632d84d34b7..f9e19aec5ae3f 100644 --- a/reposerver/repository/repository.go +++ b/reposerver/repository/repository.go @@ -16,6 +16,8 @@ import ( "strings" "time" + "github.com/argoproj/argo-cd/v2/util/argo" + "github.com/Masterminds/semver" "github.com/TomOnTime/utfutil" "github.com/argoproj/gitops-engine/pkg/utils/kube" @@ -47,7 +49,6 @@ import ( "github.com/argoproj/argo-cd/v2/util/helm" "github.com/argoproj/argo-cd/v2/util/io" "github.com/argoproj/argo-cd/v2/util/ksonnet" - argokube "github.com/argoproj/argo-cd/v2/util/kube" "github.com/argoproj/argo-cd/v2/util/kustomize" "github.com/argoproj/argo-cd/v2/util/security" "github.com/argoproj/argo-cd/v2/util/text" @@ -68,6 +69,7 @@ type Service struct { cache *reposervercache.Cache parallelismLimitSemaphore *semaphore.Weighted metricsServer *metrics.MetricsServer + resourceTracking argo.ResourceTracking newGitClient func(rawRepoURL string, creds git.Creds, insecure bool, enableLfs bool, proxy string, opts ...git.ClientOpts) (git.Client, error) newHelmClient func(repoURL string, creds helm.Creds, enableOci bool, proxy string, opts ...helm.ClientOpts) helm.Client initConstants RepoServerInitConstants @@ -83,7 +85,7 @@ type RepoServerInitConstants struct { } // NewService returns a new instance of the Manifest service -func NewService(metricsServer *metrics.MetricsServer, cache *reposervercache.Cache, initConstants RepoServerInitConstants) *Service { +func NewService(metricsServer *metrics.MetricsServer, cache *reposervercache.Cache, initConstants RepoServerInitConstants, resourceTracking argo.ResourceTracking) *Service { var parallelismLimitSemaphore *semaphore.Weighted if initConstants.ParallelismLimit > 0 { parallelismLimitSemaphore = semaphore.NewWeighted(initConstants.ParallelismLimit) @@ -95,6 +97,7 @@ func NewService(metricsServer *metrics.MetricsServer, cache *reposervercache.Cac cache: cache, metricsServer: metricsServer, newGitClient: git.NewClient, + resourceTracking: resourceTracking, newHelmClient: func(repoURL string, creds helm.Creds, enableOci bool, proxy string, opts ...helm.ClientOpts) helm.Client { return helm.NewClientWithLock(repoURL, creds, sync.NewKeyLock(), enableOci, proxy, opts...) }, @@ -712,6 +715,7 @@ func GenerateManifests(appPath, repoRoot, revision string, q *apiclient.Manifest var targetObjs []*unstructured.Unstructured var dest *v1alpha1.ApplicationDestination + resourceTracking := argo.NewResourceTracking() appSourceType, err := GetAppSourceType(q.ApplicationSource, appPath, q.AppName) if err != nil { return nil, err @@ -770,7 +774,7 @@ func GenerateManifests(appPath, repoRoot, revision string, q *apiclient.Manifest for _, target := range targets { if q.AppLabelKey != "" && q.AppName != "" && !kube.IsCRD(target) { - err = argokube.SetAppInstanceLabel(target, q.AppLabelKey, q.AppName) + err = resourceTracking.SetAppInstance(target, q.AppLabelKey, q.AppName, v1alpha1.TrackingMethod(q.TrackingMethod)) if err != nil { return nil, err } @@ -1175,7 +1179,7 @@ func (s *Service) GetAppDetails(ctx context.Context, q *apiclient.RepoServerAppD return err } } - _ = s.cache.SetAppDetails(revision, q.Source, res) + _ = s.cache.SetAppDetails(revision, q.Source, res, v1alpha1.TrackingMethod(q.TrackingMethod)) return nil } @@ -1187,7 +1191,7 @@ func (s *Service) GetAppDetails(ctx context.Context, q *apiclient.RepoServerAppD func (s *Service) createGetAppDetailsCacheHandler(res *apiclient.RepoAppDetailsResponse, q *apiclient.RepoServerAppDetailsQuery) func(revision string, _ bool) (bool, error) { return func(revision string, _ bool) (bool, error) { - err := s.cache.GetAppDetails(revision, q.Source, res) + err := s.cache.GetAppDetails(revision, q.Source, res, v1alpha1.TrackingMethod(q.TrackingMethod)) if err == nil { log.Infof("app details cache hit: %s/%s", revision, q.Source.Path) return true, nil diff --git a/reposerver/repository/repository.proto b/reposerver/repository/repository.proto index bd729bcb412f0..5d4724bb78c8e 100644 --- a/reposerver/repository/repository.proto +++ b/reposerver/repository/repository.proto @@ -28,6 +28,7 @@ message ManifestRequest { bool verifySignature = 16; repeated github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.RepoCreds helmRepoCreds = 17; bool noRevisionCache = 18; + string trackingMethod = 19; } // TestRepositoryRequest is a query to test repository is valid or not and has valid access. @@ -82,6 +83,7 @@ message RepoServerAppDetailsQuery { string appName = 5; bool noCache = 6; bool noRevisionCache = 7; + string trackingMethod = 8; } // RepoAppDetailsResponse application details diff --git a/reposerver/repository/repository_test.go b/reposerver/repository/repository_test.go index fe21607b6211d..6b70b9aa0eb23 100644 --- a/reposerver/repository/repository_test.go +++ b/reposerver/repository/repository_test.go @@ -14,6 +14,8 @@ import ( "testing" "time" + "github.com/argoproj/argo-cd/v2/util/argo" + "github.com/ghodss/yaml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -70,7 +72,7 @@ func newServiceWithOpt(cf clientFunc) (*Service, *gitmocks.Client) { cacheutil.NewCache(cacheutil.NewInMemoryCache(1*time.Minute)), 1*time.Minute, 1*time.Minute, - ), RepoServerInitConstants{ParallelismLimit: 1}) + ), RepoServerInitConstants{ParallelismLimit: 1}, argo.NewResourceTracking()) chart := "my-chart" version := "1.1.0" diff --git a/reposerver/server.go b/reposerver/server.go index a0a206efe0706..ecc86ca95de65 100644 --- a/reposerver/server.go +++ b/reposerver/server.go @@ -5,6 +5,8 @@ import ( "fmt" "os" + "github.com/argoproj/argo-cd/v2/util/argo" + grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" @@ -92,7 +94,7 @@ func (a *ArgoCDRepoServer) CreateGRPC() *grpc.Server { versionpkg.RegisterVersionServiceServer(server, version.NewServer(nil, func() (bool, error) { return true, nil })) - manifestService := repository.NewService(a.metricsServer, a.cache, a.initConstants) + manifestService := repository.NewService(a.metricsServer, a.cache, a.initConstants, argo.NewResourceTracking()) apiclient.RegisterRepoServerServiceServer(server, manifestService) healthService := health.NewServer() diff --git a/server/application/application.go b/server/application/application.go index 483aa57abd6e4..d621649059477 100644 --- a/server/application/application.go +++ b/server/application/application.go @@ -331,6 +331,7 @@ func (s *Server) GetManifests(ctx context.Context, q *application.ApplicationMan KubeVersion: serverVersion, ApiVersions: argo.APIGroupsToVersions(apiGroups), HelmRepoCreds: helmCreds, + TrackingMethod: string(argoutil.GetTrackingMethod(s.settingsMgr)), }) return err }) @@ -414,6 +415,7 @@ func (s *Server) Get(ctx context.Context, q *application.ApplicationQuery) (*app KustomizeOptions: kustomizeOptions, Repos: helmRepos, NoCache: true, + TrackingMethod: string(argoutil.GetTrackingMethod(s.settingsMgr)), }) return err }); err != nil { @@ -848,7 +850,7 @@ func (s *Server) validateAndNormalizeApp(ctx context.Context, app *appv1.Applica var conditions []appv1.ApplicationCondition if validate { - conditions, err = argo.ValidateRepo(ctx, app, s.repoClientset, s.db, kustomizeOptions, plugins, s.kubectl, proj) + conditions, err = argo.ValidateRepo(ctx, app, s.repoClientset, s.db, kustomizeOptions, plugins, s.kubectl, proj, s.settingsMgr) if err != nil { return err } diff --git a/server/settings/settings.go b/server/settings/settings.go index fbd32ca8c5b9e..21416cd03f00f 100644 --- a/server/settings/settings.go +++ b/server/settings/settings.go @@ -79,6 +79,11 @@ func (s *Server) Get(ctx context.Context, q *settingspkg.SettingsQuery) (*settin kustomizeVersions = append(kustomizeVersions, kustomizeSettings.Versions[i].Name) } + trackingMethod, err := s.mgr.GetTrackingMethod() + if err != nil { + return nil, err + } + set := settingspkg.Settings{ URL: argoCDSettings.URL, AppLabelKey: appInstanceLabelKey, @@ -100,6 +105,7 @@ func (s *Server) Get(ctx context.Context, q *settingspkg.SettingsQuery) (*settin KustomizeVersions: kustomizeVersions, UiCssURL: argoCDSettings.UiCssURL, PasswordPattern: argoCDSettings.PasswordPattern, + TrackingMethod: trackingMethod, } if sessionmgr.LoggedIn(ctx) || s.disableAuth { diff --git a/server/settings/settings.proto b/server/settings/settings.proto index a23a6ca25f65b..344b13c4d3996 100644 --- a/server/settings/settings.proto +++ b/server/settings/settings.proto @@ -34,6 +34,7 @@ message Settings { string uiBannerContent = 15; string uiBannerURL = 16; string passwordPattern = 17; + string trackingMethod = 18; } message GoogleAnalyticsConfig { diff --git a/util/argo/argo.go b/util/argo/argo.go index 5a020e058ef63..e567636cead4a 100644 --- a/util/argo/argo.go +++ b/util/argo/argo.go @@ -182,6 +182,7 @@ func ValidateRepo( plugins []*argoappv1.ConfigManagementPlugin, kubectl kube.Kubectl, proj *argoappv1.AppProject, + settingsMgr *settings.SettingsManager, ) ([]argoappv1.ApplicationCondition, error) { spec := &app.Spec conditions := make([]argoappv1.ApplicationCondition, 0) @@ -244,6 +245,7 @@ func ValidateRepo( KustomizeOptions: kustomizeOptions, // don't use case during application change to make sure to fetch latest git/helm revisions NoRevisionCache: true, + TrackingMethod: string(GetTrackingMethod(settingsMgr)), }) if err != nil { conditions = append(conditions, argoappv1.ApplicationCondition{ @@ -273,7 +275,7 @@ func ValidateRepo( return nil, err } conditions = append(conditions, verifyGenerateManifests( - ctx, repo, permittedHelmRepos, app, repoClient, kustomizeOptions, plugins, cluster.ServerVersion, APIGroupsToVersions(apiGroups), permittedHelmCredentials)...) + ctx, repo, permittedHelmRepos, app, repoClient, kustomizeOptions, plugins, cluster.ServerVersion, APIGroupsToVersions(apiGroups), permittedHelmCredentials, settingsMgr)...) return conditions, nil } @@ -469,6 +471,7 @@ func verifyGenerateManifests( kubeVersion string, apiVersions []string, repositoryCredentials []*argoappv1.RepoCreds, + settingsMgr *settings.SettingsManager, ) []argoappv1.ApplicationCondition { spec := &app.Spec var conditions []argoappv1.ApplicationCondition @@ -496,6 +499,7 @@ func verifyGenerateManifests( KubeVersion: kubeVersion, ApiVersions: apiVersions, HelmRepoCreds: repositoryCredentials, + TrackingMethod: string(GetTrackingMethod(settingsMgr)), } req.Repo.CopyCredentialsFromRepo(repoRes) req.Repo.CopySettingsFrom(repoRes) diff --git a/util/argo/argo_test.go b/util/argo/argo_test.go index f95f77cbde372..4ceb4beed30c0 100644 --- a/util/argo/argo_test.go +++ b/util/argo/argo_test.go @@ -279,7 +279,34 @@ func TestValidateRepo(t *testing.T) { return true })).Return(nil, nil) - conditions, err := ValidateRepo(context.Background(), app, repoClientSet, db, kustomizeOptions, nil, &kubetest.MockKubectlCmd{Version: kubeVersion, APIGroups: apiGroups}, proj) + cm := corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: "argocd-cm", + Namespace: test.FakeArgoCDNamespace, + Labels: map[string]string{ + "app.kubernetes.io/part-of": "argocd", + }, + }, + Data: map[string]string{ + "globalProjects": ` + - projectName: default-x + labelSelector: + matchExpressions: + - key: is-x + operator: Exists + - projectName: default-non-x + labelSelector: + matchExpressions: + - key: is-x + operator: DoesNotExist +`, + }, + } + + kubeClient := fake.NewSimpleClientset(&cm) + settingsMgr := settings.NewSettingsManager(context.Background(), kubeClient, test.FakeArgoCDNamespace) + + conditions, err := ValidateRepo(context.Background(), app, repoClientSet, db, kustomizeOptions, nil, &kubetest.MockKubectlCmd{Version: kubeVersion, APIGroups: apiGroups}, proj, settingsMgr) assert.NoError(t, err) assert.Empty(t, conditions) diff --git a/util/argo/resource_tracking.go b/util/argo/resource_tracking.go new file mode 100644 index 0000000000000..2c09560c78fe8 --- /dev/null +++ b/util/argo/resource_tracking.go @@ -0,0 +1,63 @@ +package argo + +import ( + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + + "github.com/argoproj/argo-cd/v2/util/settings" + + "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" + + argokube "github.com/argoproj/argo-cd/v2/util/kube" +) + +const ( + TrackingMethodAnnotation v1alpha1.TrackingMethod = "annotation" + TrackingMethodLabel v1alpha1.TrackingMethod = "label" + TrackingMethodAnnotationAndLabel v1alpha1.TrackingMethod = "annotation+label" +) + +// ResourceTracking defines methods which allow setup and retrieve tracking information to resource +type ResourceTracking interface { + GetAppName(un *unstructured.Unstructured, key string, trackingMethod v1alpha1.TrackingMethod) string + SetAppInstance(un *unstructured.Unstructured, key, val string, trackingMethod v1alpha1.TrackingMethod) error +} + +type resourceTracking struct { +} + +func NewResourceTracking() ResourceTracking { + return &resourceTracking{} +} + +// GetTrackingMethod retrieve tracking method from settings +func GetTrackingMethod(settingsMgr *settings.SettingsManager) v1alpha1.TrackingMethod { + tm, err := settingsMgr.GetTrackingMethod() + if err != nil { + return TrackingMethodAnnotationAndLabel + } + return v1alpha1.TrackingMethod(tm) +} + +// GetAppName retrieve application name base on tracking method +func (rt *resourceTracking) GetAppName(un *unstructured.Unstructured, key string, trackingMethod v1alpha1.TrackingMethod) string { + switch trackingMethod { + case TrackingMethodLabel: + return argokube.GetAppInstanceLabel(un, key) + case TrackingMethodAnnotation: + return argokube.GetAppInstanceAnnotation(un, key) + default: + return argokube.GetAppInstanceLabel(un, key) + } +} + +// SetAppInstance set label/annotation base on tracking method +func (rt *resourceTracking) SetAppInstance(un *unstructured.Unstructured, key, val string, trackingMethod v1alpha1.TrackingMethod) error { + switch trackingMethod { + case TrackingMethodLabel: + return argokube.SetAppInstanceLabel(un, key, val) + case TrackingMethodAnnotation: + return argokube.SetAppInstanceAnnotation(un, key, val) + default: + return argokube.SetAppInstanceLabel(un, key, val) + } +} diff --git a/util/argo/resource_tracking_test.go b/util/argo/resource_tracking_test.go new file mode 100644 index 0000000000000..354e87c186891 --- /dev/null +++ b/util/argo/resource_tracking_test.go @@ -0,0 +1,60 @@ +package argo + +import ( + "io/ioutil" + "testing" + + "github.com/stretchr/testify/assert" + "gopkg.in/yaml.v2" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + + "github.com/argoproj/argo-cd/v2/common" +) + +func TestSetAppInstanceLabel(t *testing.T) { + yamlBytes, err := ioutil.ReadFile("testdata/svc.yaml") + assert.Nil(t, err) + + var obj unstructured.Unstructured + err = yaml.Unmarshal(yamlBytes, &obj) + assert.Nil(t, err) + + resourceTracking := NewResourceTracking() + + err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "my-app", TrackingMethodLabel) + assert.Nil(t, err) + + app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, TrackingMethodLabel) + assert.Equal(t, "my-app", app) +} + +func TestSetAppInstanceAnnotation(t *testing.T) { + yamlBytes, err := ioutil.ReadFile("testdata/svc.yaml") + assert.Nil(t, err) + + var obj unstructured.Unstructured + err = yaml.Unmarshal(yamlBytes, &obj) + assert.Nil(t, err) + + resourceTracking := NewResourceTracking() + + err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "my-app", TrackingMethodAnnotation) + assert.Nil(t, err) + + app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, TrackingMethodAnnotation) + assert.Equal(t, "my-app", app) +} + +func TestSetAppInstanceAnnotationNotFound(t *testing.T) { + yamlBytes, err := ioutil.ReadFile("testdata/svc.yaml") + assert.Nil(t, err) + + var obj unstructured.Unstructured + err = yaml.Unmarshal(yamlBytes, &obj) + assert.Nil(t, err) + + resourceTracking := NewResourceTracking() + + app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, TrackingMethodAnnotation) + assert.Equal(t, "", app) +} diff --git a/util/argo/testdata/svc.yaml b/util/argo/testdata/svc.yaml new file mode 100644 index 0000000000000..11aeb957db7c3 --- /dev/null +++ b/util/argo/testdata/svc.yaml @@ -0,0 +1,11 @@ +kind: Service +apiVersion: v1 +metadata: + name: my-service +spec: + selector: + app: MyApp + ports: + - protocol: TCP + port: 80 + targetPort: 9376 diff --git a/util/kube/kube.go b/util/kube/kube.go index 7b73eeafba812..6f2c87814153f 100644 --- a/util/kube/kube.go +++ b/util/kube/kube.go @@ -92,3 +92,31 @@ func SetAppInstanceLabel(target *unstructured.Unstructured, key, val string) err } return nil } + +// SetAppInstanceLabel the recommended app.kubernetes.io/instance annotation against an unstructured object +// Uses the legacy labeling if environment variable is set +func SetAppInstanceAnnotation(target *unstructured.Unstructured, key, val string) error { + annotations := target.GetAnnotations() + if annotations == nil { + annotations = make(map[string]string) + } + annotations[key] = val + target.SetAnnotations(annotations) + return nil +} + +// GetAppInstanceAnnotation returns the application instance name from annotation +func GetAppInstanceAnnotation(un *unstructured.Unstructured, key string) string { + if annotations := un.GetAnnotations(); annotations != nil { + return annotations[key] + } + return "" +} + +// GetAppInstanceLabel returns the application instance name from labels +func GetAppInstanceLabel(un *unstructured.Unstructured, key string) string { + if labels := un.GetLabels(); labels != nil { + return labels[key] + } + return "" +} diff --git a/util/kube/kube_test.go b/util/kube/kube_test.go index b0d89e3264ad3..3f36dfc653227 100644 --- a/util/kube/kube_test.go +++ b/util/kube/kube_test.go @@ -162,3 +162,48 @@ func TestIsValidResourceName(t *testing.T) { assert.False(t, IsValidResourceName("Guestbook-ui")) assert.False(t, IsValidResourceName("-guestbook-ui")) } + +func TestSetAppInstanceAnnotation(t *testing.T) { + yamlBytes, err := ioutil.ReadFile("testdata/svc.yaml") + assert.Nil(t, err) + var obj unstructured.Unstructured + err = yaml.Unmarshal(yamlBytes, &obj) + assert.Nil(t, err) + err = SetAppInstanceAnnotation(&obj, common.LabelKeyAppInstance, "my-app") + assert.Nil(t, err) + + manifestBytes, err := json.MarshalIndent(obj.Object, "", " ") + assert.Nil(t, err) + log.Println(string(manifestBytes)) + + var s apiv1.Service + err = json.Unmarshal(manifestBytes, &s) + assert.Nil(t, err) + + log.Println(s.Name) + log.Println(s.ObjectMeta) + assert.Equal(t, "my-app", s.ObjectMeta.Annotations[common.LabelKeyAppInstance]) +} + +func TestGetAppInstanceAnnotation(t *testing.T) { + yamlBytes, err := ioutil.ReadFile("testdata/svc.yaml") + assert.Nil(t, err) + var obj unstructured.Unstructured + err = yaml.Unmarshal(yamlBytes, &obj) + assert.Nil(t, err) + err = SetAppInstanceAnnotation(&obj, common.LabelKeyAppInstance, "my-app") + assert.Nil(t, err) + + assert.Equal(t, "my-app", GetAppInstanceAnnotation(&obj, common.LabelKeyAppInstance)) +} + +func TestGetAppInstanceLabel(t *testing.T) { + yamlBytes, err := ioutil.ReadFile("testdata/svc.yaml") + assert.Nil(t, err) + var obj unstructured.Unstructured + err = yaml.Unmarshal(yamlBytes, &obj) + assert.Nil(t, err) + err = SetAppInstanceLabel(&obj, common.LabelKeyAppInstance, "my-app") + assert.Nil(t, err) + assert.Equal(t, "my-app", GetAppInstanceLabel(&obj, common.LabelKeyAppInstance)) +} diff --git a/util/settings/settings.go b/util/settings/settings.go index 58dcf7d595bf8..bfde8fcf56f6a 100644 --- a/util/settings/settings.go +++ b/util/settings/settings.go @@ -273,6 +273,8 @@ const ( settingsWebhookGogsSecretKey = "webhook.gogs.secret" // settingsApplicationInstanceLabelKey is the key to configure injected app instance label key settingsApplicationInstanceLabelKey = "application.instanceLabelKey" + // settingsResourceTrackingMethodKey is the key to configure tracking method for application resources + settingsResourceTrackingMethodKey = "application.resourceTrackingMethod" // resourcesCustomizationsKey is the key to the map of resource overrides resourceCustomizationsKey = "resource.customizations" // resourceExclusions is the key to the list of excluded resources @@ -526,6 +528,14 @@ func (mgr *SettingsManager) GetAppInstanceLabelKey() (string, error) { return label, nil } +func (mgr *SettingsManager) GetTrackingMethod() (string, error) { + argoCDCM, err := mgr.getConfigMap() + if err != nil { + return "", err + } + return argoCDCM.Data[settingsResourceTrackingMethodKey], nil +} + func (mgr *SettingsManager) GetPasswordPattern() (string, error) { argoCDCM, err := mgr.getConfigMap() if err != nil {