-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
knative-prow-robot
merged 2 commits into
tektoncd:master
from
aaron-prindle:no-kubebuilder
Sep 26, 2018
Merged
No kubebuilder #66
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
Next
Next commit
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
- Loading branch information
commit 4752df0451e4ddf5154638dcc603fd581d1004b7
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# This file is documented at https://git-scm.com/docs/gitattributes. | ||
# Linguist-specific attributes are documented at | ||
# https://github.com/github/linguist. | ||
|
||
**/zz_generated.*.go linguist-generated=true | ||
/pkg/client/** linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,38 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
# Emacs garbage | ||
*~ | ||
|
||
# VSCode config | ||
.vscode | ||
|
||
# bin folder | ||
bin/ | ||
# JetBrains IDE config | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
baseImageOverrides: | ||
github.com/knative/build-pipeline/cmd/creds-init: gcr.io/knative-releases/build-base:latest | ||
github.com/knative/build-pipeline/cmd/git-init: gcr.io/knative-releases/build-base:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,37 @@ | |
1. Create [a GitHub account](https://github.com/join) | ||
1. Setup [GitHub access via | ||
SSH](https://help.github.com/articles/connecting-to-github-with-ssh/) | ||
1. [Create and checkout a repo fork](#checkout-your-fork) | ||
1. Set up your [shell environment](#environment-setup) | ||
1. Install [requirements](#requirements) | ||
1. [Set up a kubernetes cluster](https://github.com/knative/serving/blob/master/docs/creating-a-kubernetes-cluster.md) | ||
1. [Configure kubectl to use your cluster](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) | ||
1. [Set up a docker repository you can push to](https://github.com/knative/serving/blob/master/docs/setting-up-a-docker-registry.md) | ||
|
||
Then you can [iterate](#iterating) (including [runing the controllers with `ko`](#running-controllers)). | ||
|
||
### Checkout your fork | ||
|
||
The Go tools require that you clone the repository to the `src/github.com/knative/build-pipeline` directory | ||
in your [`GOPATH`](https://github.com/golang/go/wiki/SettingGOPATH). | ||
|
||
To check out this repository: | ||
|
||
1. Create your own [fork of this | ||
repo](https://help.github.com/articles/fork-a-repo/) | ||
1. Clone it to your machine: | ||
|
||
```shell | ||
mkdir -p ${GOPATH}/src/github.com/knative | ||
cd ${GOPATH}/src/github.com/knative | ||
git clone git@github.com:${YOUR_GITHUB_USERNAME}/build-pipeline.git | ||
cd build-pipeline | ||
git remote add upstream git@github.com:knative/build-pipeline.git | ||
git remote set-url --push upstream no_push | ||
``` | ||
|
||
_Adding the `upstream` remote sets you up nicely for regularly [syncing your | ||
fork](https://help.github.com/articles/syncing-a-fork/)._ | ||
|
||
### Requirements | ||
|
||
|
@@ -17,64 +45,66 @@ You must install these tools: | |
1. [`git`](https://help.github.com/articles/set-up-git/): For source control | ||
1. [`dep`](https://github.com/golang/dep): For managing external Go | ||
dependencies. | ||
1. [`ko`](https://github.com/google/go-containerregistry/tree/master/cmd/ko): For | ||
development. | ||
1. [`kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl/): For interacting with your kube cluster (also required for kubebuidler) | ||
1. [`kustomize`](https://github.com/kubernetes-sigs/kustomize): Required for kubebuilder | ||
1. [`kubebuilder`](https://book.kubebuilder.io/quick_start.html): For generating CRD related | ||
boilerplate (see [docs on iterating with kubebuilder](#installing-and-running)) - Note that | ||
the installation instructions default to `mac`, use the tabs at the top to switch to `linux` | ||
|
||
## Iterating | ||
## Environment Setup | ||
|
||
### Dependencies | ||
To [run your controllers with `ko`](#running-controllers) you'll need to set these environment | ||
variables (we recommend adding them to your `.bashrc`): | ||
|
||
This repo uses [`dep`](https://golang.github.io/dep/docs/daily-dep.html) for dependency management: | ||
1. `GOPATH`: If you don't have one, simply pick a directory and add `export GOPATH=...` | ||
1. `$GOPATH/bin` on `PATH`: This is so that tooling installed via `go get` will work properly. | ||
1. `KO_DOCKER_REPO`: The docker repository to which developer images should be pushed (e.g. `gcr.io/[gcloud-project]`). | ||
|
||
* Update the deps with `dep ensure -update` | ||
* `dep ensure` should be a no-op | ||
* Add a dep with `dep ensure -add $MY_DEP` | ||
`.bashrc` example: | ||
|
||
### Changing types | ||
```shell | ||
export GOPATH="$HOME/go" | ||
export PATH="${PATH}:${GOPATH}/bin" | ||
export KO_DOCKER_REPO='gcr.io/my-gcloud-project-name' | ||
``` | ||
|
||
When updating types, you should regenerate any generated code with: | ||
Make sure to configure [authentication]( | ||
https://cloud.google.com/container-registry/docs/advanced-authentication#standalone_docker_credential_helper) | ||
for your `KO_DOCKER_REPO` if required. To be able to push images to `gcr.io/<project>`, you need to run this once: | ||
|
||
```bash | ||
make generate | ||
```shell | ||
gcloud auth configure-docker | ||
``` | ||
|
||
Then test this by [installing and running](#installing-and-running). | ||
|
||
### Installing and running | ||
## Iterating | ||
|
||
The skeleton for this project was generated using [kubebuilder](https://book.kubebuilder.io/quick_start.html), | ||
which created our [Makefile](./Makefile). The `Makefile` will call out to `kubectl`, | ||
so you must [configure your `kubeconfig` to use your cluster](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/). | ||
While iterating on the project, you may need to: | ||
|
||
Then a typical development cycle will look like this: | ||
1. [Run controllers](#running-controllers) | ||
1. Update your (external) dependencies with: `./hack/update-deps.sh`. | ||
1. Update your type definitions with: `./hack/update-codegen.sh`. | ||
|
||
```bash | ||
# Add/update CRDs in your kubernetes cluster | ||
make install | ||
To make changes to these CRDs, you will probably interact with: | ||
|
||
# Run your controller locally, (stop execution with `ctrl-c`) | ||
make run | ||
* The CRD type definitions in [./pkg/apis/pipeline/alpha1](./pkg/apis/pipeline/v1alpha1) | ||
* The controllers in [./pkg/controller](./pkg/controller) | ||
* The clients are in [./pkg/client](./pkg/controller) (these are generated by `./hack/update-codegen.sh`) | ||
|
||
# In another terminal, deploy tasks | ||
kubectl apply -f config/samples | ||
``` | ||
## Running controllers | ||
|
||
You will also want to [run tests](#running-tests). | ||
You can stand up a version of this controller on-cluster (to your `kubectl config current-context`) with: | ||
|
||
### Running tests | ||
```shell | ||
# This will register the CRD and deploy the controller to start acting on them. | ||
ko apply -f config/ | ||
``` | ||
|
||
Run the tests with: | ||
As you make changes to the code, you can redeploy your controller with: | ||
|
||
```bash | ||
make test | ||
```shell | ||
ko apply -f config/controller.yaml | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
### Where's the code? | ||
|
||
To make changes to these CRDs, you will probably interact with: | ||
You can clean up everything with: | ||
|
||
* The CRD type definitions in [./pkg/apis/pipeline/v1beta1](./pkg/apis/pipeline/v1beta1) | ||
* The controllers in [./pkg/controller](./pkg/controller) | ||
```shell | ||
ko delete -f config/ | ||
``` |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.