Skip to content

Commit

Permalink
Add Gopkg dependency for kubernetes code-generator.
Browse files Browse the repository at this point in the history
The code generator should not be run from HEAD, as it will generate code
that diverges from the pinned version of client-go, and also any
previously generated CRD controller clients.

This change pins both code generator and client-go to the specified
kubernetes release, and ensures the update-codegen.sh script uses the
code-generator specified in the vendor directory rather than HEAD. This
ensures the build is always reproducible.
  • Loading branch information
neuromage committed Nov 26, 2018
1 parent b298fdc commit 8988617
Show file tree
Hide file tree
Showing 296 changed files with 41,747 additions and 3,743 deletions.
85 changes: 74 additions & 11 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 18 additions & 5 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
# go-tests = true
# unused-packages = true

required = [
"k8s.io/code-generator/cmd/defaulter-gen",
"k8s.io/code-generator/cmd/deepcopy-gen",
"k8s.io/code-generator/cmd/client-gen",
"k8s.io/code-generator/cmd/lister-gen",
"k8s.io/code-generator/cmd/informer-gen",
]

[[constraint]]
name = "github.com/argoproj/argo"
Expand Down Expand Up @@ -117,10 +124,6 @@
branch = "release-1.9"
name = "k8s.io/apimachinery"

[[constraint]]
branch = "release-6.0"
name = "k8s.io/client-go"

[[constraint]]
name = "k8s.io/kubernetes"
version = "1.11.1"
Expand All @@ -129,6 +132,10 @@
go-tests = true
unused-packages = true

[[prune.project]]
name = "k8s.io/code-generator"
unused-packages = false

[[override]]
branch = "release-1.11"
name = "k8s.io/apimachinery"
Expand All @@ -138,9 +145,15 @@
name = "k8s.io/api"

[[override]]
branch = "release-8.0"
name = "k8s.io/client-go"
# revision for tag "kubernetes-1.11.1"
revision = "59698c7d9724b0f95f9dc9e7f7dfdcc3dfeceb82"

[[override]]
name = "github.com/spf13/pflag"
version = "1.0.1"

[[override]]
name = "k8s.io/code-generator"
# revision for tag "kubernetes-1.11.1"
revision = "6702109cc68eb6fe6350b83e14407c8d7309fd1a"
25 changes: 12 additions & 13 deletions backend/src/crd/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
## Scheduled Workflow CRD/controller

### How to generate the API client code from the API specification?
### How to generate the API client code from the API specification?

Get the dependencies:

```
dep ensure
go get -u ./...
go get -u k8s.io/client-go/...
go get -u k8s.io/code-generator/...
```

Generate the API client code from the API specification:
Expand All @@ -16,11 +15,11 @@ Generate the API client code from the API specification:
./hack/update-codegen.sh
```

### How to run the ScheduledWorkflow controller from the command line?
### How to run the ScheduledWorkflow controller from the command line?

The following assumes that your Kubernetes configuration file is located at '$HOME/.kube/config'.

To create the resource for the CRD, execute:
To create the resource for the CRD, execute:

```
kubectl create -f ./install/manifests/scheduledworkflow-crd.yaml
Expand All @@ -32,7 +31,7 @@ Output:
customresourcedefinition.apiextensions.k8s.io "scheduledworkflows.kubeflow.org" created
```

To run the controller locally, execute:
To run the controller locally, execute:
configuration file

```
Expand All @@ -47,19 +46,19 @@ Started workers
Wait for shut down
```

To run a sample workflow on a schedule, execute:
To run a sample workflow on a schedule, execute:

```
kubectl create -f ./samples/scheduledworkflow/every-minute-cron.yaml
```

Output:
Output:

```
scheduledworkflow.kubeflow.org "every-minute-cron" created
```

To see the current list of ScheduledWorkflows, execute:
To see the current list of ScheduledWorkflows, execute:

```
kubectl get swf
Expand All @@ -72,7 +71,7 @@ NAME AGE
every-minute-cron 1m
```

To see the current status of the ScheduledWorklfow named 'every-minute-cron', execute:
To see the current status of the ScheduledWorklfow named 'every-minute-cron', execute:

```
kubectl describe swf every-minute-cron
Expand All @@ -89,7 +88,7 @@ Annotations: <none>
API Version: kubeflow.org/v1alpha1
Kind: ScheduledWorkflow
Metadata:
Cluster Name:
Cluster Name:
Creation Timestamp: 2018-06-06T01:24:55Z
Generation: 0
Initializers: <nil>
Expand All @@ -116,7 +115,7 @@ Spec:
Command:
cowsay
Image: docker/whalesay
Name:
Name:
Resources:
Inputs:
Parameters:
Expand Down Expand Up @@ -150,4 +149,4 @@ Status:
UID: b0b63a82-692a-11e8-9fd5-42010a8a0021
[...]
```
###
###
9 changes: 5 additions & 4 deletions backend/src/crd/hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ set -o errexit
set -o nounset
set -o pipefail

SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})
echo "SCRIPT_ROOT is $SCRIPT_ROOT"
CODEGEN_PKG=${SCRIPT_ROOT}/../../../../../../k8s.io/code-generator
CODEGEN_PKG=${SCRIPT_ROOT}/../../../../vendor/k8s.io/code-generator
echo "CODEGEN_PKG is $CODEGEN_PKG"

${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
github.com/kubeflow/pipelines/backend/src/crd/pkg/client github.com/kubeflow/pipelines/backend/src/crd/pkg/apis \
github.com/kubeflow/pipelines/backend/src/crd/pkg/client \
github.com/kubeflow/pipelines/backend/src/crd/pkg/apis \
scheduledworkflow:v1alpha1 \
--go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt
--go-header-file ${SCRIPT_ROOT}/custom-boilerplate.go.txt
16 changes: 7 additions & 9 deletions backend/src/crd/pkg/client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions vendor/OWNERS

This file was deleted.

Loading

0 comments on commit 8988617

Please sign in to comment.