diff --git a/deploy/crd/kcp.io/services.syncagent.kcp.io_publishedresources.yaml b/deploy/crd/kcp.io/syncagent.kcp.io_publishedresources.yaml similarity index 99% rename from deploy/crd/kcp.io/services.syncagent.kcp.io_publishedresources.yaml rename to deploy/crd/kcp.io/syncagent.kcp.io_publishedresources.yaml index 0a12866..cfc66ad 100644 --- a/deploy/crd/kcp.io/services.syncagent.kcp.io_publishedresources.yaml +++ b/deploy/crd/kcp.io/syncagent.kcp.io_publishedresources.yaml @@ -5,9 +5,9 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.16.5 - name: publishedresources.services.syncagent.kcp.io + name: publishedresources.syncagent.kcp.io spec: - group: services.syncagent.kcp.io + group: syncagent.kcp.io names: kind: PublishedResource listKind: PublishedResourceList diff --git a/docs/README.md b/docs/README.md index cf0790f..0e45197 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,6 @@ -# The kcp Sync Agent +# Documentation -The Sync Agent is a Kubernetes agent responsible for integrating external Kubernetes clusters. +kcp-api-syncagent is a Kubernetes agent responsible for integrating external Kubernetes clusters. It runs on a Kubernetes cluster, is configured with credentials to a kcp instance and will then synchronize data out of kcp (i.e. out of kcp workspaces) onto the local cluster, and vice versa. diff --git a/docs/publish-resources.md b/docs/publish-resources.md index 2ccf094..8fe91a4 100644 --- a/docs/publish-resources.md +++ b/docs/publish-resources.md @@ -38,7 +38,7 @@ resources that need to be synced down to the service cluster. In its simplest form (which is rarely practical) a `PublishedResource` looks like this: ```yaml -apiVersion: services.syncagent.kcp.io/v1alpha1 +apiVersion: syncagent.kcp.io/v1alpha1 kind: PublishedResource metadata: name: publish-certmanager-certs # name can be freely chosen @@ -57,7 +57,7 @@ The Sync Agent can be instructed to only work on a subset of resources in kcp. T by namespace and/or label selector. ```yaml -apiVersion: services.syncagent.kcp.io/v1alpha1 +apiVersion: syncagent.kcp.io/v1alpha1 kind: PublishedResource metadata: name: publish-certmanager-certs # name can be freely chosen @@ -96,7 +96,7 @@ It is also possible to change the scope of resources, i.e. turning a namespaced cluster-wide. This should be used carefully and might require extensive mutations. ```yaml -apiVersion: services.syncagent.kcp.io/v1alpha1 +apiVersion: syncagent.kcp.io/v1alpha1 kind: PublishedResource metadata: name: publish-certmanager-certs # name can be freely chosen @@ -138,7 +138,7 @@ the platform will create a namespace on the local cluster, with a combination of name hashes used for the actual resource names. ```yaml -apiVersion: services.syncagent.kcp.io/v1alpha1 +apiVersion: syncagent.kcp.io/v1alpha1 kind: PublishedResource metadata: name: publish-certmanager-certs # name can be freely chosen @@ -170,7 +170,7 @@ Mutation is always done as a series of steps. Each step does exactly one thing a be configured per step. ```yaml -apiVersion: services.syncagent.kcp.io/v1alpha1 +apiVersion: syncagent.kcp.io/v1alpha1 kind: PublishedResource metadata: name: publish-certmanager-certs # name can be freely chosen @@ -262,7 +262,7 @@ and `"jk...."` as the name on the service cluster. Once the object exists with t originating side, the Sync Agent will begin to sync it to the other side. ```yaml -apiVersion: services.syncagent.kcp.io/v1alpha1 +apiVersion: syncagent.kcp.io/v1alpha1 kind: PublishedResource metadata: name: publish-certmanager-certs @@ -337,7 +337,7 @@ spec: {} ``` ```yaml -apiVersion: services.syncagent.kcp.io/v1alpha1 +apiVersion: syncagent.kcp.io/v1alpha1 kind: PublishedResource metadata: name: publish-certmanager-certs diff --git a/go.mod b/go.mod index d40ffe9..a8598ec 100644 --- a/go.mod +++ b/go.mod @@ -2,8 +2,6 @@ module github.com/kcp-dev/api-syncagent go 1.22.0 -toolchain go1.22.5 - require ( github.com/Masterminds/sprig/v3 v3.3.0 github.com/evanphx/json-patch/v5 v5.9.0 diff --git a/hack/download-tool.sh b/hack/download-tool.sh index 3f85620..12d9c61 100755 --- a/hack/download-tool.sh +++ b/hack/download-tool.sh @@ -44,7 +44,7 @@ fi mkdir -p tmp cd tmp - echo "Downloading $BINARY version $VERSION…" >&2 + echo "Downloading $BINARY version $VERSION …" >&2 curl --fail --silent -LO "$URL" archive="$(ls)" diff --git a/hack/update-codegen-crds.sh b/hack/update-codegen-crds.sh index 1b19ea1..223d73c 100755 --- a/hack/update-codegen-crds.sh +++ b/hack/update-codegen-crds.sh @@ -55,12 +55,6 @@ go run sigs.k8s.io/controller-tools/cmd/controller-gen \ beautify() { _tools/yq --inplace --no-doc 'del(.metadata.creationTimestamp)' "$1" - # kcp 0.24 added support for conversions, but as long as our integration tests run on <0.24, - # we must remove any possible conversion field or else older kcp versions will not be able to - # load the generated ARS. - # TODO: Remove this hack once everything in this repository is kcp 0.24+. - _tools/yq --inplace --no-doc 'del(.spec.conversion)' "$1" - mv "$1" "$1.bak" echo -e "# This file has been generated by hack/update-codegen-crds.sh, DO NOT EDIT.\n" > "$1" cat "$1.bak" >> "$1" diff --git a/hack/update-codegen-sdk.sh b/hack/update-codegen-sdk.sh index 0f2b19b..77de40d 100755 --- a/hack/update-codegen-sdk.sh +++ b/hack/update-codegen-sdk.sh @@ -34,11 +34,11 @@ go run k8s.io/code-generator/cmd/applyconfiguration-gen \ --go-header-file "$BOILERPLATE_HEADER" \ --output-dir $SDK_DIR/applyconfiguration \ --output-pkg $SDK_PKG/applyconfiguration \ - $APIS_PKG/services/v1alpha1 + $APIS_PKG/syncagent/v1alpha1 go run k8s.io/code-generator/cmd/client-gen \ --input-base "" \ - --input $APIS_PKG/services/v1alpha1 \ + --input $APIS_PKG/syncagent/v1alpha1 \ --clientset-name versioned \ --go-header-file "$BOILERPLATE_HEADER" \ --output-dir $SDK_DIR/clientset \ diff --git a/internal/controller/apiexport/controller.go b/internal/controller/apiexport/controller.go index 0d4b925..541c3b0 100644 --- a/internal/controller/apiexport/controller.go +++ b/internal/controller/apiexport/controller.go @@ -26,7 +26,7 @@ import ( "github.com/kcp-dev/api-syncagent/internal/controllerutil" predicateutil "github.com/kcp-dev/api-syncagent/internal/controllerutil/predicate" "github.com/kcp-dev/api-syncagent/internal/resources/reconciling" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" kcpdevv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1" @@ -82,7 +82,7 @@ func Add( } hasARS := predicate.NewPredicateFuncs(func(object ctrlruntimeclient.Object) bool { - publishedResource, ok := object.(*servicesv1alpha1.PublishedResource) + publishedResource, ok := object.(*syncagentv1alpha1.PublishedResource) if !ok { return false } @@ -101,7 +101,7 @@ func Add( // so there is no need here to add an additional filter. WatchesRawSource(source.Kind(platformCluster.GetCache(), &kcpdevv1alpha1.APIExport{}, controllerutil.EnqueueConst[*kcpdevv1alpha1.APIExport]("dummy"))). // Watch for changes to PublishedResources on the local service cluster - Watches(&servicesv1alpha1.PublishedResource{}, controllerutil.EnqueueConst[ctrlruntimeclient.Object]("dummy"), builder.WithPredicates(predicateutil.ByLabels(prFilter), hasARS)). + Watches(&syncagentv1alpha1.PublishedResource{}, controllerutil.EnqueueConst[ctrlruntimeclient.Object]("dummy"), builder.WithPredicates(predicateutil.ByLabels(prFilter), hasARS)). Build(reconciler) return err } @@ -113,7 +113,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) ( func (r *Reconciler) reconcile(ctx context.Context) error { // find all PublishedResources - pubResources := &servicesv1alpha1.PublishedResourceList{} + pubResources := &syncagentv1alpha1.PublishedResourceList{} if err := r.localClient.List(ctx, pubResources, &ctrlruntimeclient.ListOptions{ LabelSelector: r.prFilter, }); err != nil { @@ -121,7 +121,7 @@ func (r *Reconciler) reconcile(ctx context.Context) error { } // filter out those PRs that have not yet been processed into an ARS - filteredPubResources := []servicesv1alpha1.PublishedResource{} + filteredPubResources := []syncagentv1alpha1.PublishedResource{} for i, pubResource := range pubResources.Items { if pubResource.Status.ResourceSchemaName != "" { filteredPubResources = append(filteredPubResources, pubResources.Items[i]) diff --git a/internal/controller/apiexport/reconciler.go b/internal/controller/apiexport/reconciler.go index 84e5fca..ed9cbfe 100644 --- a/internal/controller/apiexport/reconciler.go +++ b/internal/controller/apiexport/reconciler.go @@ -21,7 +21,7 @@ import ( "slices" "github.com/kcp-dev/api-syncagent/internal/resources/reconciling" - "github.com/kcp-dev/api-syncagent/sdk/apis/services" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" kcpdevv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1" @@ -39,7 +39,7 @@ func (r *Reconciler) createAPIExportReconciler(availableResourceSchemas sets.Set if existing.Annotations == nil { existing.Annotations = map[string]string{} } - existing.Annotations[services.AgentNameAnnotation] = agentName + existing.Annotations[syncagentv1alpha1.AgentNameAnnotation] = agentName // we only ever add new schemas result := known.Union(availableResourceSchemas) diff --git a/internal/controller/apiresourceschema/controller.go b/internal/controller/apiresourceschema/controller.go index d415b5c..3467ebd 100644 --- a/internal/controller/apiresourceschema/controller.go +++ b/internal/controller/apiresourceschema/controller.go @@ -31,8 +31,7 @@ import ( "github.com/kcp-dev/api-syncagent/internal/controllerutil/predicate" "github.com/kcp-dev/api-syncagent/internal/discovery" "github.com/kcp-dev/api-syncagent/internal/projection" - "github.com/kcp-dev/api-syncagent/sdk/apis/services" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" kcpdevv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1" @@ -90,7 +89,7 @@ func Add( Named(ControllerName). WithOptions(controller.Options{MaxConcurrentReconciles: numWorkers}). // Watch for changes to PublishedResources on the local service cluster - For(&servicesv1alpha1.PublishedResource{}, builder.WithPredicates(predicate.ByLabels(prFilter))). + For(&syncagentv1alpha1.PublishedResource{}, builder.WithPredicates(predicate.ByLabels(prFilter))). Build(reconciler) return err } @@ -99,7 +98,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) ( log := r.log.With("publishedresource", request) log.Debug("Processing") - pubResource := &servicesv1alpha1.PublishedResource{} + pubResource := &syncagentv1alpha1.PublishedResource{} if err := r.localClient.Get(ctx, request.NamespacedName, pubResource); err != nil { return reconcile.Result{}, ctrlruntimeclient.IgnoreNotFound(err) } @@ -123,7 +122,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) ( return *result, err } -func (r *Reconciler) reconcile(ctx context.Context, log *zap.SugaredLogger, pubResource *servicesv1alpha1.PublishedResource) (*reconcile.Result, error) { +func (r *Reconciler) reconcile(ctx context.Context, log *zap.SugaredLogger, pubResource *syncagentv1alpha1.PublishedResource) (*reconcile.Result, error) { // find the resource that the PublishedResource is referring to localGVK := projection.PublishedResourceSourceGVK(pubResource) @@ -180,11 +179,11 @@ func (r *Reconciler) createAPIResourceSchema(ctx context.Context, log *zap.Sugar ars := &kcpdevv1alpha1.APIResourceSchema{} ars.Name = arsName ars.Annotations = map[string]string{ - services.SourceGenerationAnnotation: fmt.Sprintf("%d", projectedCRD.Generation), - services.AgentNameAnnotation: r.agentName, + syncagentv1alpha1.SourceGenerationAnnotation: fmt.Sprintf("%d", projectedCRD.Generation), + syncagentv1alpha1.AgentNameAnnotation: r.agentName, } ars.Labels = map[string]string{ - services.APIGroupLabel: apigroup, + syncagentv1alpha1.APIGroupLabel: apigroup, } ars.Spec.Group = converted.Spec.Group ars.Spec.Names = converted.Spec.Names @@ -196,7 +195,7 @@ func (r *Reconciler) createAPIResourceSchema(ctx context.Context, log *zap.Sugar return r.platformClient.Create(ctx, ars) } -func (r *Reconciler) projectResourceNames(apiGroup string, crd *apiextensionsv1.CustomResourceDefinition, projection *servicesv1alpha1.ResourceProjection) *apiextensionsv1.CustomResourceDefinition { +func (r *Reconciler) projectResourceNames(apiGroup string, crd *apiextensionsv1.CustomResourceDefinition, projection *syncagentv1alpha1.ResourceProjection) *apiextensionsv1.CustomResourceDefinition { result := crd.DeepCopy() result.Spec.Group = apiGroup diff --git a/internal/controller/sync/controller.go b/internal/controller/sync/controller.go index 9484e06..51c6212 100644 --- a/internal/controller/sync/controller.go +++ b/internal/controller/sync/controller.go @@ -28,7 +28,7 @@ import ( "github.com/kcp-dev/api-syncagent/internal/mutation" "github.com/kcp-dev/api-syncagent/internal/projection" "github.com/kcp-dev/api-syncagent/internal/sync" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ctrlruntimeclient "sigs.k8s.io/controller-runtime/pkg/client" @@ -59,7 +59,7 @@ func Create( ctx context.Context, localManager manager.Manager, virtualWorkspaceCluster cluster.Cluster, - pubRes *servicesv1alpha1.PublishedResource, + pubRes *syncagentv1alpha1.PublishedResource, discoveryClient *discovery.Client, apiExportName string, log *zap.SugaredLogger, diff --git a/internal/controller/syncmanager/controller.go b/internal/controller/syncmanager/controller.go index a5cf307..49b4331 100644 --- a/internal/controller/syncmanager/controller.go +++ b/internal/controller/syncmanager/controller.go @@ -29,7 +29,7 @@ import ( "github.com/kcp-dev/api-syncagent/internal/controllerutil" "github.com/kcp-dev/api-syncagent/internal/controllerutil/predicate" "github.com/kcp-dev/api-syncagent/internal/discovery" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" kcpdevv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1" @@ -118,7 +118,7 @@ func Add( // so there is no need here to add an additional filter. WatchesRawSource(source.Kind(platformCluster.GetCache(), &kcpdevv1alpha1.APIExport{}, controllerutil.EnqueueConst[*kcpdevv1alpha1.APIExport]("dummy"))). // Watch for changes to the PublishedResources - Watches(&servicesv1alpha1.PublishedResource{}, controllerutil.EnqueueConst[ctrlruntimeclient.Object]("dummy"), builder.WithPredicates(predicate.ByLabels(prFilter))). + Watches(&syncagentv1alpha1.PublishedResource{}, controllerutil.EnqueueConst[ctrlruntimeclient.Object]("dummy"), builder.WithPredicates(predicate.ByLabels(prFilter))). Build(reconciler) return err } @@ -169,7 +169,7 @@ func (r *Reconciler) reconcile(ctx context.Context, log *zap.SugaredLogger, apiE } // find all PublishedResources - pubResources := &servicesv1alpha1.PublishedResourceList{} + pubResources := &syncagentv1alpha1.PublishedResourceList{} if err := r.localManager.GetClient().List(ctx, pubResources, &ctrlruntimeclient.ListOptions{ LabelSelector: r.prFilter, }); err != nil { @@ -220,11 +220,11 @@ func (r *Reconciler) stopVirtualWorkspaceCluster(log *zap.SugaredLogger) { r.vwURL = "" } -func getPublishedResourceKey(pr *servicesv1alpha1.PublishedResource) string { +func getPublishedResourceKey(pr *syncagentv1alpha1.PublishedResource) string { return fmt.Sprintf("%s-%s", pr.UID, pr.ResourceVersion) } -func (r *Reconciler) ensureSyncControllers(ctx context.Context, log *zap.SugaredLogger, publishedResources []servicesv1alpha1.PublishedResource) error { +func (r *Reconciler) ensureSyncControllers(ctx context.Context, log *zap.SugaredLogger, publishedResources []syncagentv1alpha1.PublishedResource) error { currentPRWorkers := sets.New[string]() for _, pr := range publishedResources { currentPRWorkers.Insert(getPublishedResourceKey(&pr)) diff --git a/internal/mutation/mutation.go b/internal/mutation/mutation.go index 7e2a0bd..fa07ad2 100644 --- a/internal/mutation/mutation.go +++ b/internal/mutation/mutation.go @@ -30,10 +30,10 @@ import ( "github.com/tidwall/sjson" "go.xrstf.de/rudi" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" ) -func ApplyResourceMutations(value any, mutations []servicesv1alpha1.ResourceMutation, ctx *TemplateMutationContext) (any, error) { +func ApplyResourceMutations(value any, mutations []syncagentv1alpha1.ResourceMutation, ctx *TemplateMutationContext) (any, error) { for _, mut := range mutations { var err error value, err = ApplyResourceMutation(value, mut, ctx) @@ -45,7 +45,7 @@ func ApplyResourceMutations(value any, mutations []servicesv1alpha1.ResourceMuta return value, nil } -func ApplyResourceMutation(value any, mut servicesv1alpha1.ResourceMutation, ctx *TemplateMutationContext) (any, error) { +func ApplyResourceMutation(value any, mut syncagentv1alpha1.ResourceMutation, ctx *TemplateMutationContext) (any, error) { // for Rudi scripts we can skip all the JSON encoding/decoding if mut.Rudi != nil { return applyResourceRudiMigration(value, *mut.Rudi, ctx) @@ -73,7 +73,7 @@ func ApplyResourceMutation(value any, mut servicesv1alpha1.ResourceMutation, ctx return result, nil } -func applyResourceMutationToJSON(jsonData string, mut servicesv1alpha1.ResourceMutation, ctx *TemplateMutationContext) (string, error) { +func applyResourceMutationToJSON(jsonData string, mut syncagentv1alpha1.ResourceMutation, ctx *TemplateMutationContext) (string, error) { switch { case mut.Delete != nil: return applyResourceDeleteMutation(jsonData, *mut.Delete) @@ -86,7 +86,7 @@ func applyResourceMutationToJSON(jsonData string, mut servicesv1alpha1.ResourceM } } -func applyResourceRudiMigration(value any, mut servicesv1alpha1.ResourceRudiMutation, ctx *TemplateMutationContext) (any, error) { +func applyResourceRudiMigration(value any, mut syncagentv1alpha1.ResourceRudiMutation, ctx *TemplateMutationContext) (any, error) { program, err := rudi.Parse("myscript", mut.Script) if err != nil { return nil, fmt.Errorf("invalid script: %w", err) @@ -109,7 +109,7 @@ func applyResourceRudiMigration(value any, mut servicesv1alpha1.ResourceRudiMuta return processed, nil } -func applyResourceDeleteMutation(jsonData string, mut servicesv1alpha1.ResourceDeleteMutation) (string, error) { +func applyResourceDeleteMutation(jsonData string, mut syncagentv1alpha1.ResourceDeleteMutation) (string, error) { jsonData, err := sjson.Delete(jsonData, mut.Path) if err != nil { return "", fmt.Errorf("failed to delete value @ %s: %w", mut.Path, err) @@ -118,7 +118,7 @@ func applyResourceDeleteMutation(jsonData string, mut servicesv1alpha1.ResourceD return jsonData, nil } -func applyResourceRegexMutation(jsonData string, mut servicesv1alpha1.ResourceRegexMutation) (string, error) { +func applyResourceRegexMutation(jsonData string, mut syncagentv1alpha1.ResourceRegexMutation) (string, error) { if mut.Pattern == "" { return sjson.Set(jsonData, mut.Path, mut.Replacement) } @@ -155,7 +155,7 @@ type TemplateMutationContext struct { RemoteObject map[string]any } -func applyResourceTemplateMutation(jsonData string, mut servicesv1alpha1.ResourceTemplateMutation, ctx *TemplateMutationContext) (string, error) { +func applyResourceTemplateMutation(jsonData string, mut syncagentv1alpha1.ResourceTemplateMutation, ctx *TemplateMutationContext) (string, error) { // get the current value value := gjson.Get(jsonData, mut.Path) if !value.Exists() { diff --git a/internal/mutation/mutation_test.go b/internal/mutation/mutation_test.go index 9fe8dc7..23427e9 100644 --- a/internal/mutation/mutation_test.go +++ b/internal/mutation/mutation_test.go @@ -20,14 +20,14 @@ import ( "encoding/json" "testing" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" ) func TestApplyResourceMutation(t *testing.T) { testcases := []struct { name string inputData string - mutation servicesv1alpha1.ResourceMutation + mutation syncagentv1alpha1.ResourceMutation ctx *TemplateMutationContext expected string }{ @@ -36,8 +36,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "regex: replace one existing value", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Regex: &servicesv1alpha1.ResourceRegexMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Regex: &syncagentv1alpha1.ResourceRegexMutation{ Path: "spec.secretName", Pattern: "", Replacement: "new-value", @@ -48,8 +48,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "regex: rewrite one existing value", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Regex: &servicesv1alpha1.ResourceRegexMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Regex: &syncagentv1alpha1.ResourceRegexMutation{ Path: "spec.secretName", Pattern: "o", Replacement: "u", @@ -60,8 +60,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "regex: should support grouping", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Regex: &servicesv1alpha1.ResourceRegexMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Regex: &syncagentv1alpha1.ResourceRegexMutation{ Path: "spec.secretName", Pattern: "(f)oo", Replacement: "oo$1", @@ -72,8 +72,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "regex: coalesces to strings", inputData: `{"spec":{"aNumber":24}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Regex: &servicesv1alpha1.ResourceRegexMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Regex: &syncagentv1alpha1.ResourceRegexMutation{ Path: "spec.aNumber", Pattern: "4", Replacement: "5", @@ -84,8 +84,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "regex: can change types", inputData: `{"spec":{"aNumber":24}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Regex: &servicesv1alpha1.ResourceRegexMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Regex: &syncagentv1alpha1.ResourceRegexMutation{ Path: "spec", Replacement: "new-value", }, @@ -95,8 +95,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "regex: can change types /2", inputData: `{"spec":{"aNumber":24}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Regex: &servicesv1alpha1.ResourceRegexMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Regex: &syncagentv1alpha1.ResourceRegexMutation{ Path: "spec", // Due to the string coalescing, this will turn the {aNumber:42} object // into a string, of which we match every character and return it, @@ -110,8 +110,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "regex: can empty values", inputData: `{"spec":{"aNumber":24}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Regex: &servicesv1alpha1.ResourceRegexMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Regex: &syncagentv1alpha1.ResourceRegexMutation{ Path: "spec", Replacement: "", }, @@ -121,8 +121,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "regex: can empty values /2", inputData: `{"spec":{"aNumber":24}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Regex: &servicesv1alpha1.ResourceRegexMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Regex: &syncagentv1alpha1.ResourceRegexMutation{ Path: "spec", Pattern: ".+", Replacement: "", @@ -136,8 +136,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "template: empty template returns empty value", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Template: &servicesv1alpha1.ResourceTemplateMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Template: &syncagentv1alpha1.ResourceTemplateMutation{ Path: "spec.secretName", }, }, @@ -146,8 +146,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "template: can change value type", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Template: &servicesv1alpha1.ResourceTemplateMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Template: &syncagentv1alpha1.ResourceTemplateMutation{ Path: "spec", }, }, @@ -156,8 +156,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "template: execute basic template", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Template: &servicesv1alpha1.ResourceTemplateMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Template: &syncagentv1alpha1.ResourceTemplateMutation{ Path: "spec.secretName", Template: `{{ upper .Value.String }}`, }, @@ -170,8 +170,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "delete: can remove object keys", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Delete: &servicesv1alpha1.ResourceDeleteMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Delete: &syncagentv1alpha1.ResourceDeleteMutation{ Path: "spec.secretName", }, }, @@ -180,8 +180,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "delete: can remove array items", inputData: `{"spec":[1,2,3]}`, - mutation: servicesv1alpha1.ResourceMutation{ - Delete: &servicesv1alpha1.ResourceDeleteMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Delete: &syncagentv1alpha1.ResourceDeleteMutation{ Path: "spec.1", }, }, @@ -193,8 +193,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "Rudi: empty script", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Rudi: &servicesv1alpha1.ResourceRudiMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Rudi: &syncagentv1alpha1.ResourceRudiMutation{ Script: `.`, }, }, @@ -203,8 +203,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "Rudi: set one new key", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Rudi: &servicesv1alpha1.ResourceRudiMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Rudi: &syncagentv1alpha1.ResourceRudiMutation{ Script: `(set! .foo "bar")`, }, }, @@ -213,8 +213,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "Rudi: update existing key", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Rudi: &servicesv1alpha1.ResourceRudiMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Rudi: &syncagentv1alpha1.ResourceRudiMutation{ Script: `(set! .spec.secretName "bar")`, }, }, @@ -223,8 +223,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "Rudi: remove a key", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Rudi: &servicesv1alpha1.ResourceRudiMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Rudi: &syncagentv1alpha1.ResourceRudiMutation{ Script: `(delete! .spec.secretName)`, }, }, @@ -233,8 +233,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "Rudi: result value is ignored, only document counts", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Rudi: &servicesv1alpha1.ResourceRudiMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Rudi: &syncagentv1alpha1.ResourceRudiMutation{ Script: `(delete! .spec.secretName) false`, }, }, @@ -243,8 +243,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "Rudi: local object becomes $localObj", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Rudi: &servicesv1alpha1.ResourceRudiMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Rudi: &syncagentv1alpha1.ResourceRudiMutation{ Script: `(set! .spec $localObj.local)`, }, }, @@ -258,8 +258,8 @@ func TestApplyResourceMutation(t *testing.T) { { name: "Rudi: remote object becomes $remoteObj", inputData: `{"spec":{"secretName":"foo"}}`, - mutation: servicesv1alpha1.ResourceMutation{ - Rudi: &servicesv1alpha1.ResourceRudiMutation{ + mutation: syncagentv1alpha1.ResourceMutation{ + Rudi: &syncagentv1alpha1.ResourceRudiMutation{ Script: `(set! .spec $remoteObj.remote)`, }, }, diff --git a/internal/mutation/mutator.go b/internal/mutation/mutator.go index 4d307e4..d3cc6f7 100644 --- a/internal/mutation/mutator.go +++ b/internal/mutation/mutator.go @@ -19,7 +19,7 @@ package mutation import ( "fmt" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) @@ -36,14 +36,14 @@ type Mutator interface { } type mutator struct { - spec *servicesv1alpha1.ResourceMutationSpec + spec *syncagentv1alpha1.ResourceMutationSpec } var _ Mutator = &mutator{} // NewMutator creates a new mutator, which will apply the mutation rules to a synced object, in // both directions. A nil spec is supported and will simply make the mutator not do anything. -func NewMutator(spec *servicesv1alpha1.ResourceMutationSpec) Mutator { +func NewMutator(spec *syncagentv1alpha1.ResourceMutationSpec) Mutator { return &mutator{ spec: spec, } diff --git a/internal/projection/naming.go b/internal/projection/naming.go index 926c06e..39df5a6 100644 --- a/internal/projection/naming.go +++ b/internal/projection/naming.go @@ -24,30 +24,30 @@ import ( "github.com/kcp-dev/logicalcluster/v3" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ) -var DefaultNamingScheme = servicesv1alpha1.ResourceNaming{ - Namespace: servicesv1alpha1.PlaceholderRemoteClusterName, - Name: fmt.Sprintf("%s-%s", servicesv1alpha1.PlaceholderRemoteNamespaceHash, servicesv1alpha1.PlaceholderRemoteNameHash), +var DefaultNamingScheme = syncagentv1alpha1.ResourceNaming{ + Namespace: syncagentv1alpha1.PlaceholderRemoteClusterName, + Name: fmt.Sprintf("%s-%s", syncagentv1alpha1.PlaceholderRemoteNamespaceHash, syncagentv1alpha1.PlaceholderRemoteNameHash), } -func GenerateLocalObjectName(pr *servicesv1alpha1.PublishedResource, object metav1.Object, clusterName logicalcluster.Name) types.NamespacedName { +func GenerateLocalObjectName(pr *syncagentv1alpha1.PublishedResource, object metav1.Object, clusterName logicalcluster.Name) types.NamespacedName { naming := pr.Spec.Naming if naming == nil { - naming = &servicesv1alpha1.ResourceNaming{} + naming = &syncagentv1alpha1.ResourceNaming{} } replacer := strings.NewReplacer( // order of elements is important here, "$fooHash" needs to be defined before "$foo" - servicesv1alpha1.PlaceholderRemoteClusterName, clusterName.String(), - servicesv1alpha1.PlaceholderRemoteNamespaceHash, shortSha1Hash(object.GetNamespace()), - servicesv1alpha1.PlaceholderRemoteNamespace, object.GetNamespace(), - servicesv1alpha1.PlaceholderRemoteNameHash, shortSha1Hash(object.GetName()), - servicesv1alpha1.PlaceholderRemoteName, object.GetName(), + syncagentv1alpha1.PlaceholderRemoteClusterName, clusterName.String(), + syncagentv1alpha1.PlaceholderRemoteNamespaceHash, shortSha1Hash(object.GetNamespace()), + syncagentv1alpha1.PlaceholderRemoteNamespace, object.GetNamespace(), + syncagentv1alpha1.PlaceholderRemoteNameHash, shortSha1Hash(object.GetName()), + syncagentv1alpha1.PlaceholderRemoteName, object.GetName(), ) result := types.NamespacedName{} diff --git a/internal/projection/naming_test.go b/internal/projection/naming_test.go index ac106a6..a8e1dd1 100644 --- a/internal/projection/naming_test.go +++ b/internal/projection/naming_test.go @@ -21,7 +21,7 @@ import ( "github.com/kcp-dev/logicalcluster/v3" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -41,7 +41,7 @@ func TestGenerateLocalObjectName(t *testing.T) { name string clusterName string remoteObject metav1.Object - namingConfig *servicesv1alpha1.ResourceNaming + namingConfig *syncagentv1alpha1.ResourceNaming expected types.NamespacedName }{ { @@ -55,43 +55,43 @@ func TestGenerateLocalObjectName(t *testing.T) { name: "custom static namespace pattern", clusterName: "testcluster", remoteObject: createNewObject("objname", "objnamespace"), - namingConfig: &servicesv1alpha1.ResourceNaming{Namespace: "foobar"}, + namingConfig: &syncagentv1alpha1.ResourceNaming{Namespace: "foobar"}, expected: types.NamespacedName{Namespace: "foobar", Name: "e75ee3d444e238331f6a-8b09d63c82efb771a2c5"}, }, { name: "custom dynamic namespace pattern", clusterName: "testcluster", remoteObject: createNewObject("objname", "objnamespace"), - namingConfig: &servicesv1alpha1.ResourceNaming{Namespace: "foobar-$remoteClusterName"}, + namingConfig: &syncagentv1alpha1.ResourceNaming{Namespace: "foobar-$remoteClusterName"}, expected: types.NamespacedName{Namespace: "foobar-testcluster", Name: "e75ee3d444e238331f6a-8b09d63c82efb771a2c5"}, }, { name: "plain, unhashed values should be available in patterns", clusterName: "testcluster", remoteObject: createNewObject("objname", "objnamespace"), - namingConfig: &servicesv1alpha1.ResourceNaming{Namespace: "$remoteNamespace"}, + namingConfig: &syncagentv1alpha1.ResourceNaming{Namespace: "$remoteNamespace"}, expected: types.NamespacedName{Namespace: "objnamespace", Name: "e75ee3d444e238331f6a-8b09d63c82efb771a2c5"}, }, { name: "configured but empty patterns", clusterName: "testcluster", remoteObject: createNewObject("objname", "objnamespace"), - namingConfig: &servicesv1alpha1.ResourceNaming{Namespace: "", Name: ""}, + namingConfig: &syncagentv1alpha1.ResourceNaming{Namespace: "", Name: ""}, expected: types.NamespacedName{Namespace: "testcluster", Name: "e75ee3d444e238331f6a-8b09d63c82efb771a2c5"}, }, { name: "custom dynamic name pattern", clusterName: "testcluster", remoteObject: createNewObject("objname", "objnamespace"), - namingConfig: &servicesv1alpha1.ResourceNaming{Name: "foobar-$remoteName"}, + namingConfig: &syncagentv1alpha1.ResourceNaming{Name: "foobar-$remoteName"}, expected: types.NamespacedName{Namespace: "testcluster", Name: "foobar-objname"}, }, } for _, testcase := range testcases { t.Run(testcase.name, func(t *testing.T) { - pubRes := &servicesv1alpha1.PublishedResource{ - Spec: servicesv1alpha1.PublishedResourceSpec{ + pubRes := &syncagentv1alpha1.PublishedResource{ + Spec: syncagentv1alpha1.PublishedResourceSpec{ Naming: testcase.namingConfig, }, } diff --git a/internal/projection/projection.go b/internal/projection/projection.go index 93172e6..9d3ab6b 100644 --- a/internal/projection/projection.go +++ b/internal/projection/projection.go @@ -17,14 +17,14 @@ limitations under the License. package projection import ( - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" "k8s.io/apimachinery/pkg/runtime/schema" ) // PublishedResourceSourceGVK returns the source GVK of the local resources // that are supposed to be published. -func PublishedResourceSourceGVK(pubRes *servicesv1alpha1.PublishedResource) schema.GroupVersionKind { +func PublishedResourceSourceGVK(pubRes *syncagentv1alpha1.PublishedResource) schema.GroupVersionKind { return schema.GroupVersionKind{ Group: pubRes.Spec.Resource.APIGroup, Version: pubRes.Spec.Resource.Version, @@ -34,7 +34,7 @@ func PublishedResourceSourceGVK(pubRes *servicesv1alpha1.PublishedResource) sche // PublishedResourceProjectedGVK returns the effective GVK after the projection // rules have been applied according to the PublishedResource. -func PublishedResourceProjectedGVK(pubRes *servicesv1alpha1.PublishedResource, platformAPIGroup string) schema.GroupVersionKind { +func PublishedResourceProjectedGVK(pubRes *syncagentv1alpha1.PublishedResource, platformAPIGroup string) schema.GroupVersionKind { apiVersion := pubRes.Spec.Resource.Version kind := pubRes.Spec.Resource.Kind diff --git a/internal/projection/projection_test.go b/internal/projection/projection_test.go index 730bf8d..cf305de 100644 --- a/internal/projection/projection_test.go +++ b/internal/projection/projection_test.go @@ -19,7 +19,7 @@ package projection import ( "testing" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -31,9 +31,9 @@ func TestPublishedResourceSourceGVK(t *testing.T) { kind = "test" ) - pubRes := servicesv1alpha1.PublishedResource{ - Spec: servicesv1alpha1.PublishedResourceSpec{ - Resource: servicesv1alpha1.SourceResourceDescriptor{ + pubRes := syncagentv1alpha1.PublishedResource{ + Spec: syncagentv1alpha1.PublishedResourceSpec{ + Resource: syncagentv1alpha1.SourceResourceDescriptor{ APIGroup: apiGroup, Version: version, Kind: kind, @@ -64,9 +64,9 @@ func TestPublishedResourceProjectedGVK(t *testing.T) { kind = "test" ) - pubRes := &servicesv1alpha1.PublishedResource{ - Spec: servicesv1alpha1.PublishedResourceSpec{ - Resource: servicesv1alpha1.SourceResourceDescriptor{ + pubRes := &syncagentv1alpha1.PublishedResource{ + Spec: syncagentv1alpha1.PublishedResourceSpec{ + Resource: syncagentv1alpha1.SourceResourceDescriptor{ APIGroup: apiGroup, Version: version, Kind: kind, @@ -76,7 +76,7 @@ func TestPublishedResourceProjectedGVK(t *testing.T) { testcases := []struct { name string - projection *servicesv1alpha1.ResourceProjection + projection *syncagentv1alpha1.ResourceProjection expected schema.GroupVersionKind }{ { @@ -86,17 +86,17 @@ func TestPublishedResourceProjectedGVK(t *testing.T) { }, { name: "override version", - projection: &servicesv1alpha1.ResourceProjection{Version: "v2"}, + projection: &syncagentv1alpha1.ResourceProjection{Version: "v2"}, expected: schema.GroupVersionKind{Group: overrideAPIGroup, Version: "v2", Kind: kind}, }, { name: "override kind", - projection: &servicesv1alpha1.ResourceProjection{Kind: "dummy"}, + projection: &syncagentv1alpha1.ResourceProjection{Kind: "dummy"}, expected: schema.GroupVersionKind{Group: overrideAPIGroup, Version: version, Kind: "dummy"}, }, { name: "override both", - projection: &servicesv1alpha1.ResourceProjection{Version: "v2", Kind: "dummy"}, + projection: &syncagentv1alpha1.ResourceProjection{Version: "v2", Kind: "dummy"}, expected: schema.GroupVersionKind{Group: overrideAPIGroup, Version: "v2", Kind: "dummy"}, }, } diff --git a/internal/sync/syncer.go b/internal/sync/syncer.go index 294f9e7..e9b002f 100644 --- a/internal/sync/syncer.go +++ b/internal/sync/syncer.go @@ -24,7 +24,7 @@ import ( "github.com/kcp-dev/api-syncagent/internal/mutation" "github.com/kcp-dev/api-syncagent/internal/projection" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -39,7 +39,7 @@ type ResourceSyncer struct { localClient ctrlruntimeclient.Client remoteClient ctrlruntimeclient.Client - pubRes *servicesv1alpha1.PublishedResource + pubRes *syncagentv1alpha1.PublishedResource localCRD *apiextensionsv1.CustomResourceDefinition subresources []string @@ -55,7 +55,7 @@ func NewResourceSyncer( log *zap.SugaredLogger, localClient ctrlruntimeclient.Client, remoteClient ctrlruntimeclient.Client, - pubRes *servicesv1alpha1.PublishedResource, + pubRes *syncagentv1alpha1.PublishedResource, localCRD *apiextensionsv1.CustomResourceDefinition, remoteAPIGroup string, mutator mutation.Mutator, @@ -211,17 +211,17 @@ func (s *ResourceSyncer) createLocalObjectCreator(ctx Context) objectCreatorFunc destObj.SetGroupVersionKind(s.destDummy.GroupVersionKind()) // change scope if desired - destScope := servicesv1alpha1.ResourceScope(s.localCRD.Spec.Scope) + destScope := syncagentv1alpha1.ResourceScope(s.localCRD.Spec.Scope) // map namespace/name mappedName := projection.GenerateLocalObjectName(s.pubRes, remoteObj, logicalcluster.Name(ctx.clusterName)) switch destScope { - case servicesv1alpha1.ClusterScoped: + case syncagentv1alpha1.ClusterScoped: destObj.SetNamespace("") destObj.SetName(mappedName.Name) - case servicesv1alpha1.NamespaceScoped: + case syncagentv1alpha1.NamespaceScoped: destObj.SetNamespace(mappedName.Namespace) destObj.SetName(mappedName.Name) } diff --git a/internal/sync/syncer_related.go b/internal/sync/syncer_related.go index 4ad9d65..3e4594a 100644 --- a/internal/sync/syncer_related.go +++ b/internal/sync/syncer_related.go @@ -25,7 +25,7 @@ import ( "go.uber.org/zap" "github.com/kcp-dev/api-syncagent/internal/mutation" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -55,7 +55,7 @@ type relatedObjectAnnotation struct { Kind string `json:"kind"` } -func (s *ResourceSyncer) processRelatedResource(log *zap.SugaredLogger, stateStore ObjectStateStore, remote, local syncSide, relRes servicesv1alpha1.RelatedResourceSpec) (requeue bool, err error) { +func (s *ResourceSyncer) processRelatedResource(log *zap.SugaredLogger, stateStore ObjectStateStore, remote, local syncSide, relRes syncagentv1alpha1.RelatedResourceSpec) (requeue bool, err error) { // decide what direction to sync (local->remote vs. remote->local) var ( source syncSide @@ -197,7 +197,7 @@ func (s *ResourceSyncer) processRelatedResource(log *zap.SugaredLogger, stateSto return false, nil } -func resolveResourceReference(obj *unstructured.Unstructured, ref servicesv1alpha1.RelatedResourceReference) (*ctrlruntimeclient.ObjectKey, error) { +func resolveResourceReference(obj *unstructured.Unstructured, ref syncagentv1alpha1.RelatedResourceReference) (*ctrlruntimeclient.ObjectKey, error) { jsonData, err := obj.MarshalJSON() if err != nil { return nil, err @@ -222,7 +222,7 @@ func resolveResourceReference(obj *unstructured.Unstructured, ref servicesv1alph }, nil } -func resolveResourceLocator(jsonData string, loc servicesv1alpha1.ResourceLocator) (string, error) { +func resolveResourceLocator(jsonData string, loc syncagentv1alpha1.ResourceLocator) (string, error) { gval := gjson.Get(jsonData, loc.Path) if !gval.Exists() { return "", fmt.Errorf("cannot find %s in document", loc.Path) diff --git a/internal/sync/syncer_test.go b/internal/sync/syncer_test.go index b0715b8..56a92ea 100644 --- a/internal/sync/syncer_test.go +++ b/internal/sync/syncer_test.go @@ -28,7 +28,7 @@ import ( dummyv1alpha1 "github.com/kcp-dev/api-syncagent/internal/sync/apis/dummy/v1alpha1" "github.com/kcp-dev/api-syncagent/internal/test/diff" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -126,7 +126,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) { name string remoteAPIGroup string localCRD *apiextensionsv1.CustomResourceDefinition - pubRes *servicesv1alpha1.PublishedResource + pubRes *syncagentv1alpha1.PublishedResource remoteObject *unstructured.Unstructured localObject *unstructured.Unstructured existingState string @@ -139,18 +139,18 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) { clusterName := logicalcluster.Name("testcluster") - remoteThingPR := &servicesv1alpha1.PublishedResource{ - Spec: servicesv1alpha1.PublishedResourceSpec{ - Resource: servicesv1alpha1.SourceResourceDescriptor{ + remoteThingPR := &syncagentv1alpha1.PublishedResource{ + Spec: syncagentv1alpha1.PublishedResourceSpec{ + Resource: syncagentv1alpha1.SourceResourceDescriptor{ APIGroup: dummyv1alpha1.GroupName, Version: dummyv1alpha1.GroupVersion, Kind: "Thing", }, - Projection: &servicesv1alpha1.ResourceProjection{ + Projection: &syncagentv1alpha1.ResourceProjection{ Kind: "RemoteThing", }, // include explicit naming rules to be independent of possible changes to the defaults - Naming: &servicesv1alpha1.ResourceNaming{ + Naming: &syncagentv1alpha1.ResourceNaming{ Name: "$remoteClusterName-$remoteName", // Things are Cluster-scoped }, }, @@ -908,7 +908,7 @@ func TestSyncerProcessingSingleResourceWithStatus(t *testing.T) { name string remoteAPIGroup string localCRD *apiextensionsv1.CustomResourceDefinition - pubRes *servicesv1alpha1.PublishedResource + pubRes *syncagentv1alpha1.PublishedResource remoteObject *unstructured.Unstructured localObject *unstructured.Unstructured existingState string @@ -921,18 +921,18 @@ func TestSyncerProcessingSingleResourceWithStatus(t *testing.T) { clusterName := logicalcluster.Name("testcluster") - remoteThingPR := &servicesv1alpha1.PublishedResource{ - Spec: servicesv1alpha1.PublishedResourceSpec{ - Resource: servicesv1alpha1.SourceResourceDescriptor{ + remoteThingPR := &syncagentv1alpha1.PublishedResource{ + Spec: syncagentv1alpha1.PublishedResourceSpec{ + Resource: syncagentv1alpha1.SourceResourceDescriptor{ APIGroup: dummyv1alpha1.GroupName, Version: dummyv1alpha1.GroupVersion, Kind: "ThingWithStatusSubresource", }, - Projection: &servicesv1alpha1.ResourceProjection{ + Projection: &syncagentv1alpha1.ResourceProjection{ Kind: "RemoteThing", }, // include explicit naming rules to be independent of possible changes to the defaults - Naming: &servicesv1alpha1.ResourceNaming{ + Naming: &syncagentv1alpha1.ResourceNaming{ Name: "$remoteClusterName-$remoteName", // Things are Cluster-scoped }, }, diff --git a/sdk/apis/services/v1alpha1/doc.go b/sdk/apis/syncagent/v1alpha1/doc.go similarity index 94% rename from sdk/apis/services/v1alpha1/doc.go rename to sdk/apis/syncagent/v1alpha1/doc.go index b5e7f87..6d7e9ea 100644 --- a/sdk/apis/services/v1alpha1/doc.go +++ b/sdk/apis/syncagent/v1alpha1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +groupName=services.syncagent.kcp.io +// +groupName=syncagent.kcp.io // +versionName=v1alpha1 // +kubebuilder:object:generate=true package v1alpha1 diff --git a/sdk/apis/services/v1alpha1/published_resource.go b/sdk/apis/syncagent/v1alpha1/published_resource.go similarity index 100% rename from sdk/apis/services/v1alpha1/published_resource.go rename to sdk/apis/syncagent/v1alpha1/published_resource.go diff --git a/sdk/apis/services/v1alpha1/register.go b/sdk/apis/syncagent/v1alpha1/register.go similarity index 93% rename from sdk/apis/services/v1alpha1/register.go rename to sdk/apis/syncagent/v1alpha1/register.go index d0f1ca4..a4b61e5 100644 --- a/sdk/apis/services/v1alpha1/register.go +++ b/sdk/apis/syncagent/v1alpha1/register.go @@ -27,12 +27,12 @@ import ( func init() { if err := AddToScheme(scheme.Scheme); err != nil { - panic(fmt.Sprintf("failed to add sync agent services scheme: %v", err)) + panic(fmt.Sprintf("failed to add syncagent.kcp.io scheme: %v", err)) } } // GroupName is the group name use in this package. -const GroupName = "services.syncagent.k8c.io" +const GroupName = "syncagent.k8c.io" const GroupVersion = "v1alpha1" var ( diff --git a/sdk/apis/services/types.go b/sdk/apis/syncagent/v1alpha1/types.go similarity index 98% rename from sdk/apis/services/types.go rename to sdk/apis/syncagent/v1alpha1/types.go index 5407ad5..c5aeb98 100644 --- a/sdk/apis/services/types.go +++ b/sdk/apis/syncagent/v1alpha1/types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package services +package v1alpha1 const ( // AgentNameAnnotation records which Sync Agent has created an APIResourceSchema. diff --git a/sdk/apis/services/v1alpha1/zz_generated.deepcopy.go b/sdk/apis/syncagent/v1alpha1/zz_generated.deepcopy.go similarity index 100% rename from sdk/apis/services/v1alpha1/zz_generated.deepcopy.go rename to sdk/apis/syncagent/v1alpha1/zz_generated.deepcopy.go diff --git a/sdk/applyconfiguration/apis/v1alpha1/publishedresource.go b/sdk/applyconfiguration/apis/v1alpha1/publishedresource.go new file mode 100644 index 0000000..7f0ede0 --- /dev/null +++ b/sdk/applyconfiguration/apis/v1alpha1/publishedresource.go @@ -0,0 +1,224 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PublishedResourceApplyConfiguration represents a declarative configuration of the PublishedResource type for use +// with apply. +type PublishedResourceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PublishedResourceSpecApplyConfiguration `json:"spec,omitempty"` + Status *PublishedResourceStatusApplyConfiguration `json:"status,omitempty"` +} + +// PublishedResource constructs a declarative configuration of the PublishedResource type for use with +// apply. +func PublishedResource(name string) *PublishedResourceApplyConfiguration { + b := &PublishedResourceApplyConfiguration{} + b.WithName(name) + b.WithKind("PublishedResource") + b.WithAPIVersion("syncagent.kcp.io/v1alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithKind(value string) *PublishedResourceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithAPIVersion(value string) *PublishedResourceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithName(value string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithGenerateName(value string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithNamespace(value string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithUID(value types.UID) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithResourceVersion(value string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithGeneration(value int64) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PublishedResourceApplyConfiguration) WithLabels(entries map[string]string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PublishedResourceApplyConfiguration) WithAnnotations(entries map[string]string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PublishedResourceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PublishedResourceApplyConfiguration) WithFinalizers(values ...string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PublishedResourceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithSpec(value *PublishedResourceSpecApplyConfiguration) *PublishedResourceApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithStatus(value *PublishedResourceStatusApplyConfiguration) *PublishedResourceApplyConfiguration { + b.Status = value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *PublishedResourceApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/sdk/applyconfiguration/apis/v1alpha1/publishedresourcespec.go b/sdk/applyconfiguration/apis/v1alpha1/publishedresourcespec.go new file mode 100644 index 0000000..725ae62 --- /dev/null +++ b/sdk/applyconfiguration/apis/v1alpha1/publishedresourcespec.go @@ -0,0 +1,80 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// PublishedResourceSpecApplyConfiguration represents a declarative configuration of the PublishedResourceSpec type for use +// with apply. +type PublishedResourceSpecApplyConfiguration struct { + Resource *SourceResourceDescriptorApplyConfiguration `json:"resource,omitempty"` + Filter *ResourceFilterApplyConfiguration `json:"filter,omitempty"` + Naming *ResourceNamingApplyConfiguration `json:"naming,omitempty"` + Projection *ResourceProjectionApplyConfiguration `json:"projection,omitempty"` + Related []RelatedResourceSpecApplyConfiguration `json:"related,omitempty"` +} + +// PublishedResourceSpecApplyConfiguration constructs a declarative configuration of the PublishedResourceSpec type for use with +// apply. +func PublishedResourceSpec() *PublishedResourceSpecApplyConfiguration { + return &PublishedResourceSpecApplyConfiguration{} +} + +// WithResource sets the Resource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resource field is set to the value of the last call. +func (b *PublishedResourceSpecApplyConfiguration) WithResource(value *SourceResourceDescriptorApplyConfiguration) *PublishedResourceSpecApplyConfiguration { + b.Resource = value + return b +} + +// WithFilter sets the Filter field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Filter field is set to the value of the last call. +func (b *PublishedResourceSpecApplyConfiguration) WithFilter(value *ResourceFilterApplyConfiguration) *PublishedResourceSpecApplyConfiguration { + b.Filter = value + return b +} + +// WithNaming sets the Naming field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Naming field is set to the value of the last call. +func (b *PublishedResourceSpecApplyConfiguration) WithNaming(value *ResourceNamingApplyConfiguration) *PublishedResourceSpecApplyConfiguration { + b.Naming = value + return b +} + +// WithProjection sets the Projection field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Projection field is set to the value of the last call. +func (b *PublishedResourceSpecApplyConfiguration) WithProjection(value *ResourceProjectionApplyConfiguration) *PublishedResourceSpecApplyConfiguration { + b.Projection = value + return b +} + +// WithRelated adds the given value to the Related field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Related field. +func (b *PublishedResourceSpecApplyConfiguration) WithRelated(values ...*RelatedResourceSpecApplyConfiguration) *PublishedResourceSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRelated") + } + b.Related = append(b.Related, *values[i]) + } + return b +} diff --git a/sdk/applyconfiguration/apis/v1alpha1/publishedresourcestatus.go b/sdk/applyconfiguration/apis/v1alpha1/publishedresourcestatus.go new file mode 100644 index 0000000..99f3d03 --- /dev/null +++ b/sdk/applyconfiguration/apis/v1alpha1/publishedresourcestatus.go @@ -0,0 +1,39 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// PublishedResourceStatusApplyConfiguration represents a declarative configuration of the PublishedResourceStatus type for use +// with apply. +type PublishedResourceStatusApplyConfiguration struct { + ResourceSchemaName *string `json:"resourceSchemaName,omitempty"` +} + +// PublishedResourceStatusApplyConfiguration constructs a declarative configuration of the PublishedResourceStatus type for use with +// apply. +func PublishedResourceStatus() *PublishedResourceStatusApplyConfiguration { + return &PublishedResourceStatusApplyConfiguration{} +} + +// WithResourceSchemaName sets the ResourceSchemaName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceSchemaName field is set to the value of the last call. +func (b *PublishedResourceStatusApplyConfiguration) WithResourceSchemaName(value string) *PublishedResourceStatusApplyConfiguration { + b.ResourceSchemaName = &value + return b +} diff --git a/sdk/applyconfiguration/apis/v1alpha1/regexresourcelocator.go b/sdk/applyconfiguration/apis/v1alpha1/regexresourcelocator.go new file mode 100644 index 0000000..e4ebcca --- /dev/null +++ b/sdk/applyconfiguration/apis/v1alpha1/regexresourcelocator.go @@ -0,0 +1,48 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// RegexResourceLocatorApplyConfiguration represents a declarative configuration of the RegexResourceLocator type for use +// with apply. +type RegexResourceLocatorApplyConfiguration struct { + Pattern *string `json:"pattern,omitempty"` + Replacement *string `json:"replacement,omitempty"` +} + +// RegexResourceLocatorApplyConfiguration constructs a declarative configuration of the RegexResourceLocator type for use with +// apply. +func RegexResourceLocator() *RegexResourceLocatorApplyConfiguration { + return &RegexResourceLocatorApplyConfiguration{} +} + +// WithPattern sets the Pattern field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Pattern field is set to the value of the last call. +func (b *RegexResourceLocatorApplyConfiguration) WithPattern(value string) *RegexResourceLocatorApplyConfiguration { + b.Pattern = &value + return b +} + +// WithReplacement sets the Replacement field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replacement field is set to the value of the last call. +func (b *RegexResourceLocatorApplyConfiguration) WithReplacement(value string) *RegexResourceLocatorApplyConfiguration { + b.Replacement = &value + return b +} diff --git a/sdk/applyconfiguration/apis/v1alpha1/relatedresourcereference.go b/sdk/applyconfiguration/apis/v1alpha1/relatedresourcereference.go new file mode 100644 index 0000000..ebdcb0c --- /dev/null +++ b/sdk/applyconfiguration/apis/v1alpha1/relatedresourcereference.go @@ -0,0 +1,48 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// RelatedResourceReferenceApplyConfiguration represents a declarative configuration of the RelatedResourceReference type for use +// with apply. +type RelatedResourceReferenceApplyConfiguration struct { + Name *ResourceLocatorApplyConfiguration `json:"name,omitempty"` + Namespace *ResourceLocatorApplyConfiguration `json:"namespace,omitempty"` +} + +// RelatedResourceReferenceApplyConfiguration constructs a declarative configuration of the RelatedResourceReference type for use with +// apply. +func RelatedResourceReference() *RelatedResourceReferenceApplyConfiguration { + return &RelatedResourceReferenceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RelatedResourceReferenceApplyConfiguration) WithName(value *ResourceLocatorApplyConfiguration) *RelatedResourceReferenceApplyConfiguration { + b.Name = value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *RelatedResourceReferenceApplyConfiguration) WithNamespace(value *ResourceLocatorApplyConfiguration) *RelatedResourceReferenceApplyConfiguration { + b.Namespace = value + return b +} diff --git a/sdk/applyconfiguration/apis/v1alpha1/relatedresourcespec.go b/sdk/applyconfiguration/apis/v1alpha1/relatedresourcespec.go new file mode 100644 index 0000000..3eb9eb8 --- /dev/null +++ b/sdk/applyconfiguration/apis/v1alpha1/relatedresourcespec.go @@ -0,0 +1,66 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// RelatedResourceSpecApplyConfiguration represents a declarative configuration of the RelatedResourceSpec type for use +// with apply. +type RelatedResourceSpecApplyConfiguration struct { + Identifier *string `json:"identifier,omitempty"` + Origin *string `json:"origin,omitempty"` + Kind *string `json:"kind,omitempty"` + Reference *RelatedResourceReferenceApplyConfiguration `json:"reference,omitempty"` +} + +// RelatedResourceSpecApplyConfiguration constructs a declarative configuration of the RelatedResourceSpec type for use with +// apply. +func RelatedResourceSpec() *RelatedResourceSpecApplyConfiguration { + return &RelatedResourceSpecApplyConfiguration{} +} + +// WithIdentifier sets the Identifier field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Identifier field is set to the value of the last call. +func (b *RelatedResourceSpecApplyConfiguration) WithIdentifier(value string) *RelatedResourceSpecApplyConfiguration { + b.Identifier = &value + return b +} + +// WithOrigin sets the Origin field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Origin field is set to the value of the last call. +func (b *RelatedResourceSpecApplyConfiguration) WithOrigin(value string) *RelatedResourceSpecApplyConfiguration { + b.Origin = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RelatedResourceSpecApplyConfiguration) WithKind(value string) *RelatedResourceSpecApplyConfiguration { + b.Kind = &value + return b +} + +// WithReference sets the Reference field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reference field is set to the value of the last call. +func (b *RelatedResourceSpecApplyConfiguration) WithReference(value *RelatedResourceReferenceApplyConfiguration) *RelatedResourceSpecApplyConfiguration { + b.Reference = value + return b +} diff --git a/sdk/applyconfiguration/apis/v1alpha1/resourcefilter.go b/sdk/applyconfiguration/apis/v1alpha1/resourcefilter.go new file mode 100644 index 0000000..5636de8 --- /dev/null +++ b/sdk/applyconfiguration/apis/v1alpha1/resourcefilter.go @@ -0,0 +1,52 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceFilterApplyConfiguration represents a declarative configuration of the ResourceFilter type for use +// with apply. +type ResourceFilterApplyConfiguration struct { + Namespace *v1.LabelSelectorApplyConfiguration `json:"namespace,omitempty"` + Resource *v1.LabelSelectorApplyConfiguration `json:"resource,omitempty"` +} + +// ResourceFilterApplyConfiguration constructs a declarative configuration of the ResourceFilter type for use with +// apply. +func ResourceFilter() *ResourceFilterApplyConfiguration { + return &ResourceFilterApplyConfiguration{} +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceFilterApplyConfiguration) WithNamespace(value *v1.LabelSelectorApplyConfiguration) *ResourceFilterApplyConfiguration { + b.Namespace = value + return b +} + +// WithResource sets the Resource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resource field is set to the value of the last call. +func (b *ResourceFilterApplyConfiguration) WithResource(value *v1.LabelSelectorApplyConfiguration) *ResourceFilterApplyConfiguration { + b.Resource = value + return b +} diff --git a/sdk/applyconfiguration/apis/v1alpha1/resourcelocator.go b/sdk/applyconfiguration/apis/v1alpha1/resourcelocator.go new file mode 100644 index 0000000..61e9ce4 --- /dev/null +++ b/sdk/applyconfiguration/apis/v1alpha1/resourcelocator.go @@ -0,0 +1,48 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ResourceLocatorApplyConfiguration represents a declarative configuration of the ResourceLocator type for use +// with apply. +type ResourceLocatorApplyConfiguration struct { + Path *string `json:"path,omitempty"` + Regex *RegexResourceLocatorApplyConfiguration `json:"regex,omitempty"` +} + +// ResourceLocatorApplyConfiguration constructs a declarative configuration of the ResourceLocator type for use with +// apply. +func ResourceLocator() *ResourceLocatorApplyConfiguration { + return &ResourceLocatorApplyConfiguration{} +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *ResourceLocatorApplyConfiguration) WithPath(value string) *ResourceLocatorApplyConfiguration { + b.Path = &value + return b +} + +// WithRegex sets the Regex field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Regex field is set to the value of the last call. +func (b *ResourceLocatorApplyConfiguration) WithRegex(value *RegexResourceLocatorApplyConfiguration) *ResourceLocatorApplyConfiguration { + b.Regex = value + return b +} diff --git a/sdk/applyconfiguration/apis/v1alpha1/resourcenaming.go b/sdk/applyconfiguration/apis/v1alpha1/resourcenaming.go new file mode 100644 index 0000000..6f1ffa7 --- /dev/null +++ b/sdk/applyconfiguration/apis/v1alpha1/resourcenaming.go @@ -0,0 +1,48 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ResourceNamingApplyConfiguration represents a declarative configuration of the ResourceNaming type for use +// with apply. +type ResourceNamingApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` +} + +// ResourceNamingApplyConfiguration constructs a declarative configuration of the ResourceNaming type for use with +// apply. +func ResourceNaming() *ResourceNamingApplyConfiguration { + return &ResourceNamingApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceNamingApplyConfiguration) WithName(value string) *ResourceNamingApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceNamingApplyConfiguration) WithNamespace(value string) *ResourceNamingApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/sdk/applyconfiguration/apis/v1alpha1/resourceprojection.go b/sdk/applyconfiguration/apis/v1alpha1/resourceprojection.go new file mode 100644 index 0000000..e46567b --- /dev/null +++ b/sdk/applyconfiguration/apis/v1alpha1/resourceprojection.go @@ -0,0 +1,92 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" +) + +// ResourceProjectionApplyConfiguration represents a declarative configuration of the ResourceProjection type for use +// with apply. +type ResourceProjectionApplyConfiguration struct { + Version *string `json:"version,omitempty"` + Scope *v1alpha1.ResourceScope `json:"scope,omitempty"` + Kind *string `json:"kind,omitempty"` + Plural *string `json:"plural,omitempty"` + ShortNames []string `json:"shortNames,omitempty"` + Categories []string `json:"categories,omitempty"` +} + +// ResourceProjectionApplyConfiguration constructs a declarative configuration of the ResourceProjection type for use with +// apply. +func ResourceProjection() *ResourceProjectionApplyConfiguration { + return &ResourceProjectionApplyConfiguration{} +} + +// WithVersion sets the Version field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Version field is set to the value of the last call. +func (b *ResourceProjectionApplyConfiguration) WithVersion(value string) *ResourceProjectionApplyConfiguration { + b.Version = &value + return b +} + +// WithScope sets the Scope field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scope field is set to the value of the last call. +func (b *ResourceProjectionApplyConfiguration) WithScope(value v1alpha1.ResourceScope) *ResourceProjectionApplyConfiguration { + b.Scope = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ResourceProjectionApplyConfiguration) WithKind(value string) *ResourceProjectionApplyConfiguration { + b.Kind = &value + return b +} + +// WithPlural sets the Plural field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Plural field is set to the value of the last call. +func (b *ResourceProjectionApplyConfiguration) WithPlural(value string) *ResourceProjectionApplyConfiguration { + b.Plural = &value + return b +} + +// WithShortNames adds the given value to the ShortNames field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ShortNames field. +func (b *ResourceProjectionApplyConfiguration) WithShortNames(values ...string) *ResourceProjectionApplyConfiguration { + for i := range values { + b.ShortNames = append(b.ShortNames, values[i]) + } + return b +} + +// WithCategories adds the given value to the Categories field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Categories field. +func (b *ResourceProjectionApplyConfiguration) WithCategories(values ...string) *ResourceProjectionApplyConfiguration { + for i := range values { + b.Categories = append(b.Categories, values[i]) + } + return b +} diff --git a/sdk/applyconfiguration/apis/v1alpha1/sourceresourcedescriptor.go b/sdk/applyconfiguration/apis/v1alpha1/sourceresourcedescriptor.go new file mode 100644 index 0000000..4b4f8e4 --- /dev/null +++ b/sdk/applyconfiguration/apis/v1alpha1/sourceresourcedescriptor.go @@ -0,0 +1,57 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// SourceResourceDescriptorApplyConfiguration represents a declarative configuration of the SourceResourceDescriptor type for use +// with apply. +type SourceResourceDescriptorApplyConfiguration struct { + APIGroup *string `json:"apiGroup,omitempty"` + Version *string `json:"version,omitempty"` + Kind *string `json:"kind,omitempty"` +} + +// SourceResourceDescriptorApplyConfiguration constructs a declarative configuration of the SourceResourceDescriptor type for use with +// apply. +func SourceResourceDescriptor() *SourceResourceDescriptorApplyConfiguration { + return &SourceResourceDescriptorApplyConfiguration{} +} + +// WithAPIGroup sets the APIGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIGroup field is set to the value of the last call. +func (b *SourceResourceDescriptorApplyConfiguration) WithAPIGroup(value string) *SourceResourceDescriptorApplyConfiguration { + b.APIGroup = &value + return b +} + +// WithVersion sets the Version field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Version field is set to the value of the last call. +func (b *SourceResourceDescriptorApplyConfiguration) WithVersion(value string) *SourceResourceDescriptorApplyConfiguration { + b.Version = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *SourceResourceDescriptorApplyConfiguration) WithKind(value string) *SourceResourceDescriptorApplyConfiguration { + b.Kind = &value + return b +} diff --git a/sdk/applyconfiguration/services/v1alpha1/resourceprojection.go b/sdk/applyconfiguration/services/v1alpha1/resourceprojection.go index 925be95..e46567b 100644 --- a/sdk/applyconfiguration/services/v1alpha1/resourceprojection.go +++ b/sdk/applyconfiguration/services/v1alpha1/resourceprojection.go @@ -19,7 +19,7 @@ limitations under the License. package v1alpha1 import ( - v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" ) // ResourceProjectionApplyConfiguration represents a declarative configuration of the ResourceProjection type for use diff --git a/sdk/applyconfiguration/syncagent/v1alpha1/publishedresource.go b/sdk/applyconfiguration/syncagent/v1alpha1/publishedresource.go new file mode 100644 index 0000000..7f0ede0 --- /dev/null +++ b/sdk/applyconfiguration/syncagent/v1alpha1/publishedresource.go @@ -0,0 +1,224 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PublishedResourceApplyConfiguration represents a declarative configuration of the PublishedResource type for use +// with apply. +type PublishedResourceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PublishedResourceSpecApplyConfiguration `json:"spec,omitempty"` + Status *PublishedResourceStatusApplyConfiguration `json:"status,omitempty"` +} + +// PublishedResource constructs a declarative configuration of the PublishedResource type for use with +// apply. +func PublishedResource(name string) *PublishedResourceApplyConfiguration { + b := &PublishedResourceApplyConfiguration{} + b.WithName(name) + b.WithKind("PublishedResource") + b.WithAPIVersion("syncagent.kcp.io/v1alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithKind(value string) *PublishedResourceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithAPIVersion(value string) *PublishedResourceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithName(value string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithGenerateName(value string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithNamespace(value string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithUID(value types.UID) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithResourceVersion(value string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithGeneration(value int64) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PublishedResourceApplyConfiguration) WithLabels(entries map[string]string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PublishedResourceApplyConfiguration) WithAnnotations(entries map[string]string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PublishedResourceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PublishedResourceApplyConfiguration) WithFinalizers(values ...string) *PublishedResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PublishedResourceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithSpec(value *PublishedResourceSpecApplyConfiguration) *PublishedResourceApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PublishedResourceApplyConfiguration) WithStatus(value *PublishedResourceStatusApplyConfiguration) *PublishedResourceApplyConfiguration { + b.Status = value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *PublishedResourceApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/sdk/applyconfiguration/syncagent/v1alpha1/publishedresourcespec.go b/sdk/applyconfiguration/syncagent/v1alpha1/publishedresourcespec.go new file mode 100644 index 0000000..725ae62 --- /dev/null +++ b/sdk/applyconfiguration/syncagent/v1alpha1/publishedresourcespec.go @@ -0,0 +1,80 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// PublishedResourceSpecApplyConfiguration represents a declarative configuration of the PublishedResourceSpec type for use +// with apply. +type PublishedResourceSpecApplyConfiguration struct { + Resource *SourceResourceDescriptorApplyConfiguration `json:"resource,omitempty"` + Filter *ResourceFilterApplyConfiguration `json:"filter,omitempty"` + Naming *ResourceNamingApplyConfiguration `json:"naming,omitempty"` + Projection *ResourceProjectionApplyConfiguration `json:"projection,omitempty"` + Related []RelatedResourceSpecApplyConfiguration `json:"related,omitempty"` +} + +// PublishedResourceSpecApplyConfiguration constructs a declarative configuration of the PublishedResourceSpec type for use with +// apply. +func PublishedResourceSpec() *PublishedResourceSpecApplyConfiguration { + return &PublishedResourceSpecApplyConfiguration{} +} + +// WithResource sets the Resource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resource field is set to the value of the last call. +func (b *PublishedResourceSpecApplyConfiguration) WithResource(value *SourceResourceDescriptorApplyConfiguration) *PublishedResourceSpecApplyConfiguration { + b.Resource = value + return b +} + +// WithFilter sets the Filter field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Filter field is set to the value of the last call. +func (b *PublishedResourceSpecApplyConfiguration) WithFilter(value *ResourceFilterApplyConfiguration) *PublishedResourceSpecApplyConfiguration { + b.Filter = value + return b +} + +// WithNaming sets the Naming field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Naming field is set to the value of the last call. +func (b *PublishedResourceSpecApplyConfiguration) WithNaming(value *ResourceNamingApplyConfiguration) *PublishedResourceSpecApplyConfiguration { + b.Naming = value + return b +} + +// WithProjection sets the Projection field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Projection field is set to the value of the last call. +func (b *PublishedResourceSpecApplyConfiguration) WithProjection(value *ResourceProjectionApplyConfiguration) *PublishedResourceSpecApplyConfiguration { + b.Projection = value + return b +} + +// WithRelated adds the given value to the Related field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Related field. +func (b *PublishedResourceSpecApplyConfiguration) WithRelated(values ...*RelatedResourceSpecApplyConfiguration) *PublishedResourceSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRelated") + } + b.Related = append(b.Related, *values[i]) + } + return b +} diff --git a/sdk/applyconfiguration/syncagent/v1alpha1/publishedresourcestatus.go b/sdk/applyconfiguration/syncagent/v1alpha1/publishedresourcestatus.go new file mode 100644 index 0000000..99f3d03 --- /dev/null +++ b/sdk/applyconfiguration/syncagent/v1alpha1/publishedresourcestatus.go @@ -0,0 +1,39 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// PublishedResourceStatusApplyConfiguration represents a declarative configuration of the PublishedResourceStatus type for use +// with apply. +type PublishedResourceStatusApplyConfiguration struct { + ResourceSchemaName *string `json:"resourceSchemaName,omitempty"` +} + +// PublishedResourceStatusApplyConfiguration constructs a declarative configuration of the PublishedResourceStatus type for use with +// apply. +func PublishedResourceStatus() *PublishedResourceStatusApplyConfiguration { + return &PublishedResourceStatusApplyConfiguration{} +} + +// WithResourceSchemaName sets the ResourceSchemaName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceSchemaName field is set to the value of the last call. +func (b *PublishedResourceStatusApplyConfiguration) WithResourceSchemaName(value string) *PublishedResourceStatusApplyConfiguration { + b.ResourceSchemaName = &value + return b +} diff --git a/sdk/applyconfiguration/syncagent/v1alpha1/regexresourcelocator.go b/sdk/applyconfiguration/syncagent/v1alpha1/regexresourcelocator.go new file mode 100644 index 0000000..e4ebcca --- /dev/null +++ b/sdk/applyconfiguration/syncagent/v1alpha1/regexresourcelocator.go @@ -0,0 +1,48 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// RegexResourceLocatorApplyConfiguration represents a declarative configuration of the RegexResourceLocator type for use +// with apply. +type RegexResourceLocatorApplyConfiguration struct { + Pattern *string `json:"pattern,omitempty"` + Replacement *string `json:"replacement,omitempty"` +} + +// RegexResourceLocatorApplyConfiguration constructs a declarative configuration of the RegexResourceLocator type for use with +// apply. +func RegexResourceLocator() *RegexResourceLocatorApplyConfiguration { + return &RegexResourceLocatorApplyConfiguration{} +} + +// WithPattern sets the Pattern field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Pattern field is set to the value of the last call. +func (b *RegexResourceLocatorApplyConfiguration) WithPattern(value string) *RegexResourceLocatorApplyConfiguration { + b.Pattern = &value + return b +} + +// WithReplacement sets the Replacement field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replacement field is set to the value of the last call. +func (b *RegexResourceLocatorApplyConfiguration) WithReplacement(value string) *RegexResourceLocatorApplyConfiguration { + b.Replacement = &value + return b +} diff --git a/sdk/applyconfiguration/syncagent/v1alpha1/relatedresourcereference.go b/sdk/applyconfiguration/syncagent/v1alpha1/relatedresourcereference.go new file mode 100644 index 0000000..ebdcb0c --- /dev/null +++ b/sdk/applyconfiguration/syncagent/v1alpha1/relatedresourcereference.go @@ -0,0 +1,48 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// RelatedResourceReferenceApplyConfiguration represents a declarative configuration of the RelatedResourceReference type for use +// with apply. +type RelatedResourceReferenceApplyConfiguration struct { + Name *ResourceLocatorApplyConfiguration `json:"name,omitempty"` + Namespace *ResourceLocatorApplyConfiguration `json:"namespace,omitempty"` +} + +// RelatedResourceReferenceApplyConfiguration constructs a declarative configuration of the RelatedResourceReference type for use with +// apply. +func RelatedResourceReference() *RelatedResourceReferenceApplyConfiguration { + return &RelatedResourceReferenceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RelatedResourceReferenceApplyConfiguration) WithName(value *ResourceLocatorApplyConfiguration) *RelatedResourceReferenceApplyConfiguration { + b.Name = value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *RelatedResourceReferenceApplyConfiguration) WithNamespace(value *ResourceLocatorApplyConfiguration) *RelatedResourceReferenceApplyConfiguration { + b.Namespace = value + return b +} diff --git a/sdk/applyconfiguration/syncagent/v1alpha1/relatedresourcespec.go b/sdk/applyconfiguration/syncagent/v1alpha1/relatedresourcespec.go new file mode 100644 index 0000000..3eb9eb8 --- /dev/null +++ b/sdk/applyconfiguration/syncagent/v1alpha1/relatedresourcespec.go @@ -0,0 +1,66 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// RelatedResourceSpecApplyConfiguration represents a declarative configuration of the RelatedResourceSpec type for use +// with apply. +type RelatedResourceSpecApplyConfiguration struct { + Identifier *string `json:"identifier,omitempty"` + Origin *string `json:"origin,omitempty"` + Kind *string `json:"kind,omitempty"` + Reference *RelatedResourceReferenceApplyConfiguration `json:"reference,omitempty"` +} + +// RelatedResourceSpecApplyConfiguration constructs a declarative configuration of the RelatedResourceSpec type for use with +// apply. +func RelatedResourceSpec() *RelatedResourceSpecApplyConfiguration { + return &RelatedResourceSpecApplyConfiguration{} +} + +// WithIdentifier sets the Identifier field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Identifier field is set to the value of the last call. +func (b *RelatedResourceSpecApplyConfiguration) WithIdentifier(value string) *RelatedResourceSpecApplyConfiguration { + b.Identifier = &value + return b +} + +// WithOrigin sets the Origin field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Origin field is set to the value of the last call. +func (b *RelatedResourceSpecApplyConfiguration) WithOrigin(value string) *RelatedResourceSpecApplyConfiguration { + b.Origin = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RelatedResourceSpecApplyConfiguration) WithKind(value string) *RelatedResourceSpecApplyConfiguration { + b.Kind = &value + return b +} + +// WithReference sets the Reference field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reference field is set to the value of the last call. +func (b *RelatedResourceSpecApplyConfiguration) WithReference(value *RelatedResourceReferenceApplyConfiguration) *RelatedResourceSpecApplyConfiguration { + b.Reference = value + return b +} diff --git a/sdk/applyconfiguration/syncagent/v1alpha1/resourcefilter.go b/sdk/applyconfiguration/syncagent/v1alpha1/resourcefilter.go new file mode 100644 index 0000000..5636de8 --- /dev/null +++ b/sdk/applyconfiguration/syncagent/v1alpha1/resourcefilter.go @@ -0,0 +1,52 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceFilterApplyConfiguration represents a declarative configuration of the ResourceFilter type for use +// with apply. +type ResourceFilterApplyConfiguration struct { + Namespace *v1.LabelSelectorApplyConfiguration `json:"namespace,omitempty"` + Resource *v1.LabelSelectorApplyConfiguration `json:"resource,omitempty"` +} + +// ResourceFilterApplyConfiguration constructs a declarative configuration of the ResourceFilter type for use with +// apply. +func ResourceFilter() *ResourceFilterApplyConfiguration { + return &ResourceFilterApplyConfiguration{} +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceFilterApplyConfiguration) WithNamespace(value *v1.LabelSelectorApplyConfiguration) *ResourceFilterApplyConfiguration { + b.Namespace = value + return b +} + +// WithResource sets the Resource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resource field is set to the value of the last call. +func (b *ResourceFilterApplyConfiguration) WithResource(value *v1.LabelSelectorApplyConfiguration) *ResourceFilterApplyConfiguration { + b.Resource = value + return b +} diff --git a/sdk/applyconfiguration/syncagent/v1alpha1/resourcelocator.go b/sdk/applyconfiguration/syncagent/v1alpha1/resourcelocator.go new file mode 100644 index 0000000..61e9ce4 --- /dev/null +++ b/sdk/applyconfiguration/syncagent/v1alpha1/resourcelocator.go @@ -0,0 +1,48 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ResourceLocatorApplyConfiguration represents a declarative configuration of the ResourceLocator type for use +// with apply. +type ResourceLocatorApplyConfiguration struct { + Path *string `json:"path,omitempty"` + Regex *RegexResourceLocatorApplyConfiguration `json:"regex,omitempty"` +} + +// ResourceLocatorApplyConfiguration constructs a declarative configuration of the ResourceLocator type for use with +// apply. +func ResourceLocator() *ResourceLocatorApplyConfiguration { + return &ResourceLocatorApplyConfiguration{} +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *ResourceLocatorApplyConfiguration) WithPath(value string) *ResourceLocatorApplyConfiguration { + b.Path = &value + return b +} + +// WithRegex sets the Regex field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Regex field is set to the value of the last call. +func (b *ResourceLocatorApplyConfiguration) WithRegex(value *RegexResourceLocatorApplyConfiguration) *ResourceLocatorApplyConfiguration { + b.Regex = value + return b +} diff --git a/sdk/applyconfiguration/syncagent/v1alpha1/resourcenaming.go b/sdk/applyconfiguration/syncagent/v1alpha1/resourcenaming.go new file mode 100644 index 0000000..6f1ffa7 --- /dev/null +++ b/sdk/applyconfiguration/syncagent/v1alpha1/resourcenaming.go @@ -0,0 +1,48 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ResourceNamingApplyConfiguration represents a declarative configuration of the ResourceNaming type for use +// with apply. +type ResourceNamingApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` +} + +// ResourceNamingApplyConfiguration constructs a declarative configuration of the ResourceNaming type for use with +// apply. +func ResourceNaming() *ResourceNamingApplyConfiguration { + return &ResourceNamingApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceNamingApplyConfiguration) WithName(value string) *ResourceNamingApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceNamingApplyConfiguration) WithNamespace(value string) *ResourceNamingApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/sdk/applyconfiguration/syncagent/v1alpha1/resourceprojection.go b/sdk/applyconfiguration/syncagent/v1alpha1/resourceprojection.go new file mode 100644 index 0000000..e46567b --- /dev/null +++ b/sdk/applyconfiguration/syncagent/v1alpha1/resourceprojection.go @@ -0,0 +1,92 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" +) + +// ResourceProjectionApplyConfiguration represents a declarative configuration of the ResourceProjection type for use +// with apply. +type ResourceProjectionApplyConfiguration struct { + Version *string `json:"version,omitempty"` + Scope *v1alpha1.ResourceScope `json:"scope,omitempty"` + Kind *string `json:"kind,omitempty"` + Plural *string `json:"plural,omitempty"` + ShortNames []string `json:"shortNames,omitempty"` + Categories []string `json:"categories,omitempty"` +} + +// ResourceProjectionApplyConfiguration constructs a declarative configuration of the ResourceProjection type for use with +// apply. +func ResourceProjection() *ResourceProjectionApplyConfiguration { + return &ResourceProjectionApplyConfiguration{} +} + +// WithVersion sets the Version field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Version field is set to the value of the last call. +func (b *ResourceProjectionApplyConfiguration) WithVersion(value string) *ResourceProjectionApplyConfiguration { + b.Version = &value + return b +} + +// WithScope sets the Scope field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scope field is set to the value of the last call. +func (b *ResourceProjectionApplyConfiguration) WithScope(value v1alpha1.ResourceScope) *ResourceProjectionApplyConfiguration { + b.Scope = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ResourceProjectionApplyConfiguration) WithKind(value string) *ResourceProjectionApplyConfiguration { + b.Kind = &value + return b +} + +// WithPlural sets the Plural field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Plural field is set to the value of the last call. +func (b *ResourceProjectionApplyConfiguration) WithPlural(value string) *ResourceProjectionApplyConfiguration { + b.Plural = &value + return b +} + +// WithShortNames adds the given value to the ShortNames field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ShortNames field. +func (b *ResourceProjectionApplyConfiguration) WithShortNames(values ...string) *ResourceProjectionApplyConfiguration { + for i := range values { + b.ShortNames = append(b.ShortNames, values[i]) + } + return b +} + +// WithCategories adds the given value to the Categories field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Categories field. +func (b *ResourceProjectionApplyConfiguration) WithCategories(values ...string) *ResourceProjectionApplyConfiguration { + for i := range values { + b.Categories = append(b.Categories, values[i]) + } + return b +} diff --git a/sdk/applyconfiguration/syncagent/v1alpha1/sourceresourcedescriptor.go b/sdk/applyconfiguration/syncagent/v1alpha1/sourceresourcedescriptor.go new file mode 100644 index 0000000..4b4f8e4 --- /dev/null +++ b/sdk/applyconfiguration/syncagent/v1alpha1/sourceresourcedescriptor.go @@ -0,0 +1,57 @@ +/* +Copyright 2025 The KCP Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// SourceResourceDescriptorApplyConfiguration represents a declarative configuration of the SourceResourceDescriptor type for use +// with apply. +type SourceResourceDescriptorApplyConfiguration struct { + APIGroup *string `json:"apiGroup,omitempty"` + Version *string `json:"version,omitempty"` + Kind *string `json:"kind,omitempty"` +} + +// SourceResourceDescriptorApplyConfiguration constructs a declarative configuration of the SourceResourceDescriptor type for use with +// apply. +func SourceResourceDescriptor() *SourceResourceDescriptorApplyConfiguration { + return &SourceResourceDescriptorApplyConfiguration{} +} + +// WithAPIGroup sets the APIGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIGroup field is set to the value of the last call. +func (b *SourceResourceDescriptorApplyConfiguration) WithAPIGroup(value string) *SourceResourceDescriptorApplyConfiguration { + b.APIGroup = &value + return b +} + +// WithVersion sets the Version field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Version field is set to the value of the last call. +func (b *SourceResourceDescriptorApplyConfiguration) WithVersion(value string) *SourceResourceDescriptorApplyConfiguration { + b.Version = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *SourceResourceDescriptorApplyConfiguration) WithKind(value string) *SourceResourceDescriptorApplyConfiguration { + b.Kind = &value + return b +} diff --git a/sdk/applyconfiguration/utils.go b/sdk/applyconfiguration/utils.go index ed3a0c6..57bd7a0 100644 --- a/sdk/applyconfiguration/utils.go +++ b/sdk/applyconfiguration/utils.go @@ -19,43 +19,43 @@ limitations under the License. package applyconfiguration import ( - v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" testing "k8s.io/client-go/testing" internal "github.com/kcp-dev/api-syncagent/sdk/applyconfiguration/internal" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/applyconfiguration/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/applyconfiguration/syncagent/v1alpha1" ) // ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no // apply configuration type exists for the given GroupVersionKind. func ForKind(kind schema.GroupVersionKind) interface{} { switch kind { - // Group=services.syncagent.kcp.io, Version=v1alpha1 + // Group=syncagent.kcp.io, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithKind("PublishedResource"): - return &servicesv1alpha1.PublishedResourceApplyConfiguration{} + return &syncagentv1alpha1.PublishedResourceApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("PublishedResourceSpec"): - return &servicesv1alpha1.PublishedResourceSpecApplyConfiguration{} + return &syncagentv1alpha1.PublishedResourceSpecApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("PublishedResourceStatus"): - return &servicesv1alpha1.PublishedResourceStatusApplyConfiguration{} + return &syncagentv1alpha1.PublishedResourceStatusApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("RegexResourceLocator"): - return &servicesv1alpha1.RegexResourceLocatorApplyConfiguration{} + return &syncagentv1alpha1.RegexResourceLocatorApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("RelatedResourceReference"): - return &servicesv1alpha1.RelatedResourceReferenceApplyConfiguration{} + return &syncagentv1alpha1.RelatedResourceReferenceApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("RelatedResourceSpec"): - return &servicesv1alpha1.RelatedResourceSpecApplyConfiguration{} + return &syncagentv1alpha1.RelatedResourceSpecApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("ResourceFilter"): - return &servicesv1alpha1.ResourceFilterApplyConfiguration{} + return &syncagentv1alpha1.ResourceFilterApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("ResourceLocator"): - return &servicesv1alpha1.ResourceLocatorApplyConfiguration{} + return &syncagentv1alpha1.ResourceLocatorApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("ResourceNaming"): - return &servicesv1alpha1.ResourceNamingApplyConfiguration{} + return &syncagentv1alpha1.ResourceNamingApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("ResourceProjection"): - return &servicesv1alpha1.ResourceProjectionApplyConfiguration{} + return &syncagentv1alpha1.ResourceProjectionApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("SourceResourceDescriptor"): - return &servicesv1alpha1.SourceResourceDescriptorApplyConfiguration{} + return &syncagentv1alpha1.SourceResourceDescriptorApplyConfiguration{} } return nil diff --git a/sdk/clientset/versioned/clientset.go b/sdk/clientset/versioned/clientset.go index 7698280..983f995 100644 --- a/sdk/clientset/versioned/clientset.go +++ b/sdk/clientset/versioned/clientset.go @@ -26,23 +26,23 @@ import ( rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/syncagent/v1alpha1" ) type Interface interface { Discovery() discovery.DiscoveryInterface - ServicesV1alpha1() servicesv1alpha1.ServicesV1alpha1Interface + SyncagentV1alpha1() syncagentv1alpha1.SyncagentV1alpha1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient - servicesV1alpha1 *servicesv1alpha1.ServicesV1alpha1Client + syncagentV1alpha1 *syncagentv1alpha1.SyncagentV1alpha1Client } -// ServicesV1alpha1 retrieves the ServicesV1alpha1Client -func (c *Clientset) ServicesV1alpha1() servicesv1alpha1.ServicesV1alpha1Interface { - return c.servicesV1alpha1 +// SyncagentV1alpha1 retrieves the SyncagentV1alpha1Client +func (c *Clientset) SyncagentV1alpha1() syncagentv1alpha1.SyncagentV1alpha1Interface { + return c.syncagentV1alpha1 } // Discovery retrieves the DiscoveryClient @@ -89,7 +89,7 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error - cs.servicesV1alpha1, err = servicesv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.syncagentV1alpha1, err = syncagentv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -114,7 +114,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.servicesV1alpha1 = servicesv1alpha1.New(c) + cs.syncagentV1alpha1 = syncagentv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/sdk/clientset/versioned/cluster/clientset.go b/sdk/clientset/versioned/cluster/clientset.go index db1470c..f5b720e 100644 --- a/sdk/clientset/versioned/cluster/clientset.go +++ b/sdk/clientset/versioned/cluster/clientset.go @@ -33,20 +33,20 @@ import ( "k8s.io/client-go/util/flowcontrol" client "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/cluster/typed/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1" ) type ClusterInterface interface { Cluster(logicalcluster.Path) client.Interface Discovery() discovery.DiscoveryInterface - ServicesV1alpha1() servicesv1alpha1.ServicesV1alpha1ClusterInterface + SyncagentV1alpha1() syncagentv1alpha1.SyncagentV1alpha1ClusterInterface } // ClusterClientset contains the clients for groups. type ClusterClientset struct { *discovery.DiscoveryClient - clientCache kcpclient.Cache[*client.Clientset] - servicesV1alpha1 *servicesv1alpha1.ServicesV1alpha1ClusterClient + clientCache kcpclient.Cache[*client.Clientset] + syncagentV1alpha1 *syncagentv1alpha1.SyncagentV1alpha1ClusterClient } // Discovery retrieves the DiscoveryClient @@ -57,9 +57,9 @@ func (c *ClusterClientset) Discovery() discovery.DiscoveryInterface { return c.DiscoveryClient } -// ServicesV1alpha1 retrieves the ServicesV1alpha1ClusterClient. -func (c *ClusterClientset) ServicesV1alpha1() servicesv1alpha1.ServicesV1alpha1ClusterInterface { - return c.servicesV1alpha1 +// SyncagentV1alpha1 retrieves the SyncagentV1alpha1ClusterClient. +func (c *ClusterClientset) SyncagentV1alpha1() syncagentv1alpha1.SyncagentV1alpha1ClusterInterface { + return c.syncagentV1alpha1 } // Cluster scopes this clientset to one cluster. @@ -114,7 +114,7 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*ClusterCli var cs ClusterClientset cs.clientCache = cache var err error - cs.servicesV1alpha1, err = servicesv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.syncagentV1alpha1, err = syncagentv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } diff --git a/sdk/clientset/versioned/cluster/fake/clientset.go b/sdk/clientset/versioned/cluster/fake/clientset.go index 88aad7c..8b251bb 100644 --- a/sdk/clientset/versioned/cluster/fake/clientset.go +++ b/sdk/clientset/versioned/cluster/fake/clientset.go @@ -31,10 +31,10 @@ import ( client "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned" kcpclient "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/cluster" - kcpservicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/cluster/typed/services/v1alpha1" - fakeservicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/cluster/typed/services/v1alpha1/fake" + kcpsyncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1" + fakesyncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/fake" clientscheme "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/scheme" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/syncagent/v1alpha1" ) // NewSimpleClientset returns a clientset that will respond with the provided objects. @@ -71,9 +71,9 @@ func (c *ClusterClientset) Tracker() kcptesting.ObjectTracker { return c.tracker } -// ServicesV1alpha1 retrieves the ServicesV1alpha1ClusterClient. -func (c *ClusterClientset) ServicesV1alpha1() kcpservicesv1alpha1.ServicesV1alpha1ClusterInterface { - return &fakeservicesv1alpha1.ServicesV1alpha1ClusterClient{Fake: c.Fake} +// SyncagentV1alpha1 retrieves the SyncagentV1alpha1ClusterClient. +func (c *ClusterClientset) SyncagentV1alpha1() kcpsyncagentv1alpha1.SyncagentV1alpha1ClusterInterface { + return &fakesyncagentv1alpha1.SyncagentV1alpha1ClusterClient{Fake: c.Fake} } // Cluster scopes this clientset to one cluster. @@ -108,7 +108,7 @@ func (c *Clientset) Tracker() kcptesting.ScopedObjectTracker { return c.tracker } -// ServicesV1alpha1 retrieves the ServicesV1alpha1Client. -func (c *Clientset) ServicesV1alpha1() servicesv1alpha1.ServicesV1alpha1Interface { - return &fakeservicesv1alpha1.ServicesV1alpha1Client{Fake: c.Fake, ClusterPath: c.clusterPath} +// SyncagentV1alpha1 retrieves the SyncagentV1alpha1Client. +func (c *Clientset) SyncagentV1alpha1() syncagentv1alpha1.SyncagentV1alpha1Interface { + return &fakesyncagentv1alpha1.SyncagentV1alpha1Client{Fake: c.Fake, ClusterPath: c.clusterPath} } diff --git a/sdk/clientset/versioned/cluster/scheme/register.go b/sdk/clientset/versioned/cluster/scheme/register.go index 7a6dad8..d3a939f 100644 --- a/sdk/clientset/versioned/cluster/scheme/register.go +++ b/sdk/clientset/versioned/cluster/scheme/register.go @@ -22,7 +22,7 @@ limitations under the License. package scheme import ( - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -35,7 +35,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - servicesv1alpha1.AddToScheme, + syncagentv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/sdk/clientset/versioned/cluster/typed/services/v1alpha1/fake/publishedresource.go b/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/fake/publishedresource.go similarity index 64% rename from sdk/clientset/versioned/cluster/typed/services/v1alpha1/fake/publishedresource.go rename to sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/fake/publishedresource.go index 9396ae5..ab83851 100644 --- a/sdk/clientset/versioned/cluster/typed/services/v1alpha1/fake/publishedresource.go +++ b/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/fake/publishedresource.go @@ -26,8 +26,8 @@ import ( "encoding/json" "fmt" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" - applyconfigurationsservicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/applyconfiguration/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" + applyconfigurationssyncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/applyconfiguration/syncagent/v1alpha1" "github.com/kcp-dev/logicalcluster/v3" kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" @@ -38,18 +38,18 @@ import ( "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/testing" - servicesv1alpha1client "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/services/v1alpha1" + syncagentv1alpha1client "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/syncagent/v1alpha1" ) -var publishedResourcesResource = schema.GroupVersionResource{Group: "services.syncagent.kcp.io", Version: "v1alpha1", Resource: "publishedresources"} -var publishedResourcesKind = schema.GroupVersionKind{Group: "services.syncagent.kcp.io", Version: "v1alpha1", Kind: "PublishedResource"} +var publishedResourcesResource = schema.GroupVersionResource{Group: "syncagent.kcp.io", Version: "v1alpha1", Resource: "publishedresources"} +var publishedResourcesKind = schema.GroupVersionKind{Group: "syncagent.kcp.io", Version: "v1alpha1", Kind: "PublishedResource"} type publishedResourcesClusterClient struct { *kcptesting.Fake } // Cluster scopes the client down to a particular cluster. -func (c *publishedResourcesClusterClient) Cluster(clusterPath logicalcluster.Path) servicesv1alpha1client.PublishedResourceInterface { +func (c *publishedResourcesClusterClient) Cluster(clusterPath logicalcluster.Path) syncagentv1alpha1client.PublishedResourceInterface { if clusterPath == logicalcluster.Wildcard { panic("A specific cluster must be provided when scoping, not the wildcard.") } @@ -58,8 +58,8 @@ func (c *publishedResourcesClusterClient) Cluster(clusterPath logicalcluster.Pat } // List takes label and field selectors, and returns the list of PublishedResources that match those selectors across all clusters. -func (c *publishedResourcesClusterClient) List(ctx context.Context, opts metav1.ListOptions) (*servicesv1alpha1.PublishedResourceList, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootListAction(publishedResourcesResource, publishedResourcesKind, logicalcluster.Wildcard, opts), &servicesv1alpha1.PublishedResourceList{}) +func (c *publishedResourcesClusterClient) List(ctx context.Context, opts metav1.ListOptions) (*syncagentv1alpha1.PublishedResourceList, error) { + obj, err := c.Fake.Invokes(kcptesting.NewRootListAction(publishedResourcesResource, publishedResourcesKind, logicalcluster.Wildcard, opts), &syncagentv1alpha1.PublishedResourceList{}) if obj == nil { return nil, err } @@ -68,8 +68,8 @@ func (c *publishedResourcesClusterClient) List(ctx context.Context, opts metav1. if label == nil { label = labels.Everything() } - list := &servicesv1alpha1.PublishedResourceList{ListMeta: obj.(*servicesv1alpha1.PublishedResourceList).ListMeta} - for _, item := range obj.(*servicesv1alpha1.PublishedResourceList).Items { + list := &syncagentv1alpha1.PublishedResourceList{ListMeta: obj.(*syncagentv1alpha1.PublishedResourceList).ListMeta} + for _, item := range obj.(*syncagentv1alpha1.PublishedResourceList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -87,53 +87,53 @@ type publishedResourcesClient struct { ClusterPath logicalcluster.Path } -func (c *publishedResourcesClient) Create(ctx context.Context, publishedResource *servicesv1alpha1.PublishedResource, opts metav1.CreateOptions) (*servicesv1alpha1.PublishedResource, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootCreateAction(publishedResourcesResource, c.ClusterPath, publishedResource), &servicesv1alpha1.PublishedResource{}) +func (c *publishedResourcesClient) Create(ctx context.Context, publishedResource *syncagentv1alpha1.PublishedResource, opts metav1.CreateOptions) (*syncagentv1alpha1.PublishedResource, error) { + obj, err := c.Fake.Invokes(kcptesting.NewRootCreateAction(publishedResourcesResource, c.ClusterPath, publishedResource), &syncagentv1alpha1.PublishedResource{}) if obj == nil { return nil, err } - return obj.(*servicesv1alpha1.PublishedResource), err + return obj.(*syncagentv1alpha1.PublishedResource), err } -func (c *publishedResourcesClient) Update(ctx context.Context, publishedResource *servicesv1alpha1.PublishedResource, opts metav1.UpdateOptions) (*servicesv1alpha1.PublishedResource, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootUpdateAction(publishedResourcesResource, c.ClusterPath, publishedResource), &servicesv1alpha1.PublishedResource{}) +func (c *publishedResourcesClient) Update(ctx context.Context, publishedResource *syncagentv1alpha1.PublishedResource, opts metav1.UpdateOptions) (*syncagentv1alpha1.PublishedResource, error) { + obj, err := c.Fake.Invokes(kcptesting.NewRootUpdateAction(publishedResourcesResource, c.ClusterPath, publishedResource), &syncagentv1alpha1.PublishedResource{}) if obj == nil { return nil, err } - return obj.(*servicesv1alpha1.PublishedResource), err + return obj.(*syncagentv1alpha1.PublishedResource), err } -func (c *publishedResourcesClient) UpdateStatus(ctx context.Context, publishedResource *servicesv1alpha1.PublishedResource, opts metav1.UpdateOptions) (*servicesv1alpha1.PublishedResource, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootUpdateSubresourceAction(publishedResourcesResource, c.ClusterPath, "status", publishedResource), &servicesv1alpha1.PublishedResource{}) +func (c *publishedResourcesClient) UpdateStatus(ctx context.Context, publishedResource *syncagentv1alpha1.PublishedResource, opts metav1.UpdateOptions) (*syncagentv1alpha1.PublishedResource, error) { + obj, err := c.Fake.Invokes(kcptesting.NewRootUpdateSubresourceAction(publishedResourcesResource, c.ClusterPath, "status", publishedResource), &syncagentv1alpha1.PublishedResource{}) if obj == nil { return nil, err } - return obj.(*servicesv1alpha1.PublishedResource), err + return obj.(*syncagentv1alpha1.PublishedResource), err } func (c *publishedResourcesClient) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake.Invokes(kcptesting.NewRootDeleteActionWithOptions(publishedResourcesResource, c.ClusterPath, name, opts), &servicesv1alpha1.PublishedResource{}) + _, err := c.Fake.Invokes(kcptesting.NewRootDeleteActionWithOptions(publishedResourcesResource, c.ClusterPath, name, opts), &syncagentv1alpha1.PublishedResource{}) return err } func (c *publishedResourcesClient) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { action := kcptesting.NewRootDeleteCollectionAction(publishedResourcesResource, c.ClusterPath, listOpts) - _, err := c.Fake.Invokes(action, &servicesv1alpha1.PublishedResourceList{}) + _, err := c.Fake.Invokes(action, &syncagentv1alpha1.PublishedResourceList{}) return err } -func (c *publishedResourcesClient) Get(ctx context.Context, name string, options metav1.GetOptions) (*servicesv1alpha1.PublishedResource, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootGetAction(publishedResourcesResource, c.ClusterPath, name), &servicesv1alpha1.PublishedResource{}) +func (c *publishedResourcesClient) Get(ctx context.Context, name string, options metav1.GetOptions) (*syncagentv1alpha1.PublishedResource, error) { + obj, err := c.Fake.Invokes(kcptesting.NewRootGetAction(publishedResourcesResource, c.ClusterPath, name), &syncagentv1alpha1.PublishedResource{}) if obj == nil { return nil, err } - return obj.(*servicesv1alpha1.PublishedResource), err + return obj.(*syncagentv1alpha1.PublishedResource), err } // List takes label and field selectors, and returns the list of PublishedResources that match those selectors. -func (c *publishedResourcesClient) List(ctx context.Context, opts metav1.ListOptions) (*servicesv1alpha1.PublishedResourceList, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootListAction(publishedResourcesResource, publishedResourcesKind, c.ClusterPath, opts), &servicesv1alpha1.PublishedResourceList{}) +func (c *publishedResourcesClient) List(ctx context.Context, opts metav1.ListOptions) (*syncagentv1alpha1.PublishedResourceList, error) { + obj, err := c.Fake.Invokes(kcptesting.NewRootListAction(publishedResourcesResource, publishedResourcesKind, c.ClusterPath, opts), &syncagentv1alpha1.PublishedResourceList{}) if obj == nil { return nil, err } @@ -142,8 +142,8 @@ func (c *publishedResourcesClient) List(ctx context.Context, opts metav1.ListOpt if label == nil { label = labels.Everything() } - list := &servicesv1alpha1.PublishedResourceList{ListMeta: obj.(*servicesv1alpha1.PublishedResourceList).ListMeta} - for _, item := range obj.(*servicesv1alpha1.PublishedResourceList).Items { + list := &syncagentv1alpha1.PublishedResourceList{ListMeta: obj.(*syncagentv1alpha1.PublishedResourceList).ListMeta} + for _, item := range obj.(*syncagentv1alpha1.PublishedResourceList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -155,15 +155,15 @@ func (c *publishedResourcesClient) Watch(ctx context.Context, opts metav1.ListOp return c.Fake.InvokesWatch(kcptesting.NewRootWatchAction(publishedResourcesResource, c.ClusterPath, opts)) } -func (c *publishedResourcesClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*servicesv1alpha1.PublishedResource, error) { - obj, err := c.Fake.Invokes(kcptesting.NewRootPatchSubresourceAction(publishedResourcesResource, c.ClusterPath, name, pt, data, subresources...), &servicesv1alpha1.PublishedResource{}) +func (c *publishedResourcesClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*syncagentv1alpha1.PublishedResource, error) { + obj, err := c.Fake.Invokes(kcptesting.NewRootPatchSubresourceAction(publishedResourcesResource, c.ClusterPath, name, pt, data, subresources...), &syncagentv1alpha1.PublishedResource{}) if obj == nil { return nil, err } - return obj.(*servicesv1alpha1.PublishedResource), err + return obj.(*syncagentv1alpha1.PublishedResource), err } -func (c *publishedResourcesClient) Apply(ctx context.Context, applyConfiguration *applyconfigurationsservicesv1alpha1.PublishedResourceApplyConfiguration, opts metav1.ApplyOptions) (*servicesv1alpha1.PublishedResource, error) { +func (c *publishedResourcesClient) Apply(ctx context.Context, applyConfiguration *applyconfigurationssyncagentv1alpha1.PublishedResourceApplyConfiguration, opts metav1.ApplyOptions) (*syncagentv1alpha1.PublishedResource, error) { if applyConfiguration == nil { return nil, fmt.Errorf("applyConfiguration provided to Apply must not be nil") } @@ -175,14 +175,14 @@ func (c *publishedResourcesClient) Apply(ctx context.Context, applyConfiguration if name == nil { return nil, fmt.Errorf("applyConfiguration.Name must be provided to Apply") } - obj, err := c.Fake.Invokes(kcptesting.NewRootPatchSubresourceAction(publishedResourcesResource, c.ClusterPath, *name, types.ApplyPatchType, data), &servicesv1alpha1.PublishedResource{}) + obj, err := c.Fake.Invokes(kcptesting.NewRootPatchSubresourceAction(publishedResourcesResource, c.ClusterPath, *name, types.ApplyPatchType, data), &syncagentv1alpha1.PublishedResource{}) if obj == nil { return nil, err } - return obj.(*servicesv1alpha1.PublishedResource), err + return obj.(*syncagentv1alpha1.PublishedResource), err } -func (c *publishedResourcesClient) ApplyStatus(ctx context.Context, applyConfiguration *applyconfigurationsservicesv1alpha1.PublishedResourceApplyConfiguration, opts metav1.ApplyOptions) (*servicesv1alpha1.PublishedResource, error) { +func (c *publishedResourcesClient) ApplyStatus(ctx context.Context, applyConfiguration *applyconfigurationssyncagentv1alpha1.PublishedResourceApplyConfiguration, opts metav1.ApplyOptions) (*syncagentv1alpha1.PublishedResource, error) { if applyConfiguration == nil { return nil, fmt.Errorf("applyConfiguration provided to Apply must not be nil") } @@ -194,9 +194,9 @@ func (c *publishedResourcesClient) ApplyStatus(ctx context.Context, applyConfigu if name == nil { return nil, fmt.Errorf("applyConfiguration.Name must be provided to Apply") } - obj, err := c.Fake.Invokes(kcptesting.NewRootPatchSubresourceAction(publishedResourcesResource, c.ClusterPath, *name, types.ApplyPatchType, data, "status"), &servicesv1alpha1.PublishedResource{}) + obj, err := c.Fake.Invokes(kcptesting.NewRootPatchSubresourceAction(publishedResourcesResource, c.ClusterPath, *name, types.ApplyPatchType, data, "status"), &syncagentv1alpha1.PublishedResource{}) if obj == nil { return nil, err } - return obj.(*servicesv1alpha1.PublishedResource), err + return obj.(*syncagentv1alpha1.PublishedResource), err } diff --git a/sdk/clientset/versioned/cluster/typed/services/v1alpha1/fake/services_client.go b/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/fake/syncagent_client.go similarity index 55% rename from sdk/clientset/versioned/cluster/typed/services/v1alpha1/fake/services_client.go rename to sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/fake/syncagent_client.go index 5e7d513..04dcf90 100644 --- a/sdk/clientset/versioned/cluster/typed/services/v1alpha1/fake/services_client.go +++ b/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/fake/syncagent_client.go @@ -27,39 +27,39 @@ import ( kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" "k8s.io/client-go/rest" - kcpservicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/cluster/typed/services/v1alpha1" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/services/v1alpha1" + kcpsyncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/syncagent/v1alpha1" ) -var _ kcpservicesv1alpha1.ServicesV1alpha1ClusterInterface = (*ServicesV1alpha1ClusterClient)(nil) +var _ kcpsyncagentv1alpha1.SyncagentV1alpha1ClusterInterface = (*SyncagentV1alpha1ClusterClient)(nil) -type ServicesV1alpha1ClusterClient struct { +type SyncagentV1alpha1ClusterClient struct { *kcptesting.Fake } -func (c *ServicesV1alpha1ClusterClient) Cluster(clusterPath logicalcluster.Path) servicesv1alpha1.ServicesV1alpha1Interface { +func (c *SyncagentV1alpha1ClusterClient) Cluster(clusterPath logicalcluster.Path) syncagentv1alpha1.SyncagentV1alpha1Interface { if clusterPath == logicalcluster.Wildcard { panic("A specific cluster must be provided when scoping, not the wildcard.") } - return &ServicesV1alpha1Client{Fake: c.Fake, ClusterPath: clusterPath} + return &SyncagentV1alpha1Client{Fake: c.Fake, ClusterPath: clusterPath} } -func (c *ServicesV1alpha1ClusterClient) PublishedResources() kcpservicesv1alpha1.PublishedResourceClusterInterface { +func (c *SyncagentV1alpha1ClusterClient) PublishedResources() kcpsyncagentv1alpha1.PublishedResourceClusterInterface { return &publishedResourcesClusterClient{Fake: c.Fake} } -var _ servicesv1alpha1.ServicesV1alpha1Interface = (*ServicesV1alpha1Client)(nil) +var _ syncagentv1alpha1.SyncagentV1alpha1Interface = (*SyncagentV1alpha1Client)(nil) -type ServicesV1alpha1Client struct { +type SyncagentV1alpha1Client struct { *kcptesting.Fake ClusterPath logicalcluster.Path } -func (c *ServicesV1alpha1Client) RESTClient() rest.Interface { +func (c *SyncagentV1alpha1Client) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } -func (c *ServicesV1alpha1Client) PublishedResources() servicesv1alpha1.PublishedResourceInterface { +func (c *SyncagentV1alpha1Client) PublishedResources() syncagentv1alpha1.PublishedResourceInterface { return &publishedResourcesClient{Fake: c.Fake, ClusterPath: c.ClusterPath} } diff --git a/sdk/clientset/versioned/cluster/typed/services/v1alpha1/publishedresource.go b/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/publishedresource.go similarity index 76% rename from sdk/clientset/versioned/cluster/typed/services/v1alpha1/publishedresource.go rename to sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/publishedresource.go index ca044fc..d62c95e 100644 --- a/sdk/clientset/versioned/cluster/typed/services/v1alpha1/publishedresource.go +++ b/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/publishedresource.go @@ -24,14 +24,14 @@ package v1alpha1 import ( "context" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" "github.com/kcp-dev/logicalcluster/v3" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/watch" - servicesv1alpha1client "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/services/v1alpha1" + syncagentv1alpha1client "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/syncagent/v1alpha1" ) // PublishedResourcesClusterGetter has a method to return a PublishedResourceClusterInterface. @@ -41,19 +41,19 @@ type PublishedResourcesClusterGetter interface { } // PublishedResourceClusterInterface can operate on PublishedResources across all clusters, -// or scope down to one cluster and return a servicesv1alpha1client.PublishedResourceInterface. +// or scope down to one cluster and return a syncagentv1alpha1client.PublishedResourceInterface. type PublishedResourceClusterInterface interface { - Cluster(logicalcluster.Path) servicesv1alpha1client.PublishedResourceInterface - List(ctx context.Context, opts metav1.ListOptions) (*servicesv1alpha1.PublishedResourceList, error) + Cluster(logicalcluster.Path) syncagentv1alpha1client.PublishedResourceInterface + List(ctx context.Context, opts metav1.ListOptions) (*syncagentv1alpha1.PublishedResourceList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) } type publishedResourcesClusterInterface struct { - clientCache kcpclient.Cache[*servicesv1alpha1client.ServicesV1alpha1Client] + clientCache kcpclient.Cache[*syncagentv1alpha1client.SyncagentV1alpha1Client] } // Cluster scopes the client down to a particular cluster. -func (c *publishedResourcesClusterInterface) Cluster(clusterPath logicalcluster.Path) servicesv1alpha1client.PublishedResourceInterface { +func (c *publishedResourcesClusterInterface) Cluster(clusterPath logicalcluster.Path) syncagentv1alpha1client.PublishedResourceInterface { if clusterPath == logicalcluster.Wildcard { panic("A specific cluster must be provided when scoping, not the wildcard.") } @@ -62,7 +62,7 @@ func (c *publishedResourcesClusterInterface) Cluster(clusterPath logicalcluster. } // List returns the entire collection of all PublishedResources across all clusters. -func (c *publishedResourcesClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*servicesv1alpha1.PublishedResourceList, error) { +func (c *publishedResourcesClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*syncagentv1alpha1.PublishedResourceList, error) { return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).PublishedResources().List(ctx, opts) } diff --git a/sdk/clientset/versioned/cluster/typed/services/v1alpha1/services_client.go b/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/syncagent_client.go similarity index 54% rename from sdk/clientset/versioned/cluster/typed/services/v1alpha1/services_client.go rename to sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/syncagent_client.go index 90a0f26..d63118c 100644 --- a/sdk/clientset/versioned/cluster/typed/services/v1alpha1/services_client.go +++ b/sdk/clientset/versioned/cluster/typed/syncagent/v1alpha1/syncagent_client.go @@ -29,37 +29,37 @@ import ( "k8s.io/client-go/rest" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/syncagent/v1alpha1" ) -type ServicesV1alpha1ClusterInterface interface { - ServicesV1alpha1ClusterScoper +type SyncagentV1alpha1ClusterInterface interface { + SyncagentV1alpha1ClusterScoper PublishedResourcesClusterGetter } -type ServicesV1alpha1ClusterScoper interface { - Cluster(logicalcluster.Path) servicesv1alpha1.ServicesV1alpha1Interface +type SyncagentV1alpha1ClusterScoper interface { + Cluster(logicalcluster.Path) syncagentv1alpha1.SyncagentV1alpha1Interface } -type ServicesV1alpha1ClusterClient struct { - clientCache kcpclient.Cache[*servicesv1alpha1.ServicesV1alpha1Client] +type SyncagentV1alpha1ClusterClient struct { + clientCache kcpclient.Cache[*syncagentv1alpha1.SyncagentV1alpha1Client] } -func (c *ServicesV1alpha1ClusterClient) Cluster(clusterPath logicalcluster.Path) servicesv1alpha1.ServicesV1alpha1Interface { +func (c *SyncagentV1alpha1ClusterClient) Cluster(clusterPath logicalcluster.Path) syncagentv1alpha1.SyncagentV1alpha1Interface { if clusterPath == logicalcluster.Wildcard { panic("A specific cluster must be provided when scoping, not the wildcard.") } return c.clientCache.ClusterOrDie(clusterPath) } -func (c *ServicesV1alpha1ClusterClient) PublishedResources() PublishedResourceClusterInterface { +func (c *SyncagentV1alpha1ClusterClient) PublishedResources() PublishedResourceClusterInterface { return &publishedResourcesClusterInterface{clientCache: c.clientCache} } -// NewForConfig creates a new ServicesV1alpha1ClusterClient for the given config. +// NewForConfig creates a new SyncagentV1alpha1ClusterClient for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*ServicesV1alpha1ClusterClient, error) { +func NewForConfig(c *rest.Config) (*SyncagentV1alpha1ClusterClient, error) { client, err := rest.HTTPClientFor(c) if err != nil { return nil, err @@ -67,21 +67,21 @@ func NewForConfig(c *rest.Config) (*ServicesV1alpha1ClusterClient, error) { return NewForConfigAndClient(c, client) } -// NewForConfigAndClient creates a new ServicesV1alpha1ClusterClient for the given config and http client. +// NewForConfigAndClient creates a new SyncagentV1alpha1ClusterClient for the given config and http client. // Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ServicesV1alpha1ClusterClient, error) { - cache := kcpclient.NewCache(c, h, &kcpclient.Constructor[*servicesv1alpha1.ServicesV1alpha1Client]{ - NewForConfigAndClient: servicesv1alpha1.NewForConfigAndClient, +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SyncagentV1alpha1ClusterClient, error) { + cache := kcpclient.NewCache(c, h, &kcpclient.Constructor[*syncagentv1alpha1.SyncagentV1alpha1Client]{ + NewForConfigAndClient: syncagentv1alpha1.NewForConfigAndClient, }) if _, err := cache.Cluster(logicalcluster.Name("root").Path()); err != nil { return nil, err } - return &ServicesV1alpha1ClusterClient{clientCache: cache}, nil + return &SyncagentV1alpha1ClusterClient{clientCache: cache}, nil } -// NewForConfigOrDie creates a new ServicesV1alpha1ClusterClient for the given config and +// NewForConfigOrDie creates a new SyncagentV1alpha1ClusterClient for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *ServicesV1alpha1ClusterClient { +func NewForConfigOrDie(c *rest.Config) *SyncagentV1alpha1ClusterClient { client, err := NewForConfig(c) if err != nil { panic(err) diff --git a/sdk/clientset/versioned/fake/clientset_generated.go b/sdk/clientset/versioned/fake/clientset_generated.go index 1049567..51eeffd 100644 --- a/sdk/clientset/versioned/fake/clientset_generated.go +++ b/sdk/clientset/versioned/fake/clientset_generated.go @@ -26,8 +26,8 @@ import ( "k8s.io/client-go/testing" clientset "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/services/v1alpha1" - fakeservicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/services/v1alpha1/fake" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/syncagent/v1alpha1" + fakesyncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/syncagent/v1alpha1/fake" ) // NewSimpleClientset returns a clientset that will respond with the provided objects. @@ -84,7 +84,7 @@ var ( _ testing.FakeClient = &Clientset{} ) -// ServicesV1alpha1 retrieves the ServicesV1alpha1Client -func (c *Clientset) ServicesV1alpha1() servicesv1alpha1.ServicesV1alpha1Interface { - return &fakeservicesv1alpha1.FakeServicesV1alpha1{Fake: &c.Fake} +// SyncagentV1alpha1 retrieves the SyncagentV1alpha1Client +func (c *Clientset) SyncagentV1alpha1() syncagentv1alpha1.SyncagentV1alpha1Interface { + return &fakesyncagentv1alpha1.FakeSyncagentV1alpha1{Fake: &c.Fake} } diff --git a/sdk/clientset/versioned/fake/register.go b/sdk/clientset/versioned/fake/register.go index 729ae14..5a62141 100644 --- a/sdk/clientset/versioned/fake/register.go +++ b/sdk/clientset/versioned/fake/register.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -32,7 +32,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - servicesv1alpha1.AddToScheme, + syncagentv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/sdk/clientset/versioned/scheme/register.go b/sdk/clientset/versioned/scheme/register.go index cb61558..d71cd86 100644 --- a/sdk/clientset/versioned/scheme/register.go +++ b/sdk/clientset/versioned/scheme/register.go @@ -19,7 +19,7 @@ limitations under the License. package scheme import ( - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -32,7 +32,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - servicesv1alpha1.AddToScheme, + syncagentv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/sdk/clientset/versioned/typed/services/v1alpha1/doc.go b/sdk/clientset/versioned/typed/syncagent/v1alpha1/doc.go similarity index 100% rename from sdk/clientset/versioned/typed/services/v1alpha1/doc.go rename to sdk/clientset/versioned/typed/syncagent/v1alpha1/doc.go diff --git a/sdk/clientset/versioned/typed/services/v1alpha1/fake/doc.go b/sdk/clientset/versioned/typed/syncagent/v1alpha1/fake/doc.go similarity index 100% rename from sdk/clientset/versioned/typed/services/v1alpha1/fake/doc.go rename to sdk/clientset/versioned/typed/syncagent/v1alpha1/fake/doc.go diff --git a/sdk/clientset/versioned/typed/services/v1alpha1/fake/fake_publishedresource.go b/sdk/clientset/versioned/typed/syncagent/v1alpha1/fake/fake_publishedresource.go similarity index 98% rename from sdk/clientset/versioned/typed/services/v1alpha1/fake/fake_publishedresource.go rename to sdk/clientset/versioned/typed/syncagent/v1alpha1/fake/fake_publishedresource.go index 95e3922..445cc1d 100644 --- a/sdk/clientset/versioned/typed/services/v1alpha1/fake/fake_publishedresource.go +++ b/sdk/clientset/versioned/typed/syncagent/v1alpha1/fake/fake_publishedresource.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" @@ -32,7 +32,7 @@ import ( // FakePublishedResources implements PublishedResourceInterface type FakePublishedResources struct { - Fake *FakeServicesV1alpha1 + Fake *FakeSyncagentV1alpha1 } var publishedresourcesResource = v1alpha1.SchemeGroupVersion.WithResource("publishedresources") diff --git a/sdk/clientset/versioned/typed/services/v1alpha1/fake/fake_services_client.go b/sdk/clientset/versioned/typed/syncagent/v1alpha1/fake/fake_syncagent_client.go similarity index 81% rename from sdk/clientset/versioned/typed/services/v1alpha1/fake/fake_services_client.go rename to sdk/clientset/versioned/typed/syncagent/v1alpha1/fake/fake_syncagent_client.go index 4781384..441399c 100644 --- a/sdk/clientset/versioned/typed/services/v1alpha1/fake/fake_services_client.go +++ b/sdk/clientset/versioned/typed/syncagent/v1alpha1/fake/fake_syncagent_client.go @@ -22,20 +22,20 @@ import ( rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" - v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/services/v1alpha1" + v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/typed/syncagent/v1alpha1" ) -type FakeServicesV1alpha1 struct { +type FakeSyncagentV1alpha1 struct { *testing.Fake } -func (c *FakeServicesV1alpha1) PublishedResources() v1alpha1.PublishedResourceInterface { +func (c *FakeSyncagentV1alpha1) PublishedResources() v1alpha1.PublishedResourceInterface { return &FakePublishedResources{c} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeServicesV1alpha1) RESTClient() rest.Interface { +func (c *FakeSyncagentV1alpha1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/sdk/clientset/versioned/typed/services/v1alpha1/generated_expansion.go b/sdk/clientset/versioned/typed/syncagent/v1alpha1/generated_expansion.go similarity index 100% rename from sdk/clientset/versioned/typed/services/v1alpha1/generated_expansion.go rename to sdk/clientset/versioned/typed/syncagent/v1alpha1/generated_expansion.go diff --git a/sdk/clientset/versioned/typed/services/v1alpha1/publishedresource.go b/sdk/clientset/versioned/typed/syncagent/v1alpha1/publishedresource.go similarity index 95% rename from sdk/clientset/versioned/typed/services/v1alpha1/publishedresource.go rename to sdk/clientset/versioned/typed/syncagent/v1alpha1/publishedresource.go index 4e39e64..11499d1 100644 --- a/sdk/clientset/versioned/typed/services/v1alpha1/publishedresource.go +++ b/sdk/clientset/versioned/typed/syncagent/v1alpha1/publishedresource.go @@ -21,7 +21,7 @@ package v1alpha1 import ( "context" - v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -58,7 +58,7 @@ type publishedResources struct { } // newPublishedResources returns a PublishedResources -func newPublishedResources(c *ServicesV1alpha1Client) *publishedResources { +func newPublishedResources(c *SyncagentV1alpha1Client) *publishedResources { return &publishedResources{ gentype.NewClientWithList[*v1alpha1.PublishedResource, *v1alpha1.PublishedResourceList]( "publishedresources", diff --git a/sdk/clientset/versioned/typed/services/v1alpha1/services_client.go b/sdk/clientset/versioned/typed/syncagent/v1alpha1/syncagent_client.go similarity index 65% rename from sdk/clientset/versioned/typed/services/v1alpha1/services_client.go rename to sdk/clientset/versioned/typed/syncagent/v1alpha1/syncagent_client.go index 404a0fc..c10a547 100644 --- a/sdk/clientset/versioned/typed/services/v1alpha1/services_client.go +++ b/sdk/clientset/versioned/typed/syncagent/v1alpha1/syncagent_client.go @@ -21,31 +21,31 @@ package v1alpha1 import ( "net/http" - v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + v1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" rest "k8s.io/client-go/rest" "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/scheme" ) -type ServicesV1alpha1Interface interface { +type SyncagentV1alpha1Interface interface { RESTClient() rest.Interface PublishedResourcesGetter } -// ServicesV1alpha1Client is used to interact with features provided by the services.syncagent.kcp.io group. -type ServicesV1alpha1Client struct { +// SyncagentV1alpha1Client is used to interact with features provided by the syncagent.kcp.io group. +type SyncagentV1alpha1Client struct { restClient rest.Interface } -func (c *ServicesV1alpha1Client) PublishedResources() PublishedResourceInterface { +func (c *SyncagentV1alpha1Client) PublishedResources() PublishedResourceInterface { return newPublishedResources(c) } -// NewForConfig creates a new ServicesV1alpha1Client for the given config. +// NewForConfig creates a new SyncagentV1alpha1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*ServicesV1alpha1Client, error) { +func NewForConfig(c *rest.Config) (*SyncagentV1alpha1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -57,9 +57,9 @@ func NewForConfig(c *rest.Config) (*ServicesV1alpha1Client, error) { return NewForConfigAndClient(&config, httpClient) } -// NewForConfigAndClient creates a new ServicesV1alpha1Client for the given config and http client. +// NewForConfigAndClient creates a new SyncagentV1alpha1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ServicesV1alpha1Client, error) { +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SyncagentV1alpha1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -68,12 +68,12 @@ func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ServicesV1alpha1Cli if err != nil { return nil, err } - return &ServicesV1alpha1Client{client}, nil + return &SyncagentV1alpha1Client{client}, nil } -// NewForConfigOrDie creates a new ServicesV1alpha1Client for the given config and +// NewForConfigOrDie creates a new SyncagentV1alpha1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *ServicesV1alpha1Client { +func NewForConfigOrDie(c *rest.Config) *SyncagentV1alpha1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -81,9 +81,9 @@ func NewForConfigOrDie(c *rest.Config) *ServicesV1alpha1Client { return client } -// New creates a new ServicesV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *ServicesV1alpha1Client { - return &ServicesV1alpha1Client{c} +// New creates a new SyncagentV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *SyncagentV1alpha1Client { + return &SyncagentV1alpha1Client{c} } func setConfigDefaults(config *rest.Config) error { @@ -101,7 +101,7 @@ func setConfigDefaults(config *rest.Config) error { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *ServicesV1alpha1Client) RESTClient() rest.Interface { +func (c *SyncagentV1alpha1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/sdk/crd/kcp.io/services.syncagent.kcp.io_publishedresources.yaml b/sdk/crd/kcp.io/syncagent.kcp.io_publishedresources.yaml similarity index 99% rename from sdk/crd/kcp.io/services.syncagent.kcp.io_publishedresources.yaml rename to sdk/crd/kcp.io/syncagent.kcp.io_publishedresources.yaml index 0a12866..cfc66ad 100644 --- a/sdk/crd/kcp.io/services.syncagent.kcp.io_publishedresources.yaml +++ b/sdk/crd/kcp.io/syncagent.kcp.io_publishedresources.yaml @@ -5,9 +5,9 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.16.5 - name: publishedresources.services.syncagent.kcp.io + name: publishedresources.syncagent.kcp.io spec: - group: services.syncagent.kcp.io + group: syncagent.kcp.io names: kind: PublishedResource listKind: PublishedResourceList diff --git a/sdk/informers/externalversions/factory.go b/sdk/informers/externalversions/factory.go index 2a9675f..cd00e9f 100644 --- a/sdk/informers/externalversions/factory.go +++ b/sdk/informers/externalversions/factory.go @@ -37,7 +37,7 @@ import ( "k8s.io/client-go/tools/cache" "github.com/kcp-dev/api-syncagent/sdk/informers/externalversions/internalinterfaces" - servicesinformers "github.com/kcp-dev/api-syncagent/sdk/informers/externalversions/services" + syncagentinformers "github.com/kcp-dev/api-syncagent/sdk/informers/externalversions/syncagent" ) // SharedInformerOption defines the functional option type for SharedInformerFactory. @@ -269,11 +269,11 @@ type SharedInformerFactory interface { // InformerFor returns the SharedIndexInformer for obj. InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) kcpcache.ScopeableSharedIndexInformer - Services() servicesinformers.ClusterInterface + Syncagent() syncagentinformers.ClusterInterface } -func (f *sharedInformerFactory) Services() servicesinformers.ClusterInterface { - return servicesinformers.New(f, f.tweakListOptions) +func (f *sharedInformerFactory) Syncagent() syncagentinformers.ClusterInterface { + return syncagentinformers.New(f, f.tweakListOptions) } func (f *sharedInformerFactory) Cluster(clusterName logicalcluster.Name) ScopedDynamicSharedInformerFactory { @@ -420,9 +420,9 @@ type SharedScopedInformerFactory interface { ForResource(resource schema.GroupVersionResource) (GenericInformer, error) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - Services() servicesinformers.Interface + Syncagent() syncagentinformers.Interface } -func (f *sharedScopedInformerFactory) Services() servicesinformers.Interface { - return servicesinformers.NewScoped(f, f.namespace, f.tweakListOptions) +func (f *sharedScopedInformerFactory) Syncagent() syncagentinformers.Interface { + return syncagentinformers.NewScoped(f, f.namespace, f.tweakListOptions) } diff --git a/sdk/informers/externalversions/generic.go b/sdk/informers/externalversions/generic.go index 674983f..66ea0ba 100644 --- a/sdk/informers/externalversions/generic.go +++ b/sdk/informers/externalversions/generic.go @@ -24,7 +24,7 @@ package informers import ( "fmt" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" "github.com/kcp-dev/logicalcluster/v3" @@ -85,9 +85,9 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericClusterInformer, error) { switch resource { - // Group=services.syncagent.kcp.io, Version=V1alpha1 - case servicesv1alpha1.SchemeGroupVersion.WithResource("publishedresources"): - return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Services().V1alpha1().PublishedResources().Informer()}, nil + // Group=syncagent.kcp.io, Version=V1alpha1 + case syncagentv1alpha1.SchemeGroupVersion.WithResource("publishedresources"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Syncagent().V1alpha1().PublishedResources().Informer()}, nil } return nil, fmt.Errorf("no informer found for %v", resource) @@ -97,9 +97,9 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // TODO extend this to unknown resources with a client pool func (f *sharedScopedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=services.syncagent.kcp.io, Version=V1alpha1 - case servicesv1alpha1.SchemeGroupVersion.WithResource("publishedresources"): - informer := f.Services().V1alpha1().PublishedResources().Informer() + // Group=syncagent.kcp.io, Version=V1alpha1 + case syncagentv1alpha1.SchemeGroupVersion.WithResource("publishedresources"): + informer := f.Syncagent().V1alpha1().PublishedResources().Informer() return &genericInformer{lister: cache.NewGenericLister(informer.GetIndexer(), resource.GroupResource()), informer: informer}, nil } diff --git a/sdk/informers/externalversions/services/interface.go b/sdk/informers/externalversions/syncagent/interface.go similarity index 98% rename from sdk/informers/externalversions/services/interface.go rename to sdk/informers/externalversions/syncagent/interface.go index c4d1bbe..20bf4e2 100644 --- a/sdk/informers/externalversions/services/interface.go +++ b/sdk/informers/externalversions/syncagent/interface.go @@ -19,11 +19,11 @@ limitations under the License. // Code generated by kcp code-generator. DO NOT EDIT. -package services +package syncagent import ( "github.com/kcp-dev/api-syncagent/sdk/informers/externalversions/internalinterfaces" - "github.com/kcp-dev/api-syncagent/sdk/informers/externalversions/services/v1alpha1" + "github.com/kcp-dev/api-syncagent/sdk/informers/externalversions/syncagent/v1alpha1" ) type ClusterInterface interface { diff --git a/sdk/informers/externalversions/services/v1alpha1/interface.go b/sdk/informers/externalversions/syncagent/v1alpha1/interface.go similarity index 100% rename from sdk/informers/externalversions/services/v1alpha1/interface.go rename to sdk/informers/externalversions/syncagent/v1alpha1/interface.go diff --git a/sdk/informers/externalversions/services/v1alpha1/publishedresource.go b/sdk/informers/externalversions/syncagent/v1alpha1/publishedresource.go similarity index 81% rename from sdk/informers/externalversions/services/v1alpha1/publishedresource.go rename to sdk/informers/externalversions/syncagent/v1alpha1/publishedresource.go index 39eb799..c855ac6 100644 --- a/sdk/informers/externalversions/services/v1alpha1/publishedresource.go +++ b/sdk/informers/externalversions/syncagent/v1alpha1/publishedresource.go @@ -25,10 +25,10 @@ import ( "context" "time" - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" scopedclientset "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned" clientset "github.com/kcp-dev/api-syncagent/sdk/clientset/versioned/cluster" - servicesv1alpha1listers "github.com/kcp-dev/api-syncagent/sdk/listers/services/v1alpha1" + syncagentv1alpha1listers "github.com/kcp-dev/api-syncagent/sdk/listers/syncagent/v1alpha1" kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" "github.com/kcp-dev/logicalcluster/v3" @@ -46,7 +46,7 @@ import ( type PublishedResourceClusterInformer interface { Cluster(logicalcluster.Name) PublishedResourceInformer Informer() kcpcache.ScopeableSharedIndexInformer - Lister() servicesv1alpha1listers.PublishedResourceClusterLister + Lister() syncagentv1alpha1listers.PublishedResourceClusterLister } type publishedResourceClusterInformer struct { @@ -71,16 +71,16 @@ func NewFilteredPublishedResourceClusterInformer(client clientset.ClusterInterfa if tweakListOptions != nil { tweakListOptions(&options) } - return client.ServicesV1alpha1().PublishedResources().List(context.TODO(), options) + return client.SyncagentV1alpha1().PublishedResources().List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.ServicesV1alpha1().PublishedResources().Watch(context.TODO(), options) + return client.SyncagentV1alpha1().PublishedResources().Watch(context.TODO(), options) }, }, - &servicesv1alpha1.PublishedResource{}, + &syncagentv1alpha1.PublishedResource{}, resyncPeriod, indexers, ) @@ -95,18 +95,18 @@ func (f *publishedResourceClusterInformer) defaultInformer(client clientset.Clus } func (f *publishedResourceClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { - return f.factory.InformerFor(&servicesv1alpha1.PublishedResource{}, f.defaultInformer) + return f.factory.InformerFor(&syncagentv1alpha1.PublishedResource{}, f.defaultInformer) } -func (f *publishedResourceClusterInformer) Lister() servicesv1alpha1listers.PublishedResourceClusterLister { - return servicesv1alpha1listers.NewPublishedResourceClusterLister(f.Informer().GetIndexer()) +func (f *publishedResourceClusterInformer) Lister() syncagentv1alpha1listers.PublishedResourceClusterLister { + return syncagentv1alpha1listers.NewPublishedResourceClusterLister(f.Informer().GetIndexer()) } // PublishedResourceInformer provides access to a shared informer and lister for // PublishedResources. type PublishedResourceInformer interface { Informer() cache.SharedIndexInformer - Lister() servicesv1alpha1listers.PublishedResourceLister + Lister() syncagentv1alpha1listers.PublishedResourceLister } func (f *publishedResourceClusterInformer) Cluster(clusterName logicalcluster.Name) PublishedResourceInformer { @@ -118,14 +118,14 @@ func (f *publishedResourceClusterInformer) Cluster(clusterName logicalcluster.Na type publishedResourceInformer struct { informer cache.SharedIndexInformer - lister servicesv1alpha1listers.PublishedResourceLister + lister syncagentv1alpha1listers.PublishedResourceLister } func (f *publishedResourceInformer) Informer() cache.SharedIndexInformer { return f.informer } -func (f *publishedResourceInformer) Lister() servicesv1alpha1listers.PublishedResourceLister { +func (f *publishedResourceInformer) Lister() syncagentv1alpha1listers.PublishedResourceLister { return f.lister } @@ -135,11 +135,11 @@ type publishedResourceScopedInformer struct { } func (f *publishedResourceScopedInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&servicesv1alpha1.PublishedResource{}, f.defaultInformer) + return f.factory.InformerFor(&syncagentv1alpha1.PublishedResource{}, f.defaultInformer) } -func (f *publishedResourceScopedInformer) Lister() servicesv1alpha1listers.PublishedResourceLister { - return servicesv1alpha1listers.NewPublishedResourceLister(f.Informer().GetIndexer()) +func (f *publishedResourceScopedInformer) Lister() syncagentv1alpha1listers.PublishedResourceLister { + return syncagentv1alpha1listers.NewPublishedResourceLister(f.Informer().GetIndexer()) } // NewPublishedResourceInformer constructs a new informer for PublishedResource type. @@ -159,16 +159,16 @@ func NewFilteredPublishedResourceInformer(client scopedclientset.Interface, resy if tweakListOptions != nil { tweakListOptions(&options) } - return client.ServicesV1alpha1().PublishedResources().List(context.TODO(), options) + return client.SyncagentV1alpha1().PublishedResources().List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.ServicesV1alpha1().PublishedResources().Watch(context.TODO(), options) + return client.SyncagentV1alpha1().PublishedResources().Watch(context.TODO(), options) }, }, - &servicesv1alpha1.PublishedResource{}, + &syncagentv1alpha1.PublishedResource{}, resyncPeriod, indexers, ) diff --git a/sdk/listers/services/v1alpha1/publishedresource.go b/sdk/listers/syncagent/v1alpha1/publishedresource.go similarity index 79% rename from sdk/listers/services/v1alpha1/publishedresource.go rename to sdk/listers/syncagent/v1alpha1/publishedresource.go index 3e5b57e..81856ae 100644 --- a/sdk/listers/services/v1alpha1/publishedresource.go +++ b/sdk/listers/syncagent/v1alpha1/publishedresource.go @@ -22,7 +22,7 @@ limitations under the License. package v1alpha1 import ( - servicesv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/services/v1alpha1" + syncagentv1alpha1 "github.com/kcp-dev/api-syncagent/sdk/apis/syncagent/v1alpha1" kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" "github.com/kcp-dev/logicalcluster/v3" @@ -36,7 +36,7 @@ import ( type PublishedResourceClusterLister interface { // List lists all PublishedResources in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*servicesv1alpha1.PublishedResource, err error) + List(selector labels.Selector) (ret []*syncagentv1alpha1.PublishedResource, err error) // Cluster returns a lister that can list and get PublishedResources in one workspace. Cluster(clusterName logicalcluster.Name) PublishedResourceLister PublishedResourceClusterListerExpansion @@ -56,9 +56,9 @@ func NewPublishedResourceClusterLister(indexer cache.Indexer) *publishedResource } // List lists all PublishedResources in the indexer across all workspaces. -func (s *publishedResourceClusterLister) List(selector labels.Selector) (ret []*servicesv1alpha1.PublishedResource, err error) { +func (s *publishedResourceClusterLister) List(selector labels.Selector) (ret []*syncagentv1alpha1.PublishedResource, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*servicesv1alpha1.PublishedResource)) + ret = append(ret, m.(*syncagentv1alpha1.PublishedResource)) }) return ret, err } @@ -73,10 +73,10 @@ func (s *publishedResourceClusterLister) Cluster(clusterName logicalcluster.Name type PublishedResourceLister interface { // List lists all PublishedResources in the workspace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*servicesv1alpha1.PublishedResource, err error) + List(selector labels.Selector) (ret []*syncagentv1alpha1.PublishedResource, err error) // Get retrieves the PublishedResource from the indexer for a given workspace and name. // Objects returned here must be treated as read-only. - Get(name string) (*servicesv1alpha1.PublishedResource, error) + Get(name string) (*syncagentv1alpha1.PublishedResource, error) PublishedResourceListerExpansion } @@ -87,24 +87,24 @@ type publishedResourceLister struct { } // List lists all PublishedResources in the indexer for a workspace. -func (s *publishedResourceLister) List(selector labels.Selector) (ret []*servicesv1alpha1.PublishedResource, err error) { +func (s *publishedResourceLister) List(selector labels.Selector) (ret []*syncagentv1alpha1.PublishedResource, err error) { err = kcpcache.ListAllByCluster(s.indexer, s.clusterName, selector, func(i interface{}) { - ret = append(ret, i.(*servicesv1alpha1.PublishedResource)) + ret = append(ret, i.(*syncagentv1alpha1.PublishedResource)) }) return ret, err } // Get retrieves the PublishedResource from the indexer for a given workspace and name. -func (s *publishedResourceLister) Get(name string) (*servicesv1alpha1.PublishedResource, error) { +func (s *publishedResourceLister) Get(name string) (*syncagentv1alpha1.PublishedResource, error) { key := kcpcache.ToClusterAwareKey(s.clusterName.String(), "", name) obj, exists, err := s.indexer.GetByKey(key) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(servicesv1alpha1.Resource("publishedresources"), name) + return nil, errors.NewNotFound(syncagentv1alpha1.Resource("publishedresources"), name) } - return obj.(*servicesv1alpha1.PublishedResource), nil + return obj.(*syncagentv1alpha1.PublishedResource), nil } // NewPublishedResourceLister returns a new PublishedResourceLister. @@ -121,22 +121,22 @@ type publishedResourceScopedLister struct { } // List lists all PublishedResources in the indexer for a workspace. -func (s *publishedResourceScopedLister) List(selector labels.Selector) (ret []*servicesv1alpha1.PublishedResource, err error) { +func (s *publishedResourceScopedLister) List(selector labels.Selector) (ret []*syncagentv1alpha1.PublishedResource, err error) { err = cache.ListAll(s.indexer, selector, func(i interface{}) { - ret = append(ret, i.(*servicesv1alpha1.PublishedResource)) + ret = append(ret, i.(*syncagentv1alpha1.PublishedResource)) }) return ret, err } // Get retrieves the PublishedResource from the indexer for a given workspace and name. -func (s *publishedResourceScopedLister) Get(name string) (*servicesv1alpha1.PublishedResource, error) { +func (s *publishedResourceScopedLister) Get(name string) (*syncagentv1alpha1.PublishedResource, error) { key := name obj, exists, err := s.indexer.GetByKey(key) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(servicesv1alpha1.Resource("publishedresources"), name) + return nil, errors.NewNotFound(syncagentv1alpha1.Resource("publishedresources"), name) } - return obj.(*servicesv1alpha1.PublishedResource), nil + return obj.(*syncagentv1alpha1.PublishedResource), nil } diff --git a/sdk/listers/services/v1alpha1/publishedresource_expansion.go b/sdk/listers/syncagent/v1alpha1/publishedresource_expansion.go similarity index 100% rename from sdk/listers/services/v1alpha1/publishedresource_expansion.go rename to sdk/listers/syncagent/v1alpha1/publishedresource_expansion.go