Files
zeekay 01a52090a9 pkg/client, mocks: regenerate off the apps.hanzo.ai group
clientgen/mockgen hadn't been rerun since the group rename, even though
pkg/apis/application/v1alpha1/doc.go and the shipped CRDs already say
apps.hanzo.ai. pkg/client/** still derived ArgoprojV1alpha1/Argoproj()
from the old argoproj.io group, and .mockery.yaml still named ArgoDB
(renamed to DB in util/db/db.go a few commits back) and
util/notification/cd (deleted in b2d7140a0, we use hanzoai/notify).

Reran clientgen (deepcopy-gen/client-gen/lister-gen/informer-gen) off
the current group, and mockgen after fixing .mockery.yaml. Moved every
hand-written call site that holds a versioned.Interface or
SharedInformerFactory with it: .ArgoprojV1alpha1() -> .AppsV1alpha1(),
ArgoprojV1alpha1Interface/Client -> AppsV1alpha1Interface/Client,
.Argoproj() -> .Apps() across controller, server, util, cmd,
hack/gen-resources, and test/e2e. controller/metrics/metrics_test.go's
mocks.NewArgoDB -> mocks.NewDB. Deleted the orphaned
util/db/mocks/ArgoDB.go; mockery writes DB.go for the renamed
interface but doesn't clean up the old filename on its own.

Left CHANGELOG.md/SECURITY.md's real argoproj/argo-cd history and
gitops-engine/pkg/diff/testdata/openapiv2.bin's Argo Rollouts OpenAPI
fixture untouched - genuine history and a real third-party schema, not
our naming.

go build/vet clean. Same 19 pre-existing package-level test failures
as baseline (missing git-verify-wrapper.sh, no live cluster, etc.),
none new. All 32 manifests/ kustomization paths still build;
manifests/ha/** untouched.
2026-09-05 13:44:46 -07:00

165 lines
5.2 KiB
Go

package application
import (
"context"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/rest"
"github.com/hanzoai/cd/pkg/apis/application/v1alpha1"
appclientset "github.com/hanzoai/cd/pkg/client/clientset/versioned"
clientset "github.com/hanzoai/cd/pkg/client/clientset/versioned/typed/application/v1alpha1"
applisters "github.com/hanzoai/cd/pkg/client/listers/application/v1alpha1"
"github.com/hanzoai/cd/util"
"k8s.io/apimachinery/pkg/labels"
)
// deepCopyApplicationLister wraps an ApplicationLister and returns deep copies of the applications.
type deepCopyApplicationLister struct {
applisters.ApplicationLister
}
// List lists all Applications in the indexer and returns deep copies.
func (d *deepCopyApplicationLister) List(selector labels.Selector) ([]*v1alpha1.Application, error) {
apps, err := d.ApplicationLister.List(selector)
if err != nil {
return nil, err
}
deepCopiedApps := util.SliceCopy(apps)
return deepCopiedApps, nil
}
// Applications return an object that can list and get Applications and returns deep copies.
func (d *deepCopyApplicationLister) Applications(namespace string) applisters.ApplicationNamespaceLister {
return &deepCopyApplicationNamespaceLister{
ApplicationNamespaceLister: d.ApplicationLister.Applications(namespace),
}
}
// deepCopyApplicationNamespaceLister wraps an ApplicationNamespaceLister and returns deep copies of the applications.
type deepCopyApplicationNamespaceLister struct {
applisters.ApplicationNamespaceLister
}
// List lists all Applications in the indexer for a given namespace and returns deep copies.
func (d *deepCopyApplicationNamespaceLister) List(selector labels.Selector) ([]*v1alpha1.Application, error) {
apps, err := d.ApplicationNamespaceLister.List(selector)
if err != nil {
return nil, err
}
deepCopiedApps := util.SliceCopy(apps)
return deepCopiedApps, nil
}
// Get retrieves the Application from the indexer for a given namespace and name and returns a deep copy.
func (d *deepCopyApplicationNamespaceLister) Get(name string) (*v1alpha1.Application, error) {
app, err := d.ApplicationNamespaceLister.Get(name)
if err != nil {
return nil, err
}
return app.DeepCopy(), nil
}
type deepCopyAppClientset struct {
appclientset.Interface
}
func (d *deepCopyAppClientset) AppsV1alpha1() clientset.AppsV1alpha1Interface {
return &deepCopyTypedClient{
AppsV1alpha1Interface: d.Interface.AppsV1alpha1(),
}
}
// GetUnderlyingClientSet returns the underlying clientset.Interface.
// Unit tests should only call this
func (d *deepCopyAppClientset) GetUnderlyingClientSet() appclientset.Interface {
return d.Interface
}
type deepCopyTypedClient struct {
clientset.AppsV1alpha1Interface
}
func (d *deepCopyTypedClient) RESTClient() rest.Interface {
return d.AppsV1alpha1Interface.RESTClient()
}
func (d *deepCopyTypedClient) AppProjects(namespace string) clientset.AppProjectInterface {
return &deepCopyAppProjectClient{
AppProjectInterface: d.AppsV1alpha1Interface.AppProjects(namespace),
}
}
func (d *deepCopyTypedClient) ApplicationSets(namespace string) clientset.ApplicationSetInterface {
return &deepCopyApplicationSetClient{
ApplicationSetInterface: d.AppsV1alpha1Interface.ApplicationSets(namespace),
}
}
func (d *deepCopyTypedClient) Applications(namespace string) clientset.ApplicationInterface {
return &deepCopyApplicationClient{
ApplicationInterface: d.AppsV1alpha1Interface.Applications(namespace),
}
}
type deepCopyApplicationClient struct {
clientset.ApplicationInterface
}
func (d *deepCopyApplicationClient) Get(ctx context.Context, name string, options metav1.GetOptions) (*v1alpha1.Application, error) {
app, err := d.ApplicationInterface.Get(ctx, name, options)
if err != nil {
return nil, err
}
return app.DeepCopy(), nil
}
func (d *deepCopyApplicationClient) List(ctx context.Context, opts metav1.ListOptions) (*v1alpha1.ApplicationList, error) {
appList, err := d.ApplicationInterface.List(ctx, opts)
if err != nil {
return nil, err
}
return appList.DeepCopy(), nil
}
type deepCopyAppProjectClient struct {
clientset.AppProjectInterface
}
func (d *deepCopyAppProjectClient) Get(ctx context.Context, name string, options metav1.GetOptions) (*v1alpha1.AppProject, error) {
appProject, err := d.AppProjectInterface.Get(ctx, name, options)
if err != nil {
return nil, err
}
return appProject.DeepCopy(), nil
}
func (d *deepCopyAppProjectClient) List(ctx context.Context, opts metav1.ListOptions) (*v1alpha1.AppProjectList, error) {
appProjectList, err := d.AppProjectInterface.List(ctx, opts)
if err != nil {
return nil, err
}
return appProjectList.DeepCopy(), nil
}
type deepCopyApplicationSetClient struct {
clientset.ApplicationSetInterface
}
func (d *deepCopyApplicationSetClient) Get(ctx context.Context, name string, options metav1.GetOptions) (*v1alpha1.ApplicationSet, error) {
appSet, err := d.ApplicationSetInterface.Get(ctx, name, options)
if err != nil {
return nil, err
}
return appSet.DeepCopy(), nil
}
func (d *deepCopyApplicationSetClient) List(ctx context.Context, opts metav1.ListOptions) (*v1alpha1.ApplicationSetList, error) {
appSetList, err := d.ApplicationSetInterface.List(ctx, opts)
if err != nil {
return nil, err
}
return appSetList.DeepCopy(), nil
}