Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use go modules, update controller-{runtime, tools} to v2 #1054

Merged

Conversation

vincepri
Copy link
Member

@vincepri vincepri commented Jun 21, 2019

Signed-off-by: Vince Prignano vincepri@vmware.com

What this PR does / why we need it:

  • Upgrades controller-runtime to v0.2.0-beta.2.
  • Upgrades controller-tools to v0.2.0-beta.2.
  • Upgrades CI fetchtools Kubebuilder to 1.14.1 release.
  • Removes dep, Gopkg.lock, and Gopkg.toml.
  • Overhauls Makefile to use new controller-tools utilities.
  • Adds hack/tools.go file to force-vendor utilities.
  • Adds hack/ensure-go.sh to check and setup Go for modules.
  • Removes - from controller names (e.g. machine-controller -> machine_controller).
  • Updates integration tests to use kubectl@1.14.1 and kind@0.3.0.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1025

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:


@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 21, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 21, 2019
Copy link
Contributor

@akutz akutz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @vincepri,

I need more time to review this, but I did have two initial comments. One is in the code, and the other is this -- is it necessary to tie Go modules to the changes for v2? I see a lot of code changes that appear unrelated to modules.

hack/update-vendor.sh Outdated Show resolved Hide resolved
@vincepri
Copy link
Member Author

vincepri commented Jun 21, 2019

Current blockers:

  • CI images have an outdated version of Go (<1.12.1) PR.
  • Failing tests on Update.Status (details here)

Non blocking issues:

  • RBAC tags have to be placed at the top of the file, without any code around it to work.
  • RBAC RoleBinding isn't generated from KubeBuilder/controller-tools anymore.

@vincepri vincepri force-pushed the controller-runtime-tools-modules branch from 0583f26 to 6f870ec Compare June 21, 2019 15:26
@vincepri
Copy link
Member Author

/test pull-cluster-api-build

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 21, 2019
@vincepri vincepri force-pushed the controller-runtime-tools-modules branch from 6f870ec to e638a83 Compare June 21, 2019 17:16
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 21, 2019
@vincepri vincepri force-pushed the controller-runtime-tools-modules branch 6 times, most recently from b20e6cf to 9f7d9c9 Compare June 21, 2019 18:43
@vincepri
Copy link
Member Author

/hold

Currently waiting for directions on how to handle the ObjectMeta embedding issue from @DirectXMan12 and others. We can decide to merge this as it is with the fork to temporarily unblock v1alpha2 progress or wait if the timeframe to fix it in controller-tools works.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 24, 2019
@vincepri vincepri force-pushed the controller-runtime-tools-modules branch from 5270eec to eac35da Compare June 24, 2019 19:45
@vincepri
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 24, 2019
@vincepri
Copy link
Member Author

/assign @ncdc

@ncdc
Copy link
Contributor

ncdc commented Jun 24, 2019

I have at least 1 pending review comment that will need fixing before we merge, but I'm still making my way through the diffs. Until I get that submitted:

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 24, 2019
@vincepri vincepri force-pushed the controller-runtime-tools-modules branch from eac35da to 2527418 Compare June 24, 2019 20:14
hack/pin-dependency.sh Outdated Show resolved Hide resolved
pkg/controller/cluster/cluster_controller.go Show resolved Hide resolved
Signed-off-by: Vince Prignano <vincepri@vmware.com>
@vincepri vincepri force-pushed the controller-runtime-tools-modules branch from 2527418 to cd23cbd Compare June 24, 2019 20:25
@ncdc
Copy link
Contributor

ncdc commented Jun 24, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 24, 2019
@ncdc
Copy link
Contributor

ncdc commented Jun 24, 2019

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 24, 2019
@k8s-ci-robot k8s-ci-robot merged commit 82c49a9 into kubernetes-sigs:master Jun 24, 2019
Copy link
Member

@detiber detiber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Late to the party, but a few things stood out to me when taking a look.

@@ -25,7 +25,7 @@ Global Flags:
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
--logtostderr log to standard error instead of files (default true)
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an odd diff here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked with a master build of clusterctl and it seems that's just how the help is printed out

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, this seems broken

`kubebuilder` to create an example provider. For more information on `kubebuilder`
and CRDs in general we highly recommend reading the [Kubebuilder Book][kubebuilder-book].
Much of the information here was adapted directly from it. The minimal version of
`kubebuilder` required is [`v1.0.5`][kubebuilder-1.0.5].
`kubebuilder` required is [`v2.0.0`][kubebuilder-2.0.0].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect there will be more changes needed to the book to accommodate this change, should have an issue to track that work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #1075

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Code generated by client-gen. DO NOT EDIT.
// Code generated by main. DO NOT EDIT.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big ugly, is this because it is run using go run now instead of compiling and running the binary?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

// +kubebuilder:rbac:groups=cluster.k8s.io,resources=clusters,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=cluster.k8s.io,resources=machines;machines/status,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=cluster.k8s.io,resources=machinedeployments;machinedeployments/status,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=cluster.k8s.io,resources=machinesets;machinesets/status,verbs=get;list;watch;create;update;patch;delete
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the annotations no longer supported closer to where there are required?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't work if defined elsewhere, that's why I moved them in here

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they should work anywhere in the packages that controller-gen is told to read, as long at they're not in, say, the Godoc for a function or something.

@@ -43,7 +43,7 @@ func ValidateClusterAPIObjects(ctx context.Context, w io.Writer, c client.Client
}

machines := &clusterv1alpha1.MachineList{}
if err := c.List(ctx, client.InNamespace(namespace), machines); err != nil {
if err := c.List(ctx, machines, client.InNamespace(namespace)); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What caused the ordering to change here? Is it just related to the updated client generation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's from a controller-runtime change to the method signature

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we changed the method signature to be in line with other methods and to support easier option passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update controller-runtime
6 participants