Skip to content

Commit

Permalink
Merge pull request openshift#257 from ingvagabund/generate-crds
Browse files Browse the repository at this point in the history
Generate crds
  • Loading branch information
openshift-merge-robot authored Apr 9, 2019
2 parents 2c041f1 + 14d9d26 commit ca943e3
Show file tree
Hide file tree
Showing 70 changed files with 12,431 additions and 103 deletions.
67 changes: 66 additions & 1 deletion Gopkg.lock

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

1 change: 1 addition & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ required = [
"github.com/openshift/cluster-autoscaler-operator/pkg/apis",
"github.com/onsi/ginkgo",
"github.com/onsi/gomega",
"sigs.k8s.io/controller-tools/cmd/controller-gen", # for crd/rbac generation
]

# To override the revision="commit_id" constraint from the cluster-api-actuator-pkg
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ nodelink-controller:
machine-healthcheck:
$(DOCKER_CMD) ./hack/go-build.sh machine-healthcheck

.PHONY: generate
generate: gen-crd update-codegen

.PHONY: gen-crd
gen-crd:
$(DOCKER_CMD) ./hack/gen-crd.sh

.PHONY: update-codegen
update-codegen:
$(DOCKER_CMD) ./hack/update-codegen.sh
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ $ make nodelink-controller
## Dev
- Generate code (if needed):
```sh
$ make generate
```

- Build:

```sh
Expand Down
30 changes: 30 additions & 0 deletions hack/gen-crd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -eu

echo "Building controller-gen tool..."
go build -o bin/controller-gen github.com/openshift/machine-api-operator/vendor/sigs.k8s.io/controller-tools/cmd/controller-gen

dir=$(mktemp -d -t XXXXXXXX)
echo $dir
mkdir -p $dir/src/github.com/openshift/machine-api-operator/pkg/apis
mkdir -p $dir/src/github.com/openshift/machine-api-operator/vendor

cp -r pkg/apis/healthchecking $dir/src/github.com/openshift/machine-api-operator/pkg/apis/.
cp -r vendor/github.com/openshift/cluster-api/pkg/apis/machine $dir/src/github.com/openshift/machine-api-operator/pkg/apis
# Some dependencies need to be coppied as well. Othwerwise, controller-gen will complain about non-existing kind Unsupported
cp -r vendor/k8s.io $dir/src/github.com/openshift/machine-api-operator/vendor/.
cp -r vendor/github.com $dir/src/github.com/openshift/machine-api-operator/vendor/.

cwd=$(pwd)
pushd $dir/src/github.com/openshift/machine-api-operator
GOPATH=$dir ${cwd}/bin/controller-gen crd --domain openshift.io
popd

echo "Coping generated CRDs"
cp $dir/src/github.com/openshift/machine-api-operator/config/crds/healthchecking_v1alpha1_machinehealthcheck.yaml install/0000_30_machine-api-operator_07_machinehealthcheck.crd.yaml
cp $dir/src/github.com/openshift/machine-api-operator/config/crds/machine_v1beta1_machinedeployment.yaml install/0000_30_machine-api-operator_04_machinedeployment.crd.yaml
cp $dir/src/github.com/openshift/machine-api-operator/config/crds/machine_v1beta1_machineset.yaml install/0000_30_machine-api-operator_03_machineset.crd.yaml
cp $dir/src/github.com/openshift/machine-api-operator/config/crds/machine_v1beta1_machine.yaml install/0000_30_machine-api-operator_02_machine.crd.yaml

rm -rf $dir
Loading

0 comments on commit ca943e3

Please sign in to comment.