forked from tektoncd/pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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 tektoncd#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 <[email protected]>
- Loading branch information
1 parent
15f1373
commit 01853c6
Showing
5,703 changed files
with
901,002 additions
and
612,107 deletions.
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
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 [email protected]:${YOUR_GITHUB_USERNAME}/build-pipeline.git | ||
cd build-pipeline | ||
git remote add upstream [email protected]: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 | ||
``` | ||
|
||
### 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.