diff --git a/CHANGELOG.md b/CHANGELOG.md index d6b6dbbc23..87a683b34d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,11 +16,12 @@ - CSV config field `role-path` is now `role-paths` and takes a list of strings. Users can now specify multiple `Role` and `ClusterRole` manifests using `role-paths`. ([#1704](https://github.com/operator-framework/operator-sdk/pull/1704)) - Upgrade Kubernetes version from `kubernetes-1.13.4` to `kubernetes-1.14.1` - Upgrade `github.com/operator-framework/operator-lifecycle-manager` version from `b8a4faf68e36feb6d99a6aec623b405e587b17b1` to `0.10.1` -- Upgrade [`controller-runtime`](https://github.com/kubernetes-sigs/controller-runtime) version from `v0.1.12` to `v0.2.0-beta.3` +- Upgrade [`controller-runtime`](https://github.com/kubernetes-sigs/controller-runtime) version from `v0.1.12` to `v0.2.0` - The package `sigs.k8s.io/controller-runtime/pkg/runtime/scheme` is deprecated, and contains no code. Replace this import with `sigs.k8s.io/controller-runtime/pkg/scheme` where relevant. - The package `sigs.k8s.io/controller-runtime/pkg/runtime/log` is deprecated. Replace this import with `sigs.k8s.io/controller-runtime/pkg/log` where relevant. - The package `sigs.k8s.io/controller-runtime/pkg/runtime/signals` is deprecated. Replace this import with `sigs.k8s.io/controller-runtime/pkg/manager/signals` where relevant. - - [`sigs.k8s.io/controller-runtime/pkg/client.Client`](https://github.com/kubernetes-sigs/controller-runtime/blob/aaddbd9d9a89d8ff329a084aece23be0406e6467/pkg/client/interfaces.go#L101)'s `List()` method signature has been updated: `List(ctx context.Context, opts *client.ListOptions, list runtime.Object) error` is now [`List(ctx context.Context, list runtime.Object, opts ...client.ListOptionFunc) error`](https://github.com/kubernetes-sigs/controller-runtime/blob/aaddbd9d9a89d8ff329a084aece23be0406e6467/pkg/client/interfaces.go#L61). To migrate: + - All methods on [`sigs.k8s.io/controller-runtime/pkg/client.Client`](https://github.com/kubernetes-sigs/controller-runtime/blob/v0.2.0/pkg/client/interfaces.go#L104) (except for `Get()`) have been updated. Instead of each using a `struct`-typed or variadic functional option parameter, or having no option parameter, each now uses a variadic interface option parameter typed for each method. See `List()` below for an example. + - [`sigs.k8s.io/controller-runtime/pkg/client.Client`](https://github.com/kubernetes-sigs/controller-runtime/blob/v0.2.0/pkg/client/interfaces.go#L104)'s `List()` method signature has been updated: `List(ctx context.Context, opts *client.ListOptions, list runtime.Object) error` is now [`List(ctx context.Context, list runtime.Object, opts ...client.ListOption) error`](https://github.com/kubernetes-sigs/controller-runtime/blob/v0.2.0/pkg/client/interfaces.go#L61). To migrate: ```go import ( "context" @@ -30,12 +31,17 @@ ... - listOpts := &client.ListOptions{} // Old + listOpts := &client.ListOptions{} + listOpts.InNamespace("namespace") err = r.client.List(context.TODO(), listOps, podList) // New - err = r.client.List(context.TODO(), podList, client.UseListOptions(listOps)) + listOpts := []client.ListOption{ + client.InNamespace("namespace"), + } + err = r.client.List(context.TODO(), podList, listOpts...) ``` +- [`pkg/test.FrameworkClient`](https://github.com/operator-framework/operator-sdk/blob/master/pkg/test/client.go#L33) methods `List()` and `Delete()` have new signatures corresponding to the homonymous methods of `sigs.k8s.io/controller-runtime/pkg/client.Client`. - CRD file names were previously of the form `___crd.yaml`. Now that CRD manifest `spec.version` is deprecated in favor of `spec.versions`, i.e. multiple versions can be specified in one CRD, CRD file names have the form `__crd.yaml`. `` is the full group name of your CRD while `` is the last subdomain of ``, ex. `foo.bar.com` vs `foo`. `` is the plural lower-case CRD Kind found at `spec.names.plural`. ### Deprecated diff --git a/doc/user/client.md b/doc/user/client.md index f8cbbad329..747f247f6d 100644 --- a/doc/user/client.md +++ b/doc/user/client.md @@ -134,32 +134,10 @@ func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, e ```Go // List retrieves a list of objects for a given namespace and list options // and stores the list in obj. -func (c Client) List(ctx context.Context, list runtime.Object, opts ...client.ListOptionFunc) error +func (c Client) List(ctx context.Context, list runtime.Object, opts ...client.ListOption) error ``` -A `client.ListOptionFunc` can be created either by using the provided [functional options](https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#ListOptionFunc) or using `client.ListOptions`: - -```Go -type ListOptions struct { - // LabelSelector filters results by label. Use SetLabelSelector to - // set from raw string form. - LabelSelector labels.Selector - - // FieldSelector filters results by a particular field. In order - // to use this with cache-based implementations, restrict usage to - // a single field-value pair that's been added to the indexers. - FieldSelector fields.Selector - - // Namespace represents the namespace to list for, or empty for - // non-namespaced objects, or to list across all namespaces. - Namespace string - - // Raw represents raw ListOptions, as passed to the API server. Note - // that these may not be respected by all implementations of interface, - // and the LabelSelector and FieldSelector fields are ignored. - Raw *metav1.ListOptions -} -``` +A `client.ListOption` is an interface that sets [`client.ListOptions`][list-options] fields. A `client.ListOption` is created by using one of the provided implementations: [`MatchingLabels`][matching-labels], [`MatchingFields`][matching-fields], [`InNamespace`][in-namespace]. Example: @@ -176,26 +154,37 @@ func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, e ... // Return all pods in the request namespace with a label of `app=` - opts := &client.ListOptions{} - opts.SetLabelSelector(fmt.Sprintf("app=%s", request.NamespacedName.Name)) - opts.InNamespace(request.NamespacedName.Namespace) - + // and phase `Running`. podList := &v1.PodList{} + opts := []client.ListOption{ + client.InNamespace(request.NamespacedName.Namespace), + client.MatchingLabels{"app", request.NamespacedName.Name}, + client.MatchingFields{"status.phase": "Running"}, + } ctx := context.TODO() - err := r.client.List(ctx, podList, client.UseListOptions(listOps)) + err := r.client.List(ctx, podList, opts...) ... } ``` +[list-options]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#ListOptions +[matching-labels]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#MatchingLabels +[matching-fields]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#MatchingFields +[in-namespace]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#InNamespace + #### Create ```Go // Create saves the object obj in the Kubernetes cluster. // Returns an error -func (c Client) Create(ctx context.Context, obj runtime.Object) error +func (c Client) Create(ctx context.Context, obj runtime.Object, opts ...client.CreateOption) error ``` + +A `client.CreateOption` is an interface that sets [`client.CreateOptions`][create-options] fields. A `client.CreateOption` is created by using one of the provided implementations: [`DryRunAll`][dry-run-all], [`ForceOwnership`][force-ownership]. Generally these options are not needed. + Example: + ```Go import ( "context" @@ -216,6 +205,8 @@ func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, e } ``` +[create-options]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#CreateOptions + #### Update ```Go @@ -223,9 +214,13 @@ func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, e // struct pointer so that obj can be updated with the content returned // by the API server. Update does *not* update the resource's status // subresource -func (c Client) Update(ctx context.Context, obj runtime.Object) error +func (c Client) Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error ``` + +A `client.UpdateOption` is an interface that sets [`client.UpdateOptions`][update-options] fields. A `client.UpdateOption` is created by using one of the provided implementations: [`DryRunAll`][dry-run-all], [`ForceOwnership`][force-ownership]. Generally these options are not needed. + Example: + ```Go import ( "context" @@ -249,10 +244,55 @@ func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, e } ``` +[update-options]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#UpdateOptions + +#### Patch + +```Go +// Patch patches the given obj in the Kubernetes cluster. obj must be a +// struct pointer so that obj can be updated with the content returned by the Server. +func (c Client) Patch(ctx context.Context, obj runtime.Object, patch client.Patch, opts ...client.UpdateOption) error +``` + +A `client.PatchOption` is an interface that sets [`client.PatchOptions`][patch-options] fields. A `client.PatchOption` is created by using one of the provided implementations: [`DryRunAll`][dry-run-all], [`ForceOwnership`][force-ownership]. Generally these options are not needed. + +Example: + +```Go +import ( + "context" + "k8s.io/api/apps/v1" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, error) { + ... + + dep := &v1.Deployment{} + err := r.client.Get(context.TODO(), request.NamespacedName, dep) + + ... + + ctx := context.TODO() + dep.Spec.Selector.MatchLabels["is_running"] = "true" + // A merge patch will preserve other fields modified at runtime. + patch := client.MergeFrom(dep) + err := r.client.Patch(ctx, dep, patch) + + ... +} +``` + +[patch-options]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#PatchOption +[dry-run-all]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#DryRunAll +[force-ownership]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#ForceOwnership + ##### Updating Status Subresource -When updating the [status subresource][cr-status-subresource] from the client, -the StatusWriter must be used which can be gotten with `Status()` +When updating the [status subresource][cr-status-subresource] from the client, the [`StatusWriter`][status-writer] must be used. The status subresource is retrieved with `Status()` and updated with `Update()` or patched with `Patch()`. + +`Update()` takes variadic `client.UpdateOption`'s, and `Patch()` takes variadic `client.PatchOption`'s. See [`Client.Update()`](#update) and [`Client.Patch()`](#patch) for more details. Generally these options are not needed. ##### Status @@ -273,57 +313,39 @@ import ( func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, error) { ... + ctx := context.TODO() mem := &cachev1alpha1.Memcached{} - err := r.client.Get(context.TODO(), request.NamespacedName, mem) + err := r.client.Get(ctx, request.NamespacedName, mem) ... - ctx := context.TODO() + // Update mem.Status.Nodes = []string{"pod1", "pod2"} err := r.client.Status().Update(ctx, mem) ... + + // Patch + patch := client.MergeFrom(mem) + err := r.client.Status().Patch(ctx, mem, patch) + + ... } ``` +[status-writer]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#StatusWriter #### Delete ```Go // Delete deletes the given obj from Kubernetes cluster. -func (c Client) Delete(ctx context.Context, obj runtime.Object, opts ...DeleteOptionFunc) error -``` -A `client.DeleteOptionFunc` sets fields of `client.DeleteOptions` to configure a `Delete` call: -```Go -// DeleteOptionFunc is a function that mutates a DeleteOptions struct. -type DeleteOptionFunc func(*DeleteOptions) - -type DeleteOptions struct { - // GracePeriodSeconds is the duration in seconds before the object should be - // deleted. Value must be non-negative integer. The value zero indicates - // delete immediately. If this value is nil, the default grace period for the - // specified type will be used. - GracePeriodSeconds *int64 - - // Preconditions must be fulfilled before a deletion is carried out. If not - // possible, a 409 Conflict status will be returned. - Preconditions *metav1.Preconditions - - // PropagationPolicy determined whether and how garbage collection will be - // performed. Either this field or OrphanDependents may be set, but not both. - // The default policy is decided by the existing finalizer set in the - // metadata.finalizers and the resource-specific default policy. - // Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - - // allow the garbage collector to delete the dependents in the background; - // 'Foreground' - a cascading policy that deletes all dependents in the - // foreground. - PropagationPolicy *metav1.DeletionPropagation - - // Raw represents raw DeleteOptions, as passed to the API server. - Raw *metav1.DeleteOptions -} +func (c Client) Delete(ctx context.Context, obj runtime.Object, opts ...client.DeleteOption) error ``` + +A `client.DeleteOption` is an interface that sets [`client.DeleteOptions`][delete-opts] fields. A `client.DeleteOption` is created by using one of the provided implementations: [`GracePeriodSeconds`][grace-period-seconds], [`Preconditions`][preconditions], [`PropagationPolicy`][propagation-policy]. + Example: + ```Go import ( "context" @@ -351,6 +373,52 @@ func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, e } ``` +[delete-opts]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#DeleteOptions +[grace-period-seconds]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#GracePeriodSeconds +[preconditions]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#Preconditions +[propagation-policy]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#PropagationPolicy + +#### DeleteAllOf + +```Go +// DeleteAllOf deletes all objects of the given type matching the given options. +func (c Client) DeleteAllOf(ctx context.Context, obj runtime.Object, opts ...client.DeleteAllOfOption) error +``` + +A `client.DeleteAllOfOption` is an interface that sets [`client.DeleteAllOfOptions`][deleteallof-opts] fields. A `client.DeleteAllOfOption` wraps a [`client.ListOption`](#list) and [`client.DeleteOption`](#delete). + +Example: + +```Go +import ( + "context" + "fmt" + "k8s.io/api/core/v1" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, error) { + ... + + // Delete all pods in the request namespace with a label of `app=` + // and phase `Failed`. + pod := &v1.Pod{} + opts := []client.DeleteAllOfOption{ + client.InNamespace(request.NamespacedName.Namespace), + client.MatchingLabels{"app", request.NamespacedName.Name}, + client.MatchingFields{"status.phase": "Failed"}, + client.GracePeriodSeconds(5), + } + ctx := context.TODO() + err := r.client.DeleteAllOf(ctx, pod, opts...) + + ... +} +``` + +[deleteallof-opts]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#DeleteAllOfOptions + ### Example usage ```Go @@ -418,9 +486,11 @@ func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, e // Update the App status with the pod names. // List the pods for this app's deployment. podList := &corev1.PodList{} - labelSelector := labels.SelectorFromSet(labelsForApp(app.Name)) - listOps := &client.ListOptions{Namespace: app.Namespace, LabelSelector: labelSelector} - if err = r.client.List(context.TODO(), podList, client.UseListOptions(listOps)); err != nil { + listOpts := []client.ListOption{ + client.InNamespace(app.Namespace), + client.MatchingLabels(labelsForApp(app.Name)), + } + if err = r.client.List(context.TODO(), podList, listOpts...); err != nil { return reconcile.Result{}, err } diff --git a/example/memcached-operator/memcached_controller.go.tmpl b/example/memcached-operator/memcached_controller.go.tmpl index 3e14f0704c..a2e3495962 100644 --- a/example/memcached-operator/memcached_controller.go.tmpl +++ b/example/memcached-operator/memcached_controller.go.tmpl @@ -10,7 +10,6 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" @@ -142,10 +141,11 @@ func (r *ReconcileMemcached) Reconcile(request reconcile.Request) (reconcile.Res // Update the Memcached status with the pod names // List the pods for this memcached's deployment podList := &corev1.PodList{} - labelSelector := labels.SelectorFromSet(labelsForMemcached(memcached.Name)) - listOps := &client.ListOptions{Namespace: memcached.Namespace, LabelSelector: labelSelector} - err = r.client.List(context.TODO(), podList, client.UseListOptions(listOps)) - if err != nil { + listOpts := []client.ListOption{ + client.InNamespace(memcached.Namespace), + client.MatchingLabels(labelsForMemcached(memcached.Name)), + } + if err = r.client.List(context.TODO(), podList, listOpts...); err != nil { reqLogger.Error(err, "Failed to list pods", "Memcached.Namespace", memcached.Namespace, "Memcached.Name", memcached.Name) return reconcile.Result{}, err } diff --git a/go.mod b/go.mod index a66384a72c..4c954230c7 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.12 require ( cloud.google.com/go v0.37.2 // indirect - contrib.go.opencensus.io/exporter/ocagent v0.4.11 // indirect + contrib.go.opencensus.io/exporter/ocagent v0.4.12 // indirect github.com/Azure/go-autorest v11.7.0+incompatible // indirect github.com/DATA-DOG/go-sqlmock v1.3.3 // indirect github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e // indirect @@ -27,6 +27,7 @@ require ( github.com/go-logr/logr v0.1.0 github.com/go-logr/zapr v0.1.1 github.com/go-openapi/swag v0.19.0 // indirect + github.com/go-sql-driver/mysql v1.4.1 // indirect github.com/gobuffalo/packr v1.30.1 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/google/uuid v1.1.1 // indirect @@ -50,9 +51,7 @@ require ( github.com/pelletier/go-toml v1.3.0 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pkg/errors v0.8.1 - github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829 - github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect - github.com/prometheus/procfs v0.0.0-20190403104016-ea9eea638872 // indirect + github.com/prometheus/client_golang v0.9.3 github.com/rogpeppe/go-internal v1.3.0 github.com/rubenv/sql-migrate v0.0.0-20190618074426-f4d34eae5a5c // indirect github.com/sergi/go-diff v1.0.0 @@ -72,6 +71,7 @@ require ( go.uber.org/zap v1.10.0 golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a // indirect golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c + google.golang.org/api v0.3.2 // indirect google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107 // indirect gopkg.in/gorp.v1 v1.7.2 // indirect gopkg.in/square/go-jose.v2 v2.3.0 // indirect @@ -89,7 +89,7 @@ require ( k8s.io/kube-openapi v0.0.0-20190401085232-94e1e7b7574c k8s.io/kube-state-metrics v1.6.0 k8s.io/kubernetes v1.14.2 - sigs.k8s.io/controller-runtime v0.2.0-beta.3 + sigs.k8s.io/controller-runtime v0.2.0 sigs.k8s.io/controller-tools v0.2.0 sigs.k8s.io/kustomize v2.0.3+incompatible // indirect vbom.ml/util v0.0.0-20180919145318-efcd4e0f9787 // indirect @@ -114,5 +114,4 @@ replace ( github.com/operator-framework/operator-lifecycle-manager => github.com/operator-framework/operator-lifecycle-manager v0.0.0-20190605231540-b8a4faf68e36 k8s.io/helm => k8s.io/helm v2.14.1+incompatible k8s.io/kube-state-metrics => k8s.io/kube-state-metrics v1.6.0 - sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.2.0-beta.3 ) diff --git a/go.sum b/go.sum index c443729b42..88b20ef681 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.37.2 h1:4y4L7BdHenTfZL0HervofNTHh9Ad6mNX72cQvl+5eH0= cloud.google.com/go v0.37.2/go.mod h1:H8IAquKe2L30IxoupDgqTaQvKSwF/c8prYHynGIWQbA= -contrib.go.opencensus.io/exporter/ocagent v0.4.11 h1:Zwy9skaqR2igcEfSVYDuAsbpa33N0RPtnYTHEe2whPI= -contrib.go.opencensus.io/exporter/ocagent v0.4.11/go.mod h1:7ihiYRbdcVfW4m4wlXi9WRPdv79C0fStcjNlyE6ek9s= +contrib.go.opencensus.io/exporter/ocagent v0.4.12 h1:jGFvw3l57ViIVEPKKEUXPcLYIXJmQxLUh6ey1eJhwyc= +contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= git.apache.org/thrift.git v0.12.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= @@ -28,6 +28,7 @@ github.com/Masterminds/sprig v0.0.0-20190301161902-9f8fceff796f h1:lGvI8+dm9Y/Qr github.com/Masterminds/sprig v0.0.0-20190301161902-9f8fceff796f/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/NYTimes/gziphandler v1.0.1/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= @@ -45,12 +46,15 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/census-instrumentation/opencensus-proto v0.2.0 h1:LzQXZOgg4CQfE6bFvXGM30YZL1WW/M337pXml+GrcZ4= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/chai2010/gettext-go v0.0.0-20170215093142-bf70f2a70fb1 h1:HD4PLRzjuCVW79mQ0/pdsalOLHJ+FaEoqJLxfltpb2U= github.com/chai2010/gettext-go v0.0.0-20170215093142-bf70f2a70fb1/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -80,6 +84,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/dgrijalva/jwt-go v0.0.0-20160705203006-01aeca54ebda/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v0.7.3-0.20190409004836-2e1cfbca03da h1:9ouQ6UxUR99krN1mfiQP+ygP5mS9YSioeyXD01WcwLA= @@ -118,6 +123,7 @@ github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0 github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v0.1.0 h1:M1Tv3VzNlEHg6uyACnRdtrploV2P7wZqH8BoQMtz0cg= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= @@ -154,6 +160,8 @@ github.com/go-openapi/swag v0.19.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/ github.com/go-openapi/validate v0.17.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gobuffalo/envy v1.6.5/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU= @@ -320,6 +328,7 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -364,20 +373,26 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829 h1:D+CiwcpGTW6pL6bv6KI3KbyEyCKyS+1JWS2h8PNDnGA= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0 h1:kUZDBDTdBVBYBj5Tmh2NZLlF60mfjA27rM34b+cVwNU= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190403104016-ea9eea638872 h1:0aNv3xC7DmQoy1/x1sMh18g+fihWW68LL13i8ao9kl4= -github.com/prometheus/procfs v0.0.0-20190403104016-ea9eea638872/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/robfig/cron v0.0.0-20170526150127-736158dc09e1/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -398,6 +413,7 @@ github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4 github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= @@ -443,8 +459,9 @@ go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.19.1/go.mod h1:gug0GbSHa8Pafr0d2urOSgoXHZ6x/RUlaiT0d9pqb4A= go.opencensus.io v0.19.2/go.mod h1:NO/8qkisMZLZ1FCsKNqtJPwc8/TaclWyY0B6wcYNg9M= -go.opencensus.io v0.20.0 h1:L/ARO58pdktB6dLmYI0zAyW1XnavEmGziFd0MKfxnck= -go.opencensus.io v0.20.0/go.mod h1:NO/8qkisMZLZ1FCsKNqtJPwc8/TaclWyY0B6wcYNg9M= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2 h1:NAfh7zF0/3/HqtMvJNZ/RFrSlCE6ZTlHmKfhL/Dm1Jk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -549,14 +566,17 @@ golang.org/x/tools v0.0.0-20190320215829-36c10c0a621f/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190501045030-23463209683d/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c h1:KfpJVdWhuRqNk4XVXzjXf2KAV4TBEP77SYdFGjeGuIE= golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -gomodules.xyz/jsonpatch/v2 v2.0.0 h1:lHNQverf0+Gm1TbSbVIDWVXOhZ2FpZopxRqpr2uIjs4= -gomodules.xyz/jsonpatch/v2 v2.0.0/go.mod h1:IhYNNY4jnS53ZnfE4PAmpKtDpTCj1JFXc+3mwe7XcUU= +gomodules.xyz/jsonpatch/v2 v2.0.1 h1:xyiBuvkD2g5n7cYzx6u2sxQvsAy4QJsZFCzGVdzOXZ0= +gomodules.xyz/jsonpatch/v2 v2.0.1/go.mod h1:IhYNNY4jnS53ZnfE4PAmpKtDpTCj1JFXc+3mwe7XcUU= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.2.0/go.mod h1:IfRCZScioGtypHNTlz3gFk67J8uePVW7uDTBzXuIkhU= google.golang.org/api v0.3.0 h1:UIJY20OEo3+tK5MBlcdx37kmdH6EnRjGkW78mc6+EeA= google.golang.org/api v0.3.0/go.mod h1:IuvZyQh8jgscv8qWfQ4ABd8m7hEudgBFM/EdhA3BnXw= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.3.2 h1:iTp+3yyl/KOtxa/d1/JUE0GGSoR6FuW5udver22iwpw= +google.golang.org/api v0.3.2/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -641,8 +661,9 @@ k8s.io/kubernetes v1.14.1/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0= k8s.io/utils v0.0.0-20190506122338-8fab8cb257d5 h1:VBM/0P5TWxwk+Nw6Z+lAw3DKgO76g90ETOiA6rfLV1Y= k8s.io/utils v0.0.0-20190506122338-8fab8cb257d5/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= -sigs.k8s.io/controller-runtime v0.2.0-beta.3 h1:K3dddu6/pOVORH2dBOnEbXif6R80oSDa4y/t1jhoh8s= -sigs.k8s.io/controller-runtime v0.2.0-beta.3/go.mod h1:HweyYKQ8fBuzdu2bdaeBJvsFgAi/OqBBnrVGXcqKhME= +sigs.k8s.io/controller-runtime v0.1.10/go.mod h1:HFAYoOh6XMV+jKF1UjFwrknPbowfyHEHHRdJMf2jMX8= +sigs.k8s.io/controller-runtime v0.2.0 h1:5gL30PXOisGZl+Osi4CmLhvMUj77BO3wJeouKF2va50= +sigs.k8s.io/controller-runtime v0.2.0/go.mod h1:ZHqrRDZi3f6BzONcvlUxkqCKgwasGk5FZrnSv9TVZF4= sigs.k8s.io/controller-tools v0.2.0 h1:AmQ/0JKBJAjyAiPAkrAf9QW06jkx2lc5hpxMjamsFpw= sigs.k8s.io/controller-tools v0.2.0/go.mod h1:8t/X+FVWvk6TaBcsa+UKUBbn7GMtvyBKX30SGl4em6Y= sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0= diff --git a/internal/pkg/scaffold/ansible/go_mod.go b/internal/pkg/scaffold/ansible/go_mod.go index fec2bc304d..4f6a4104e2 100644 --- a/internal/pkg/scaffold/ansible/go_mod.go +++ b/internal/pkg/scaffold/ansible/go_mod.go @@ -40,16 +40,11 @@ const goModTmpl = `module {{ .Repo }} require ( github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect - github.com/google/go-cmp v0.3.0 // indirect - github.com/onsi/ginkgo v1.8.0 // indirect - github.com/onsi/gomega v1.5.0 // indirect github.com/operator-framework/operator-sdk master github.com/spf13/pflag v1.0.3 - golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09 // indirect - golang.org/x/text v0.3.2 // indirect k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 // indirect - sigs.k8s.io/controller-runtime v0.2.0-beta.3 + sigs.k8s.io/controller-runtime v0.2.0 ) // Pinned to kubernetes-1.14.1 diff --git a/internal/pkg/scaffold/ansible/gopkgtoml.go b/internal/pkg/scaffold/ansible/gopkgtoml.go index 11ba07d5ad..abe87cd14d 100644 --- a/internal/pkg/scaffold/ansible/gopkgtoml.go +++ b/internal/pkg/scaffold/ansible/gopkgtoml.go @@ -52,6 +52,10 @@ const gopkgTomlTmpl = `[[constraint]] name = "k8s.io/client-go" version = "kubernetes-1.14.1" +[[override]] + name = "sigs.k8s.io/controller-runtime" + version = "=v0.2.0" + [prune] go-tests = true unused-packages = true diff --git a/internal/pkg/scaffold/go_mod.go b/internal/pkg/scaffold/go_mod.go index 8fb192115f..0f29be8935 100644 --- a/internal/pkg/scaffold/go_mod.go +++ b/internal/pkg/scaffold/go_mod.go @@ -45,7 +45,7 @@ require ( k8s.io/apimachinery v0.0.0-20190612125636-6a5db36e93ad k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 // indirect - sigs.k8s.io/controller-runtime v0.2.0-beta.3 + sigs.k8s.io/controller-runtime v0.2.0 ) // Pinned to kubernetes-1.14.1 @@ -59,7 +59,6 @@ replace ( replace ( github.com/coreos/prometheus-operator => github.com/coreos/prometheus-operator v0.31.1 - sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.2.0-beta.3 // Pinned to v2.10.0 (kubernetes-1.14.1) so https://proxy.golang.org can // resolve it correctly. github.com/prometheus/prometheus => github.com/prometheus/prometheus d20e84d0fb64aff2f62a977adc8cfb656da4e286 diff --git a/internal/pkg/scaffold/gopkgtoml.go b/internal/pkg/scaffold/gopkgtoml.go index af689353b2..5a1e1f2fcd 100644 --- a/internal/pkg/scaffold/gopkgtoml.go +++ b/internal/pkg/scaffold/gopkgtoml.go @@ -64,7 +64,7 @@ const gopkgTomlTmpl = `[[override]] [[override]] name = "sigs.k8s.io/controller-runtime" - version = "=v0.2.0-beta.3" + version = "=v0.2.0" # Required when resolving controller-runtime dependencies. [[override]] diff --git a/internal/pkg/scaffold/helm/go_mod.go b/internal/pkg/scaffold/helm/go_mod.go index 32ae680a73..76604ca520 100644 --- a/internal/pkg/scaffold/helm/go_mod.go +++ b/internal/pkg/scaffold/helm/go_mod.go @@ -46,7 +46,6 @@ require ( github.com/emicklei/go-restful v2.9.3+incompatible // indirect github.com/go-openapi/spec v0.19.0 // indirect github.com/google/btree v1.0.0 // indirect - github.com/google/go-cmp v0.3.0 // indirect github.com/gorilla/websocket v1.4.0 // indirect github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect @@ -54,12 +53,9 @@ require ( github.com/imdario/mergo v0.3.7 // indirect github.com/jonboulle/clockwork v0.1.0 // indirect github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect - github.com/onsi/ginkgo v1.8.0 // indirect - github.com/onsi/gomega v1.5.0 // indirect github.com/operator-framework/operator-sdk master github.com/spf13/pflag v1.0.3 github.com/ugorji/go/codec v0.0.0-20190320090025-2dc34c0b8780 // indirect - golang.org/x/text v0.3.2 // indirect golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect google.golang.org/appengine v1.5.0 // indirect gotest.tools v2.2.0+incompatible // indirect @@ -67,7 +63,7 @@ require ( k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible k8s.io/helm v2.14.1+incompatible // indirect k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 // indirect - sigs.k8s.io/controller-runtime v0.2.0-beta.3 + sigs.k8s.io/controller-runtime v0.2.0 ) // Pinned to kubernetes-1.14.1 diff --git a/internal/pkg/scaffold/helm/gopkgtoml.go b/internal/pkg/scaffold/helm/gopkgtoml.go index fc8cda54d1..0ce6eb95c0 100644 --- a/internal/pkg/scaffold/helm/gopkgtoml.go +++ b/internal/pkg/scaffold/helm/gopkgtoml.go @@ -64,6 +64,10 @@ const gopkgTomlTmpl = `[[constraint]] name = "k8s.io/cli-runtime" version = "kubernetes-1.14.1" +[[override]] + name = "sigs.k8s.io/controller-runtime" + version = "=v0.2.0" + # We need overrides for the following imports because dep can't resolve them # correctly. The easiest way to get this right is to use the versions that # k8s.io/helm uses. See https://github.com/helm/helm/blob/v2.14.1/glide.lock diff --git a/internal/util/k8sutil/options.go b/internal/util/k8sutil/options.go new file mode 100644 index 0000000000..5866205510 --- /dev/null +++ b/internal/util/k8sutil/options.go @@ -0,0 +1,43 @@ +// Copyright 2019 The Operator-SDK 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. + +package k8sutil + +import ( + "k8s.io/apimachinery/pkg/fields" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// NOTE: use controller-runtime's version of MatchingFields if the following +// issue is accepted as a feature: +// https://github.com/kubernetes-sigs/controller-runtime/issues/576 + +// MatchingFields implements the client.ListOption and client.DeleteAllOfOption +// interfaces so fields.Selector can be used directly in client.List and +// client.DeleteAllOf. +type MatchingFields struct { + Sel fields.Selector +} + +var _ client.ListOption = MatchingFields{} + +func (m MatchingFields) ApplyToList(opts *client.ListOptions) { + opts.FieldSelector = m.Sel +} + +var _ client.DeleteAllOfOption = MatchingFields{} + +func (m MatchingFields) ApplyToDeleteAllOf(opts *client.DeleteAllOfOptions) { + opts.FieldSelector = m.Sel +} diff --git a/pkg/ansible/proxy/cache_response.go b/pkg/ansible/proxy/cache_response.go index 3dbdca1a48..d181f29958 100644 --- a/pkg/ansible/proxy/cache_response.go +++ b/pkg/ansible/proxy/cache_response.go @@ -22,14 +22,18 @@ import ( "net/http" "strings" + "github.com/operator-framework/operator-sdk/internal/util/k8sutil" "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/controllermap" "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/requestfactory" k8sRequest "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/requestfactory" osdkHandler "github.com/operator-framework/operator-sdk/pkg/handler" + "k8s.io/apimachinery/pkg/api/meta" metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/sets" "sigs.k8s.io/controller-runtime/pkg/cache" @@ -199,22 +203,29 @@ func (c *cacheResponseHandler) getListFromCache(r *requestfactory.RequestInfo, r log.Error(err, "Unable to decode list options from request") return nil, err } - clientListOpts := &client.ListOptions{} - clientListOpts.InNamespace(r.Namespace) - if err := clientListOpts.SetLabelSelector(k8sListOpts.LabelSelector); err != nil { - log.Error(err, "Unable to set label selectors for the client") - return nil, err + clientListOpts := []client.ListOption{ + client.InNamespace(r.Namespace), + } + if k8sListOpts.LabelSelector != "" { + sel, err := labels.ConvertSelectorToLabelsMap(k8sListOpts.LabelSelector) + if err != nil { + log.Error(err, "Unable to convert label selectors for the client") + return nil, err + } + clientListOpts = append(clientListOpts, client.MatchingLabels(sel)) } if k8sListOpts.FieldSelector != "" { - if err := clientListOpts.SetFieldSelector(k8sListOpts.FieldSelector); err != nil { - log.Error(err, "Unable to set field selectors for the client") + sel, err := fields.ParseSelector(k8sListOpts.FieldSelector) + if err != nil { + log.Error(err, "Unable to parse field selectors for the client") return nil, err } + clientListOpts = append(clientListOpts, k8sutil.MatchingFields{Sel: sel}) } k.Kind = k.Kind + "List" un := unstructured.UnstructuredList{} un.SetGroupVersionKind(k) - err := c.informerCache.List(context.Background(), &un, client.UseListOptions(clientListOpts)) + err := c.informerCache.List(context.Background(), &un, clientListOpts...) if err != nil { // break here in case resource doesn't exist in cache but exists on APIserver // This is very unlikely but provides user with expected 404 diff --git a/pkg/test/client.go b/pkg/test/client.go index f02acd8899..89d6f3af47 100644 --- a/pkg/test/client.go +++ b/pkg/test/client.go @@ -32,9 +32,9 @@ var _ FrameworkClient = &frameworkClient{} type FrameworkClient interface { Get(gCtx goctx.Context, key dynclient.ObjectKey, obj runtime.Object) error - List(gCtx goctx.Context, list runtime.Object, opts ...dynclient.ListOptionFunc) error + List(gCtx goctx.Context, list runtime.Object, opts ...dynclient.ListOption) error Create(gCtx goctx.Context, obj runtime.Object, cleanupOptions *CleanupOptions) error - Delete(gCtx goctx.Context, obj runtime.Object, opts ...dynclient.DeleteOptionFunc) error + Delete(gCtx goctx.Context, obj runtime.Object, opts ...dynclient.DeleteOption) error Update(gCtx goctx.Context, obj runtime.Object) error } @@ -93,11 +93,11 @@ func (f *frameworkClient) Get(gCtx goctx.Context, key dynclient.ObjectKey, obj r return f.Client.Get(gCtx, key, obj) } -func (f *frameworkClient) List(gCtx goctx.Context, list runtime.Object, opts ...dynclient.ListOptionFunc) error { +func (f *frameworkClient) List(gCtx goctx.Context, list runtime.Object, opts ...dynclient.ListOption) error { return f.Client.List(gCtx, list, opts...) } -func (f *frameworkClient) Delete(gCtx goctx.Context, obj runtime.Object, opts ...dynclient.DeleteOptionFunc) error { +func (f *frameworkClient) Delete(gCtx goctx.Context, obj runtime.Object, opts ...dynclient.DeleteOption) error { return f.Client.Delete(gCtx, obj, opts...) } diff --git a/test/e2e/_incluster-test-code/memcached_test.go b/test/e2e/_incluster-test-code/memcached_test.go index 6e2e18dc14..a7b3bea325 100644 --- a/test/e2e/_incluster-test-code/memcached_test.go +++ b/test/e2e/_incluster-test-code/memcached_test.go @@ -138,11 +138,12 @@ func verifyLeader(t *testing.T, namespace string, f *framework.Framework, labels // get operator pods pods := &v1.PodList{} - opts := &client.ListOptions{} - opts.InNamespace(namespace) - opts.MatchingLabels(labels) - opts.MatchingField("status.phase", "Running") - err = f.Client.List(goctx.TODO(), pods, client.UseListOptions(opts)) + opts := []client.ListOption{ + client.InNamespace(namespace), + client.MatchingLabels(labels), + client.MatchingFields{"status.phase": "Running"}, + } + err = f.Client.List(goctx.TODO(), pods, opts...) if err != nil { return nil, err } @@ -421,11 +422,12 @@ func memcachedOperatorMetricsTest(t *testing.T, f *framework.Framework, ctx *fra func getMetrics(t *testing.T, f *framework.Framework, labels map[string]string, ns, port string) ([]byte, error) { // Get operator pod pods := &v1.PodList{} - opts := &client.ListOptions{} - opts.InNamespace(ns) - opts.MatchingLabels(labels) - opts.MatchingField("status.phase", "Running") - err := f.Client.List(goctx.TODO(), pods, client.UseListOptions(opts)) + opts := []client.ListOption{ + client.InNamespace(ns), + client.MatchingLabels(labels), + client.MatchingFields{"status.phase": "Running"}, + } + err := f.Client.List(goctx.TODO(), pods, opts...) if err != nil { return nil, fmt.Errorf("failed to get pods: (%v)", err) } diff --git a/test/test-framework/pkg/controller/memcached/memcached_controller.go b/test/test-framework/pkg/controller/memcached/memcached_controller.go index 59256dfe9e..840bd29b7d 100644 --- a/test/test-framework/pkg/controller/memcached/memcached_controller.go +++ b/test/test-framework/pkg/controller/memcached/memcached_controller.go @@ -150,10 +150,11 @@ func (r *ReconcileMemcached) Reconcile(request reconcile.Request) (reconcile.Res // Update the Memcached status with the pod names // List the pods for this memcached's deployment podList := &corev1.PodList{} - listOps := &client.ListOptions{} - listOps.InNamespace(memcached.Namespace) - listOps.MatchingLabels(labelsForMemcached(memcached.Name)) - err = r.client.List(context.TODO(), podList, client.UseListOptions(listOps)) + listOpts := []client.ListOption{ + client.InNamespace(memcached.Namespace), + client.MatchingLabels(labelsForMemcached(memcached.Name)), + } + err = r.client.List(context.TODO(), podList, listOpts...) if err != nil { reqLogger.Error(err, "Failed to list pods.", "Memcached.Namespace", memcached.Namespace, "Memcached.Name", memcached.Name) return reconcile.Result{}, err diff --git a/test/test-framework/pkg/controller/memcachedrs/memcachedrs_controller.go b/test/test-framework/pkg/controller/memcachedrs/memcachedrs_controller.go index 5b2edf2fd8..89b53a3a78 100644 --- a/test/test-framework/pkg/controller/memcachedrs/memcachedrs_controller.go +++ b/test/test-framework/pkg/controller/memcachedrs/memcachedrs_controller.go @@ -152,10 +152,11 @@ func (r *ReconcileMemcachedRS) Reconcile(request reconcile.Request) (reconcile.R // Update the Memcached status with the pod names // List the pods for this memcached's replicaSet podList := &corev1.PodList{} - listOps := &client.ListOptions{} - listOps.InNamespace(memcachedrs.Namespace) - listOps.MatchingLabels(labelsForMemcached(memcachedrs.Name)) - err = r.client.List(context.TODO(), podList, client.UseListOptions(listOps)) + listOpts := []client.ListOption{ + client.InNamespace(memcachedrs.Namespace), + client.MatchingLabels(labelsForMemcached(memcachedrs.Name)), + } + err = r.client.List(context.TODO(), podList, listOpts...) if err != nil { reqLogger.Error(err, "Failed to list pods", "Memcached.Namespace", memcachedrs.Namespace, "Memcached.Name", memcachedrs.Name) return reconcile.Result{}, err