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

No kubebuilder #66

Merged
merged 2 commits into from
Sep 26, 2018
Merged

No kubebuilder #66

merged 2 commits into from
Sep 26, 2018

Conversation

aaron-prindle
Copy link
Contributor

This PR removes the kubebuilder dependency and framework from knative/build-pipeline, opting to instead use the hack/update-codegen.sh scripts approach to generating CRD libraries. The controller and directory structure were also updated to more closely mirror knative/build. Resource was temporarily renamed StandardResource as it collided with a method Register in pkg/apis/pipeline/v1alpha1/register.go.

@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 25, 2018
Copy link
Member

@nader-ziada nader-ziada left a comment

Choose a reason for hiding this comment

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

I understand this is a work in progress, but wanted to comment to the parts I saw that we part of build and I don't think should not be here

# Next, make sure that you have no builds or build templates in your current namespace:
kubectl delete builds --all
kubectl delete buildtemplates --all
kubectl delete clusterbuildtemplates --all

Copy link
Member

@nader-ziada nader-ziada Sep 25, 2018

Choose a reason for hiding this comment

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

  • This cleanup of builds, buildtemplates and clusterbuildtemplates is not applicable here, should be cleaning up pipeline things


To make changes to these CRDs, you will probably interact with:
```
Copy link
Member

@nader-ziada nader-ziada Sep 25, 2018

Choose a reason for hiding this comment

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

  • The way the build tests run might not be applicable here

README.md Outdated
@@ -1,142 +1,51 @@
# Pipeline CRD
# Knative build

Copy link
Member

@nader-ziada nader-ziada Sep 25, 2018

Choose a reason for hiding this comment

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

  • should be build-pipeline

README.md Outdated
1. Visit the [How to contribute](./CONTRIBUTING.md) page for information about
Copy link
Member

@nader-ziada nader-ziada Sep 25, 2018

Choose a reason for hiding this comment

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

  • all this readme is about build, we need the one about build-pipeline that already existed

logger = logger.With(zap.String(logkey.ControllerType, logLevelKey))

logger.Info("Starting the Build Controller")

Copy link
Member

@nader-ziada nader-ziada Sep 25, 2018

Choose a reason for hiding this comment

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

  • I'm guessing this should be pipeline controller

Copy link
Member

Choose a reason for hiding this comment

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

The Build controller is actually a bit old-fashioned in Knative terms, and doesn't use some of the new best practices available in knative/pkg, like the reconciler and webhook validation stuff. It might be better to base pipelines' controller on serving or eventing, until build can get updated to the latest-and-greatest.

Copy link
Member

Choose a reason for hiding this comment

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

For a super skeletal example to start from using the knative/pkg goodies check out https://github.com/mattmoor/warm-image.

This doesn't leverage things like the webhook (which Build hasn't yet adopted), but it shows the Reconciler bits.

Copy link
Member

Choose a reason for hiding this comment

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

There are a skeleton implementation in build but its not fully completed yet. Serving is a better example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to leave this as is for now and refactor to using the new controller interfaces/libs in another PR

Copy link
Member

@nader-ziada nader-ziada Sep 26, 2018

Choose a reason for hiding this comment

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

isn't the point of this PR to refactor the controllers interfaces libs to the new style? Just that it will be harder to refactor when other work gets added to this structure

Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't the point of this PR to refactor the controllers interfaces libs to the new style?

This particular PR is about removing kubebuilder, but I agree that we want the controller code to settle in the style we want to continue with. Since this PR is so huge, I think we should go ahead with it as-is, then have a subsequent PR to update to the new style.

Hopefully I'm not underestimating the differences between this and the new style, but from what I can tell it seems like folks can go ahead and get unblocked if we merge this, then it's just a few changes to update to the latest.

(As part of updating to the latest I'd also like to write some docs about it b/c I haven't been able to find any.)

Copy link
Member

Choose a reason for hiding this comment

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

ok, I agree this PR is getting to big to follow, we can fix up whatever needs changes after.

defer logger.Sync()

builders := []credentials.Builder{dockercreds.NewBuilder(), gitcreds.NewBuilder()}
for _, c := range builders {
Copy link
Member

@nader-ziada nader-ziada Sep 25, 2018

Choose a reason for hiding this comment

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

  • builders is what the build project uses to execute the builds, I'm expecting it will be a little different here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed creds-init for now

cmd/logs/main.go Outdated
func main() {
flag.Parse()
if len(flag.Args()) != 1 {
log.Fatalf("Usage: %s [-n NAMESPACE] BUILD-NAME\n", os.Args[0])
Copy link
Member

Choose a reason for hiding this comment

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

Pipeline name instead of build name

Copy link
Member

Choose a reason for hiding this comment

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

Do we need the logs package at all for now? I'd prefer to add it only when/if we find a use for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed cmd/logs for now

# limitations under the License.
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
Copy link
Member

Choose a reason for hiding this comment

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

the build CRD should not be part of the build-pipeline project

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, I believe the idea is to have Tasks create builds from the buildSpec field in a Task. It is unclear if installing knative/build should be a dependency for knative/build-pipeline or we should import pieces of knative/build in knative/build-pipeline (build controller, etc.) and manage those pieces that way. I am open to either. Currently, the build CRD is in config/ as the installation method is ko apply -f config and Build CRD is a dependency for the Task CRD.

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better as a dependency, similar to what serving has. This way we would have less duplication and can easily pick up changes in the build project

Copy link
Contributor Author

@aaron-prindle aaron-prindle Sep 26, 2018

Choose a reason for hiding this comment

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

knative/build is now a requirement to install knative/build-pipeline, removed related yamls and controllers from knative/build-pipeline

# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
Copy link
Member

@nader-ziada nader-ziada Sep 25, 2018

Choose a reason for hiding this comment

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

  • the buildTemplate CRD should not be part of the build-pipeline project

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: clusterbuildtemplates.pipeline.knative.dev
Copy link
Member

@nader-ziada nader-ziada Sep 25, 2018

Choose a reason for hiding this comment

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

  • the clusterBuildTemplate CRD should not be part of the build-pipeline project

Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

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

When you're ready to go, plz make sure to update the commit message(s) to:

/me focusing on the important things first 😎

@bobcatfish
Copy link
Collaborator

Another request for the commit message: listing everything that existed in the kubebuilder based iteration that was removed and why (e.g. "existing tests had to be removed because X")

Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

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

I think a lot of this was covered by @pivotal-nader-ziada already but here's a list of the immediate things I've noticed:

  • This PR clobbers our existing:
    • issue-template.md
    • README.md
    • CONTRIBUTING.md
    • DEVELOPMENT.md - most of what got replaced here is great and super useful, but we lost some stuff from our existing file (e.g. getting started, where's the code) and gained some stuff that doesn't quite make sense (e.g. running the integration tests)
    • pkg/apis/pipeline/v1alpha1/resource_types.go is gone for some reason

It also removes all of our existing tests - is it possible to keep sanity_test.go (including the dependency on kubebuilder) around, or does that only work with the kubebuilder based controllers?

What is cover.out?

I think we should remove for now:

  • AUTHORS
  • config/*.yaml which duplicate types from knative/build that we don't use (e.g. 300-build, 300-build-template, i think there are probably more like imagecache, etc.)
  • cmd/creds-init, cmd/git-init (until we need them, maybe @pivotal-nader-ziada and @shashwathi will be re-adding these or have a different opinion)
  • cmd/logs - unless we need it? it's not clear to me waht this is

I'd like to get a review from someone like @imjasonh specifically of the contents of config/*.yaml, it's not 100% clear to me which of those we need (e.g. is everything in the cluster role required)

@bobcatfish
Copy link
Collaborator

I like how the controllers are empty of logic for now! I think that's a great starting place so we can unblock @pivotal-nader-ziada, @shashwathi and our other issues.

re. the better controller implementations that @imjasonh and @mattmoor mentioned we can work from (thanks for the pointer in the right direction!! ❤️ ), I suggest we go ahead and commit the controllers as we have them in this PR, then update them in the next PR (so we don't have to do too much in this PR, there's so much already). But feel free to disregard if you'd prefer @aaron-prindle

@tejal29
Copy link
Contributor

tejal29 commented Sep 25, 2018

👍 Looking forward for this!

@shashwathi
Copy link
Contributor

cmd/logs

That is used for tailing build logs. For now I would vote for removing this component and add the feature when we user requests it.

cmd/creds-init, cmd/git-init

Yes I vote for removing these as well. @pivotal-nader-ziada let me know if you feel otherwise.

git init & creds init leftovers

  • config/999-cache.yaml file
    Not to include git-init, creds-init
  • config/controller.yaml file
    Controller does not need init flags.

Updating docs

I will also echo everybody's thought on not adding this change.

@bobcatfish bobcatfish modified the milestone: Mid October Demo Sep 26, 2018
@bobcatfish
Copy link
Collaborator

I think this is almost there! I'm making a few more tweaks.

aaron-prindle and others added 2 commits September 26, 2018 16:09
This PR removes the kubebuilder dependency and framework from knative/build-pipeline, opting to instead use the hack/update-codegen.sh scripts approach to generating CRD libraries. The controller and directory structure were also updated to more closely mirror knative/build.

Resource was temporarily renamed StandardResource as it collided with a method
Register in pkg/apis/pipeline/v1alpha1/register.go.

Currently tests are stubbed out since all of the existing tests were
kubebuilder specific - we'll have to add more!

Updates developer docs to include how to interact with this repo now
that we've switched styles.

Fixes #57
In our first iteration of the API, we were using `v1beta1` as the
version. We bumped this to `v1alpha1` while removing kubebuilder but
didn't update it everywhere.

Also removed extra references to git-init and creds-init (at the moment we
aren't building these from anything in this repo)

Co-authored-by: Tejal Desai <tejaldesai@google.com>
@bobcatfish
Copy link
Collaborator

Okay I think we are ready! drumroll

@bobcatfish
Copy link
Collaborator

/lgtm
/approve
/meow space

@knative-prow-robot
Copy link

@bobcatfish: cat image

In response to this:

/lgtm
/approve
/meow space

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 26, 2018
@knative-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aaron-prindle, bobcatfish

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 26, 2018
@knative-prow-robot knative-prow-robot merged commit 01853c6 into tektoncd:master Sep 26, 2018
@bobcatfish
Copy link
Collaborator

This has mostly addressed #57 , less the changes suggested by @mattmoor and @imjasonh

This was referenced Sep 27, 2018
vdemeester referenced this pull request in openshift/tektoncd-pipeline Apr 5, 2019
* Replace kubebuilder with knative/build style controllers

This PR removes the kubebuilder dependency and framework from knative/build-pipeline, opting to instead use the hack/update-codegen.sh scripts approach to generating CRD libraries. The controller and directory structure were also updated to more closely mirror knative/build.

Resource was temporarily renamed StandardResource as it collided with a method
Register in pkg/apis/pipeline/v1alpha1/register.go.

Currently tests are stubbed out since all of the existing tests were
kubebuilder specific - we'll have to add more!

Updates developer docs to include how to interact with this repo now
that we've switched styles.

Fixes #57

* Fix resource version

In our first iteration of the API, we were using `v1beta1` as the
version. We bumped this to `v1alpha1` while removing kubebuilder but
didn't update it everywhere.

Also removed extra references to git-init and creds-init (at the moment we
aren't building these from anything in this repo)

Co-authored-by: Tejal Desai <tejaldesai@google.com>
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. lgtm Indicates that a PR is ready to be merged. 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.

None yet

8 participants