From 0af5f6348a1c1f7f83e11fa95de11b813f8147c0 Mon Sep 17 00:00:00 2001 From: Vu Dinh Date: Thu, 6 Oct 2022 11:48:39 -0400 Subject: [PATCH] Add CatalogEntry validation in controller 1. Validate export references in entry spec 2. Aggregate PermissionClaims and API resources info from referenced APIExport to entry status Signed-off-by: Vu Dinh --- config/kcp/catalogentry.apiexport.yaml | 7 + .../kcp/catalogentry.apiresourceschemas.yaml | 174 ++++++++++++++++++ controllers/catalogentry_controller.go | 122 +++++++++--- go.mod | 22 ++- go.sum | 36 ++-- main.go | 1 - 6 files changed, 317 insertions(+), 45 deletions(-) create mode 100644 config/kcp/catalogentry.apiexport.yaml create mode 100644 config/kcp/catalogentry.apiresourceschemas.yaml diff --git a/config/kcp/catalogentry.apiexport.yaml b/config/kcp/catalogentry.apiexport.yaml new file mode 100644 index 0000000..dfba523 --- /dev/null +++ b/config/kcp/catalogentry.apiexport.yaml @@ -0,0 +1,7 @@ +apiVersion: apis.kcp.dev/v1alpha1 +kind: APIExport +metadata: + name: catalog.kcp.dev +spec: + latestResourceSchemas: + - catalogentry.catalog.kcp.dev diff --git a/config/kcp/catalogentry.apiresourceschemas.yaml b/config/kcp/catalogentry.apiresourceschemas.yaml new file mode 100644 index 0000000..f954c73 --- /dev/null +++ b/config/kcp/catalogentry.apiresourceschemas.yaml @@ -0,0 +1,174 @@ +--- +apiVersion: apis.kcp.dev/v1alpha1 +kind: APIResourceSchema +metadata: + creationTimestamp: null + name: catalogentries.catalog.kcp.dev +spec: + group: catalog.kcp.dev + names: + kind: CatalogEntry + listKind: CatalogEntryList + plural: catalogentries + singular: catalogentry + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: CatalogEntry is the Schema for the catalogentries API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: CatalogEntrySpec defines the desired state of CatalogEntry + properties: + description: + description: description is a human-readable message to describe the + information regarding the capabilities and features that the API + provides + type: string + exports: + description: exports is a list of references to APIExports. + items: + description: ExportReference describes a reference to an APIExport. + Exactly one of the fields must be set. + properties: + workspace: + description: workspace is a reference to an APIExport in the + same organization. The creator of the APIBinding needs to + have access to the APIExport with the verb `bind` in order + to bind to it. + properties: + exportName: + description: Name of the APIExport that describes the API. + type: string + path: + description: path is an absolute reference to a workspace, + e.g. root:org:ws. The workspace must be some ancestor + or a child of some ancestor. If it is unset, the path + of the APIBinding is used. + pattern: ^root(:[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - exportName + type: object + type: object + minItems: 1 + type: array + required: + - exports + type: object + status: + description: CatalogEntryStatus defines the observed state of CatalogEntry + properties: + conditions: + description: conditions is a list of conditions that apply to the + CatalogEntry. + items: + description: Condition defines an observation of a object operational + state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + exportPermissionClaims: + description: exportPermissionClaims is a list of permissions requested + by the API provider(s) for this catalog entry. + items: + description: PermissionClaim identifies an object by GR and identity + hash. It's purpose is to determine the added permisions that a + service provider may request and that a consumer may accept and + alllow the service provider access to. + properties: + group: + description: group is the name of an API group. For core groups + this is the empty string '""'. + pattern: ^(|[a-z0-9]([-a-z0-9]*[a-z0-9](\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?)$ + type: string + identityHash: + description: This is the identity for a given APIExport that + the APIResourceSchema belongs to. The hash can be found on + APIExport and APIResourceSchema's status. It will be empty + for core types. Note that one must look this up for a particular + KCP instance. + type: string + resource: + description: 'resource is the name of the resource. Note: it + is worth noting that you can not ask for permissions for resource + provided by a CRD not provided by an api export.' + pattern: ^[a-z][-a-z0-9]*[a-z0-9]$ + type: string + required: + - resource + type: object + type: array + resources: + description: resources is the list of APIs that are provided by this + catalog entry. + items: + description: GroupResource specifies a Group and a Resource, but + does not force a version. This is useful for identifying concepts + during lookup stages without having partially valid types + properties: + group: + type: string + resource: + type: string + required: + - group + - resource + type: object + type: array + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/controllers/catalogentry_controller.go b/controllers/catalogentry_controller.go index 7e5a592..906bf29 100644 --- a/controllers/catalogentry_controller.go +++ b/controllers/catalogentry_controller.go @@ -22,6 +22,9 @@ import ( "github.com/kcp-dev/catalog/api/v1alpha1" catalogv1alpha1 "github.com/kcp-dev/catalog/api/v1alpha1" apisv1alpha1 "github.com/kcp-dev/kcp/pkg/apis/apis/v1alpha1" + "github.com/kcp-dev/kcp/pkg/apis/third_party/conditions/util/conditions" + conditionsapi "github.com/kcp-dev/kcp/pkg/apis/third_party/conditions/apis/conditions/v1alpha1" + "github.com/kcp-dev/kcp/pkg/logging" "github.com/kcp-dev/logicalcluster" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" @@ -31,6 +34,10 @@ import ( ctrllog "sigs.k8s.io/controller-runtime/pkg/log" ) +const ( + controllerName = "kcp-catalogentry" +) + // CatalogEntryReconciler reconciles a CatalogEntry object type CatalogEntryReconciler struct { client.Client @@ -41,19 +48,15 @@ type CatalogEntryReconciler struct { //+kubebuilder:rbac:groups=catalog.kcp.dev,resources=catalogentries/status,verbs=get;update;patch //+kubebuilder:rbac:groups=catalog.kcp.dev,resources=catalogentries/finalizers,verbs=update -// Reconcile is part of the main kubernetes reconciliation loop which aims to -// move the current state of the cluster closer to the desired state. -// TODO(user): Modify the Reconcile function to compare the state specified by -// the CatalogEntry object against the actual cluster state, and then -// perform operations to make the cluster state reflect the state specified by -// the user. -// -// For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.11.2/pkg/reconcile +// Reconcile validates exports in CatalogEntry spec and add a condition to status +// to reflect the outcome of the validation. +// It also aggregates all permissionClaims and api resources from referenced APIExport +// to CatalogEntry status func (r *CatalogEntryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - log := ctrllog.FromContext(ctx) - + logger := logging.WithReconciler(klog.Background(), controllerName) + logger = logger.WithValues("clusterName", req.ClusterName) ctx = logicalcluster.WithCluster(ctx, logicalcluster.New(req.ClusterName)) + // Fetch the catalog entry from the request catalogEntry := &v1alpha1.CatalogEntry{} err := r.Get(ctx, req.NamespacedName, catalogEntry) @@ -61,30 +64,107 @@ func (r *CatalogEntryReconciler) Reconcile(ctx context.Context, req ctrl.Request if errors.IsNotFound(err) { // Request object not found, could have been deleted after reconcile request. // Owned objects are automatically garbage collected. - log.Info("Catalog Entry not found. Ignoring since object must be deleted") + logger.Info("CatalogEntry not found") return ctrl.Result{}, nil } // Error reading the object - requeue the request. - log.Error(err, "Failed to get resource") + logger.Error(err, "failed to get resource") return ctrl.Result{}, err } - apiExportNameReferences := catalogEntry.Spec.References - - for _, exportRef := range apiExportNameReferences { + changed := false + entryStatus := &v1alpha1.CatalogEntryStatus{} + resources := []metav1.GroupResource{} + exportPermissionClaims := []apisv1alpha1.PermissionClaim + invalidExports := []string + for _, exportRef := range catalogEntry.Spec.Exports { // TODO: verify if path contains the entire heirarchy or just the clusterName. // If it contains the heirarchy then extract the clusterName path := exportRef.Workspace.Path name := exportRef.Workspace.ExportName - clusterApiExport := apisv1alpha1.APIExport{} - err := r.Get(logicalcluster.WithCluster(ctx, logicalcluster.New(path)), types.NamespacedName{Name: name, Namespace: req.Namespace}, &clusterApiExport) + logger = logger.WithValues( + "path", path, + "exportName", name, + ) + logger.V(2).Info("reconciling CatalogEntry") + export := apisv1alpha1.APIExport{} + err := r.Get(logicalcluster.WithCluster(ctx, logicalcluster.New(path)), types.NamespacedName{Name: name, Namespace: req.Namespace}, &export) if err != nil { + invalidExports = append(invalidExports, fmt.Sprintf("%s/%s", path, name)) if errors.IsNotFound(err) { - log.Error(err, "APIExport referenced in catalog entry does not exist") - return ctrl.Result{}, err + logger.Error(err, "APIExport referenced in catalog entry does not exist") + continue } // Error reading the object - requeue the request. - log.Error(err, "Failed to get resource") + logger.Error(err, "failed to get resource") + continue + } + + // Extract permission and API resource info + for _, claim := range export.Spec.PermissionClaims { + exportPermissionClaims = append(exportPermissionClaims, claim) + } + for _, schemaName := range export.Spec.LatestResourceSchemas { + _, resource, group, ok := split3(schemaName, ".") + if !ok { + continue + } + gr := metav1.GroupVersion{ + Group: group, + Resource: resource, + } + resources = append(resources, gr) + } + } + + if len(invalidExports) = 0 { + // All exports are valid. Set APIExportValid condition to true if not existed already + if !conditions.IsTrue(catalogEntry, catalogv1alpha1.APIExportValidType) { + changed = true + validCond := conditionsapi.Condition{ + Type: catalogv1alpha1.APIExportValidType, + Status: corev1.ConditionTrue, + Severity: conditionsapi.ConditionSeverityNone, + LastTransitionTime: metav1.Now(), + } + conditions.Set(catalogEntry, validCond) + } + } else { + message := fmt.Sprintf("invalid export(s): %s", strings.Join(invalidExports, " ,")) + invalidCond := conditionsapi.Condition{ + Type: catalogv1alpha1.APIExportValidType, + Status: corev1.ConditionFalse, + Severity: conditionsapi.ConditionSeverity, + LastTransitionTime: metav1.Now(), + Message: message, + } + cond := conditions.Get(catalogEntry, invalidCond) + if cond != nil { + if !cond.Match(invalidCond) { + changed = true + conditions.Set(catalogEntry, invalidCond) + } + } else { + changed = true + conditions.Set(catalogEntry, invalidCond) + } + } + + // Check if status is changed + if !reflect.DeepEqual(catalogEntry.Status.PermissionClaim, export.Spec.PermissionClaims) { + changed = true + entryStatus.ExportPermissionClaims = export.Spec.PermissionClaims + } + if !reflect.DeepEqual(catalogEntry.Status.Resources, resources) { + changed = true + entryStatus.Resources = resources + } + + // Update the catalog entry if status is changed + if changed { + err = r.Client.Status().Update(context.TODO(), catalogEntry) + if err != nil { + logger.Error(err, "failed to update CatalogEntry") return ctrl.Result{}, err } } diff --git a/go.mod b/go.mod index e5109f2..9022745 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,8 @@ module github.com/kcp-dev/catalog go 1.18 require ( - github.com/kcp-dev/kcp/pkg/apis v0.8.2 + github.com/kcp-dev/kcp v0.9.0 + github.com/kcp-dev/kcp/pkg/apis v0.9.0 github.com/kcp-dev/logicalcluster v1.1.1 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.18.1 @@ -26,10 +27,10 @@ require ( github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful v2.9.5+incompatible // indirect - github.com/evanphx/json-patch v4.12.0+incompatible // indirect + github.com/evanphx/json-patch v5.6.0+incompatible // indirect github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect - github.com/go-logr/logr v1.2.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/zapr v1.2.0 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonreference v0.19.5 // indirect @@ -38,14 +39,14 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect - github.com/google/go-cmp v0.5.5 // indirect + github.com/google/go-cmp v0.5.6 // indirect github.com/google/gofuzz v1.1.0 // indirect github.com/google/uuid v1.1.2 // indirect github.com/imdario/mergo v0.3.12 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/kcp-dev/apimachinery v0.0.0-20220803185518-868856d14e8a // indirect - github.com/kcp-dev/logicalcluster/v2 v2.0.0-alpha.1 // indirect + github.com/kcp-dev/apimachinery v0.0.0-20220912132244-efe716c18e43 // indirect + github.com/kcp-dev/logicalcluster/v2 v2.0.0-alpha.3 // indirect github.com/mailru/easyjson v0.7.6 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -57,14 +58,14 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace // indirect go.uber.org/atomic v1.7.0 // indirect - go.uber.org/multierr v1.6.0 // indirect + go.uber.org/multierr v1.7.0 // indirect go.uber.org/zap v1.19.1 // indirect golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect - golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect + golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect @@ -77,12 +78,13 @@ require ( gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect k8s.io/api v0.24.3 // indirect k8s.io/apiextensions-apiserver v0.24.3 // indirect + k8s.io/apiserver v0.24.3 // indirect k8s.io/component-base v0.24.3 // indirect k8s.io/klog/v2 v2.60.1 // indirect k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index f7d8e1b..ad27ebe 100644 --- a/go.sum +++ b/go.sum @@ -133,8 +133,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= -github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= +github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= @@ -158,8 +159,9 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/zapr v1.2.0 h1:n4JnPI1T3Qq1SFEi/F8rwLrZERp2bso19PJZDB9dayk= github.com/go-logr/zapr v1.2.0/go.mod h1:Qa4Bsj2Vb+FAVeAKsLD8RLQ+YRJB8YDmOAKxaBQf7Ro= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= @@ -230,8 +232,9 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -307,16 +310,18 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kcp-dev/apimachinery v0.0.0-20220803185518-868856d14e8a h1:lJyVMNywLln1x5A3WVELeDpftc5FktP3asI1Prx0lOU= -github.com/kcp-dev/apimachinery v0.0.0-20220803185518-868856d14e8a/go.mod h1:qnvUHkdxOrNzX17yX+z8r81CZEBuFdveNzWqFlwZ55w= +github.com/kcp-dev/apimachinery v0.0.0-20220912132244-efe716c18e43 h1:vPv81j3mT5VYQ6YnCXrnKJQPeRNHwPcGJNsQNQfIG9Q= +github.com/kcp-dev/apimachinery v0.0.0-20220912132244-efe716c18e43/go.mod h1:qnvUHkdxOrNzX17yX+z8r81CZEBuFdveNzWqFlwZ55w= github.com/kcp-dev/controller-runtime v0.12.2-0.20220808200255-4b60fd66e5de h1:IuXSIlIKJiR3ZsuO5PJ1yYdncsheX3A9rpuXQJ/TfQg= github.com/kcp-dev/controller-runtime v0.12.2-0.20220808200255-4b60fd66e5de/go.mod h1:OFkNQPsWPPz6qWrIY3FUjmSb0W7qKLK8aZC/xBIJwUE= -github.com/kcp-dev/kcp/pkg/apis v0.8.2 h1:yGeI+wZvv32w2leVd354ELydOr2TZikywGf74M3QzL8= -github.com/kcp-dev/kcp/pkg/apis v0.8.2/go.mod h1:jwvDdhVuswpwqCriyr7frT3Ak23OzuFoVRjqSvfFiRk= +github.com/kcp-dev/kcp v0.9.0 h1:lBX63sEqDGMCrLM+MAQBlMERrUW8pnMcltk52XStSkk= +github.com/kcp-dev/kcp v0.9.0/go.mod h1:AJOr9fzaWBjlrB13e0ibSHEg8rwmtxzgy5hmjicbSYQ= +github.com/kcp-dev/kcp/pkg/apis v0.9.0 h1:7z+/d2AF/Dua6gbiUOHAZkPtW7QDzHCqLJgSkvPE68Y= +github.com/kcp-dev/kcp/pkg/apis v0.9.0/go.mod h1:bHOeSFzFYaOOwtdNLNqoZndz53tzEGZdXT/dWnPmjLU= github.com/kcp-dev/logicalcluster v1.1.1 h1:6jv54KRHDVvsJjuaV6dWNHVivYCSxDjGjfN+m1pVu3k= github.com/kcp-dev/logicalcluster v1.1.1/go.mod h1:3IvnQ1TDaTuyhgRqagtKWd1XKz3kBeP8ByLvyNiWywg= -github.com/kcp-dev/logicalcluster/v2 v2.0.0-alpha.1 h1:6EMfOioekQNrpcHEK7k2ANBWogFMlf+3xTB3CC4k+2s= -github.com/kcp-dev/logicalcluster/v2 v2.0.0-alpha.1/go.mod h1:lfWJL764jKFJxZWOGuFuT3PCCLPo6lV5Cl8P7u9T05g= +github.com/kcp-dev/logicalcluster/v2 v2.0.0-alpha.3 h1:+DwIG/loh2nDB9c/FqNvLzFFq/YtBliLxAfw/uWNzyE= +github.com/kcp-dev/logicalcluster/v2 v2.0.0-alpha.3/go.mod h1:lfWJL764jKFJxZWOGuFuT3PCCLPo6lV5Cl8P7u9T05g= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -453,8 +458,9 @@ github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSW github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace h1:9PNP1jnUjRhfmGMlkXHjYPishpcw4jpSt/V/xYY3FMA= +github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -514,8 +520,9 @@ go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= @@ -709,8 +716,9 @@ golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc= +golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -952,6 +960,7 @@ k8s.io/apiextensions-apiserver v0.24.3 h1:kyx+Tmro1qEsTUr07ZGQOfvTsF61yn+AxnxytB k8s.io/apiextensions-apiserver v0.24.3/go.mod h1:cL0xkmUefpYM4f6IuOau+6NMFEIh6/7wXe/O4vPVJ8A= k8s.io/apimachinery v0.24.3 h1:hrFiNSA2cBZqllakVYyH/VyEh4B581bQRmqATJSeQTg= k8s.io/apimachinery v0.24.3/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM= +k8s.io/apiserver v0.24.3 h1:J8CKjUaZopT0hSgxjzUyp3T1GK78iixxOuFpEC0MI3k= k8s.io/apiserver v0.24.3/go.mod h1:aXfwtIn4U27B7lYs5f2BKgz6DRbgWy+HJeYReN1jLJ8= k8s.io/client-go v0.24.3 h1:Nl1840+6p4JqkFWEW2LnMKU667BUxw03REfLAVhuKQY= k8s.io/client-go v0.24.3/go.mod h1:AAovolf5Z9bY1wIg2FZ8LPQlEdKHjLI7ZD4rw920BJw= @@ -976,8 +985,9 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30/go.mod h1:fEO7lR sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 h1:kDi4JBNAsJWfz1aEXhO8Jg87JJaPNLh5tIzYHgStQ9Y= sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY= sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/structured-merge-diff/v4 v4.2.1 h1:bKCqE9GvQ5tiVHn5rfn1r+yao3aLQEaLzkkmAkf+A6Y= sigs.k8s.io/structured-merge-diff/v4 v4.2.1/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= +sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= +sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/main.go b/main.go index 8ce967e..3197704 100644 --- a/main.go +++ b/main.go @@ -173,7 +173,6 @@ func restConfigForAPIExport(ctx context.Context, cfg *rest.Config, apiExportName } cfg = rest.CopyConfig(cfg) - // TODO(ncdc): sharding support cfg.Host = apiExport.Status.VirtualWorkspaces[0].URL return cfg, nil