From 6f6ba96b37d3f08757de6eb6b9a0879646b906c2 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Wed, 11 Jul 2018 15:52:44 -0400 Subject: [PATCH] Initial cluster-api-provider-digitalocean skeleton --- .github/PULL_REQUEST_TEMPLATE.md | 17 + .gitignore | 16 + Gopkg.lock | 1064 +++++++++++++++++ Gopkg.toml | 37 + LICENSE | 201 ++++ Makefile | 66 + README.md | 1 + boilerplate.go.txt | 12 + .../actuators/cluster/actuator.go | 51 + .../actuators/machine/actuator.go | 76 ++ .../controllers/cluster/controller.go | 157 +++ .../controllers/cluster/options/options.go | 32 + .../controllers/machine/controller.go | 157 +++ .../controllers/machine/options/options.go | 32 + cloud/digitalocean/providerconfig/doc.go | 19 + cloud/digitalocean/providerconfig/register.go | 57 + cloud/digitalocean/providerconfig/types.go | 38 + .../providerconfig/v1alpha1/doc.go | 19 + .../providerconfig/v1alpha1/register.go | 138 +++ .../providerconfig/v1alpha1/types.go | 38 + .../v1alpha1/zz_generated.deepcopy.go | 122 ++ .../providerconfig/zz_generated.deepcopy.go | 122 ++ clusterctl/examples/digitalocean/.gitignore | 1 + clusterctl/examples/digitalocean/README.md | 24 + .../digitalocean/cluster.yaml.template | 16 + .../examples/digitalocean/generate-yaml.sh | 54 + .../digitalocean/machines.yaml.template | 15 + .../provider-components.yaml.template | 101 ++ clusterctl/main.go | 26 + cmd/cluster-controller/Dockerfile | 29 + cmd/cluster-controller/Makefile | 38 + cmd/cluster-controller/main.go | 47 + cmd/machine-controller/Dockerfile | 29 + cmd/machine-controller/Makefile | 38 + cmd/machine-controller/main.go | 47 + code-of-conduct.md | 3 + hack/update-gofmt.sh | 21 + hack/verify-gofmt.sh | 31 + 38 files changed, 2992 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .gitignore create mode 100644 Gopkg.lock create mode 100644 Gopkg.toml create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 boilerplate.go.txt create mode 100644 cloud/digitalocean/actuators/cluster/actuator.go create mode 100644 cloud/digitalocean/actuators/machine/actuator.go create mode 100644 cloud/digitalocean/controllers/cluster/controller.go create mode 100644 cloud/digitalocean/controllers/cluster/options/options.go create mode 100644 cloud/digitalocean/controllers/machine/controller.go create mode 100644 cloud/digitalocean/controllers/machine/options/options.go create mode 100644 cloud/digitalocean/providerconfig/doc.go create mode 100644 cloud/digitalocean/providerconfig/register.go create mode 100644 cloud/digitalocean/providerconfig/types.go create mode 100644 cloud/digitalocean/providerconfig/v1alpha1/doc.go create mode 100644 cloud/digitalocean/providerconfig/v1alpha1/register.go create mode 100644 cloud/digitalocean/providerconfig/v1alpha1/types.go create mode 100644 cloud/digitalocean/providerconfig/v1alpha1/zz_generated.deepcopy.go create mode 100644 cloud/digitalocean/providerconfig/zz_generated.deepcopy.go create mode 100644 clusterctl/examples/digitalocean/.gitignore create mode 100644 clusterctl/examples/digitalocean/README.md create mode 100644 clusterctl/examples/digitalocean/cluster.yaml.template create mode 100644 clusterctl/examples/digitalocean/generate-yaml.sh create mode 100644 clusterctl/examples/digitalocean/machines.yaml.template create mode 100644 clusterctl/examples/digitalocean/provider-components.yaml.template create mode 100644 clusterctl/main.go create mode 100644 cmd/cluster-controller/Dockerfile create mode 100644 cmd/cluster-controller/Makefile create mode 100644 cmd/cluster-controller/main.go create mode 100644 cmd/machine-controller/Dockerfile create mode 100644 cmd/machine-controller/Makefile create mode 100644 cmd/machine-controller/main.go create mode 100644 code-of-conduct.md create mode 100755 hack/update-gofmt.sh create mode 100755 hack/verify-gofmt.sh diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..bc7c61b23 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,17 @@ +**What this PR does / why we need it**: + +**Which issue(s) this PR fixes** *(optional, in `fixes #(, fixes #, ...)` format, will close the issue(s) when PR gets merged)*: +Fixes # + +**Special notes for your reviewer**: + +**Documentation**: + + +**Release note**: + +```release-note +``` \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..37965e929 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib +bin/ + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Vendor director +vendor diff --git a/Gopkg.lock b/Gopkg.lock new file mode 100644 index 000000000..f8a90a208 --- /dev/null +++ b/Gopkg.lock @@ -0,0 +1,1064 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + branch = "default" + digest = "1:db5c4e7a9516334fb1e9d5951fb9943d0f13e4f415a77c22b97e60f4d10a62a7" + name = "bitbucket.org/ww/goautoneg" + packages = ["."] + pruneopts = "" + revision = "75cd24fc2f2c2a2088577d12123ddee5f54e0675" + +[[projects]] + digest = "1:8b95956b70e181b19025c7ba3578fdfd8efbec4ce916490700488afb9218972c" + name = "cloud.google.com/go" + packages = ["compute/metadata"] + pruneopts = "" + revision = "64a2037ec6be8a4b0c1d1f706ed35b428b989239" + version = "v0.26.0" + +[[projects]] + digest = "1:b0fe84bcee1d0c3579d855029ccd3a76deea187412da2976985e4946289dbb2c" + name = "github.com/NYTimes/gziphandler" + packages = ["."] + pruneopts = "" + revision = "2600fb119af974220d3916a5916d6e31176aac1b" + version = "v1.0.1" + +[[projects]] + digest = "1:8e47871087b94913898333f37af26732faaab30cdb41571136cf7aec9921dae7" + name = "github.com/PuerkitoBio/purell" + packages = ["."] + pruneopts = "" + revision = "0bcb03f4b4d0a9428594752bd2a3b9aa0a9d4bd4" + version = "v1.1.0" + +[[projects]] + branch = "master" + digest = "1:331a419049c2be691e5ba1d24342fc77c7e767a80c666a18fd8a9f7b82419c1c" + name = "github.com/PuerkitoBio/urlesc" + packages = ["."] + pruneopts = "" + revision = "de5bf2ad457846296e2031421a34e2568e304e35" + +[[projects]] + branch = "master" + digest = "1:c0bec5f9b98d0bc872ff5e834fac186b807b656683bd29cb82fb207a1513fabb" + name = "github.com/beorn7/perks" + packages = ["quantile"] + pruneopts = "" + revision = "3a771d992973f24aa725d07868b467d1ddfceafb" + +[[projects]] + digest = "1:96637fd1b47c35bd2fc49969138b40ad6b66166e2e36664ac5ffd97c93542e62" + name = "github.com/coreos/etcd" + packages = [ + "auth/authpb", + "client", + "clientv3", + "etcdserver/api/v3rpc/rpctypes", + "etcdserver/etcdserverpb", + "mvcc/mvccpb", + "pkg/pathutil", + "pkg/srv", + "pkg/tlsutil", + "pkg/transport", + "pkg/types", + "version", + ] + pruneopts = "" + revision = "33245c6b5b49130ca99280408fadfab01aac0e48" + version = "v3.3.8" + +[[projects]] + digest = "1:3c3f68ebab415344aef64363d23471e953a4715645115604aaf57923ae904f5e" + name = "github.com/coreos/go-semver" + packages = ["semver"] + pruneopts = "" + revision = "8ab6407b697782a06568d4b7f1db25550ec2e4c6" + version = "v0.2.0" + +[[projects]] + digest = "1:1a99671bb8620f32c88d20f65c7069a8c3745d1533bd486b9c0c538a1d981a5c" + name = "github.com/coreos/go-systemd" + packages = ["daemon"] + pruneopts = "" + revision = "39ca1b05acc7ad1220e09f133283b8859a8b71ab" + version = "v17" + +[[projects]] + digest = "1:56c130d885a4aacae1dd9c7b71cfe39912c7ebc1ff7d2b46083c8812996dc43b" + name = "github.com/davecgh/go-spew" + packages = ["spew"] + pruneopts = "" + revision = "346938d642f2ec3594ed81d874461961cd0faa76" + version = "v1.1.0" + +[[projects]] + digest = "1:044b2f1eea2f5cfb0d3678baf60892734f59d5c2ea3932cb6ed894a97ccba15c" + name = "github.com/elazarl/go-bindata-assetfs" + packages = ["."] + pruneopts = "" + revision = "30f82fa23fd844bd5bb1e5f216db87fd77b5eb43" + version = "v1.0.0" + +[[projects]] + digest = "1:8a34d7a37b8f07239487752e14a5faafcbbc718fc385ad429a2c4ac6f27a207f" + name = "github.com/emicklei/go-restful" + packages = [ + ".", + "log", + ] + pruneopts = "" + revision = "3eb9738c1697594ea6e71a7156a9bb32ed216cf0" + version = "v2.8.0" + +[[projects]] + digest = "1:cad2dd7061b8dcb4e0014d89e8070f185fb70ac9ba26acf27ff42b9c3eb0ff9b" + name = "github.com/emicklei/go-restful-swagger12" + packages = ["."] + pruneopts = "" + revision = "dcef7f55730566d41eae5db10e7d6981829720f6" + version = "1.0.1" + +[[projects]] + digest = "1:dcefbadf4534c5ecac8573698fba6e6e601157bfa8f96aafe29df31ae582ef2a" + name = "github.com/evanphx/json-patch" + packages = ["."] + pruneopts = "" + revision = "afac545df32f2287a079e2dfb7ba2745a643747e" + version = "v3.0.0" + +[[projects]] + digest = "1:b13707423743d41665fd23f0c36b2f37bb49c30e94adb813319c44188a51ba22" + name = "github.com/ghodss/yaml" + packages = ["."] + pruneopts = "" + revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7" + version = "v1.0.0" + +[[projects]] + branch = "master" + digest = "1:e116a4866bffeec941056a1fcfd37e520fad1ee60e4e3579719f19a43c392e10" + name = "github.com/go-openapi/jsonpointer" + packages = ["."] + pruneopts = "" + revision = "3a0015ad55fa9873f41605d3e8f28cd279c32ab2" + +[[projects]] + branch = "master" + digest = "1:3830527ef0f4f9b268d9286661c0f52f9115f8aefd9f45ee7352516f93489ac9" + name = "github.com/go-openapi/jsonreference" + packages = ["."] + pruneopts = "" + revision = "3fb327e6747da3043567ee86abd02bb6376b6be2" + +[[projects]] + branch = "master" + digest = "1:6caee195f5da296689270037c5a25c0bc3cc6e54ae5a356e395aa8946356dbc9" + name = "github.com/go-openapi/spec" + packages = ["."] + pruneopts = "" + revision = "bce47c9386f9ecd6b86f450478a80103c3fe1402" + +[[projects]] + branch = "master" + digest = "1:22da48dbccb0539f511efbbbdeba68081866892234e57a9d7c7f9848168ae30c" + name = "github.com/go-openapi/swag" + packages = ["."] + pruneopts = "" + revision = "2b0bd4f193d011c203529df626a65d63cb8a79e8" + +[[projects]] + digest = "1:0a3f6a0c68ab8f3d455f8892295503b179e571b7fefe47cc6c556405d1f83411" + name = "github.com/gogo/protobuf" + packages = [ + "gogoproto", + "proto", + "protoc-gen-gogo/descriptor", + "sortkeys", + ] + pruneopts = "" + revision = "1adfc126b41513cc696b209667c8656ea7aac67c" + version = "v1.0.0" + +[[projects]] + branch = "master" + digest = "1:107b233e45174dbab5b1324201d092ea9448e58243ab9f039e4c0f332e121e3a" + name = "github.com/golang/glog" + packages = ["."] + pruneopts = "" + revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" + +[[projects]] + branch = "master" + digest = "1:1d8a57fce1f68298ce54967c0752a2ab54bf55dff261d245b8f3440a217700cb" + name = "github.com/golang/groupcache" + packages = ["lru"] + pruneopts = "" + revision = "24b0969c4cb722950103eed87108c8d291a8df00" + +[[projects]] + digest = "1:f958a1c137db276e52f0b50efee41a1a389dcdded59a69711f3e872757dab34b" + name = "github.com/golang/protobuf" + packages = [ + "proto", + "ptypes", + "ptypes/any", + "ptypes/duration", + "ptypes/timestamp", + ] + pruneopts = "" + revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265" + version = "v1.1.0" + +[[projects]] + branch = "master" + digest = "1:be28c0531a755f2178acf1e327e6f5a8a3968feb5f2567cdc968064253141751" + name = "github.com/google/btree" + packages = ["."] + pruneopts = "" + revision = "e89373fe6b4a7413d7acd6da1725b83ef713e6e4" + +[[projects]] + branch = "master" + digest = "1:754f77e9c839b24778a4b64422236d38515301d2baeb63113aa3edc42e6af692" + name = "github.com/google/gofuzz" + packages = ["."] + pruneopts = "" + revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1" + +[[projects]] + digest = "1:16b2837c8b3cf045fa2cdc82af0cf78b19582701394484ae76b2c3bc3c99ad73" + name = "github.com/googleapis/gnostic" + packages = [ + "OpenAPIv2", + "compiler", + "extensions", + ] + pruneopts = "" + revision = "7c663266750e7d82587642f65e60bc4083f1f84e" + version = "v0.2.0" + +[[projects]] + branch = "master" + digest = "1:009a1928b8c096338b68b5822d838a72b4d8520715c1463614476359f3282ec8" + name = "github.com/gregjones/httpcache" + packages = [ + ".", + "diskcache", + ] + pruneopts = "" + revision = "9cad4c3443a7200dd6400aef47183728de563a38" + +[[projects]] + branch = "master" + digest = "1:9c776d7d9c54b7ed89f119e449983c3f24c0023e75001d6092442412ebca6b94" + name = "github.com/hashicorp/golang-lru" + packages = [ + ".", + "simplelru", + ] + pruneopts = "" + revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3" + +[[projects]] + branch = "master" + digest = "1:f81c8d7354cc0c6340f2f7a48724ee6c2b3db3e918ecd441c985b4d2d97dd3e7" + name = "github.com/howeyc/gopass" + packages = ["."] + pruneopts = "" + revision = "bf9dde6d0d2c004a008c27aaee91170c786f6db8" + +[[projects]] + digest = "1:302c6eb8e669c997bec516a138b8fc496018faa1ece4c13e445a2749fbe079bb" + name = "github.com/imdario/mergo" + packages = ["."] + pruneopts = "" + revision = "9316a62528ac99aaecb4e47eadd6dc8aa6533d58" + version = "v0.3.5" + +[[projects]] + digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be" + name = "github.com/inconshreveable/mousetrap" + packages = ["."] + pruneopts = "" + revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" + version = "v1.0" + +[[projects]] + digest = "1:53ac4e911e12dde0ab68655e2006449d207a5a681f084974da2b06e5dbeaca72" + name = "github.com/json-iterator/go" + packages = ["."] + pruneopts = "" + revision = "ab8a2e0c74be9d3be70b3184d9acc634935ded82" + version = "1.1.4" + +[[projects]] + digest = "1:d26c006cbf54ca5c040463d5678013169e2bd91fb62c2f960ae283a1723d4278" + name = "github.com/juju/ratelimit" + packages = ["."] + pruneopts = "" + revision = "59fac5042749a5afb9af70e813da1dd5474f0167" + version = "1.0.1" + +[[projects]] + digest = "1:cd615da8240ba516faaab9251a96fd0e940046c0f3379ffbeaa7e5bdf8c1699c" + name = "github.com/kubernetes-incubator/apiserver-builder" + packages = [ + "pkg/builders", + "pkg/controller", + ] + pruneopts = "" + revision = "14201e804a58a140011a0044b15331f477535f91" + version = "v1.9-alpha.4" + +[[projects]] + branch = "master" + digest = "1:d9e483f4b9e306facf126bd90b02d512bd22ea4471e1568867e32221a8abbb16" + name = "github.com/mailru/easyjson" + packages = [ + "buffer", + "jlexer", + "jwriter", + ] + pruneopts = "" + revision = "3fdea8d05856a0c8df22ed4bc71b3219245e4485" + +[[projects]] + digest = "1:63722a4b1e1717be7b98fc686e0b30d5e7f734b9e93d7dee86293b6deab7ea28" + name = "github.com/matttproud/golang_protobuf_extensions" + packages = ["pbutil"] + pruneopts = "" + revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" + version = "v1.0.1" + +[[projects]] + digest = "1:0c0ff2a89c1bb0d01887e1dac043ad7efbf3ec77482ef058ac423d13497e16fd" + name = "github.com/modern-go/concurrent" + packages = ["."] + pruneopts = "" + revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94" + version = "1.0.3" + +[[projects]] + digest = "1:e32bdbdb7c377a07a9a46378290059822efdce5c8d96fe71940d87cb4f918855" + name = "github.com/modern-go/reflect2" + packages = ["."] + pruneopts = "" + revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd" + version = "1.0.1" + +[[projects]] + branch = "master" + digest = "1:d33ce379780d7c43405b9251289493cabada82f6bf9ab35eea6915d04f6ac8e0" + name = "github.com/mxk/go-flowrate" + packages = ["flowrate"] + pruneopts = "" + revision = "cca7078d478f8520f85629ad7c68962d31ed7682" + +[[projects]] + digest = "1:63e142fc50307bcb3c57494913cfc9c12f6061160bdf97a678f78c71615f939b" + name = "github.com/pborman/uuid" + packages = ["."] + pruneopts = "" + revision = "e790cca94e6cc75c7064b1332e63811d4aae1a53" + version = "v1.1" + +[[projects]] + branch = "master" + digest = "1:c24598ffeadd2762552269271b3b1510df2d83ee6696c1e543a0ff653af494bc" + name = "github.com/petar/GoLLRB" + packages = ["llrb"] + pruneopts = "" + revision = "53be0d36a84c2a886ca057d34b6aa4468df9ccb4" + +[[projects]] + digest = "1:b46305723171710475f2dd37547edd57b67b9de9f2a6267cafdd98331fd6897f" + name = "github.com/peterbourgon/diskv" + packages = ["."] + pruneopts = "" + revision = "5f041e8faa004a95c88a202771f4cc3e991971e6" + version = "v2.0.1" + +[[projects]] + digest = "1:4142d94383572e74b42352273652c62afec5b23f325222ed09198f46009022d1" + name = "github.com/prometheus/client_golang" + packages = ["prometheus"] + pruneopts = "" + revision = "c5b7fccd204277076155f10851dad72b76a49317" + version = "v0.8.0" + +[[projects]] + branch = "master" + digest = "1:60aca47f4eeeb972f1b9da7e7db51dee15ff6c59f7b401c1588b8e6771ba15ef" + name = "github.com/prometheus/client_model" + packages = ["go"] + pruneopts = "" + revision = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" + +[[projects]] + branch = "master" + digest = "1:bfbc121ef802d245ef67421cff206615357d9202337a3d492b8f668906b485a8" + name = "github.com/prometheus/common" + packages = [ + "expfmt", + "internal/bitbucket.org/ww/goautoneg", + "model", + ] + pruneopts = "" + revision = "7600349dcfe1abd18d72d3a1770870d9800a7801" + +[[projects]] + branch = "master" + digest = "1:b694a6bdecdace488f507cff872b30f6f490fdaf988abd74d87ea56406b23b6e" + name = "github.com/prometheus/procfs" + packages = [ + ".", + "internal/util", + "nfs", + "xfs", + ] + pruneopts = "" + revision = "ae68e2d4c00fed4943b5f6698d504a5fe083da8a" + +[[projects]] + digest = "1:a1403cc8a94b8d7956ee5e9694badef0e7b051af289caad1cf668331e3ffa4f6" + name = "github.com/spf13/cobra" + packages = ["."] + pruneopts = "" + revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385" + version = "v0.0.3" + +[[projects]] + digest = "1:8e243c568f36b09031ec18dff5f7d2769dcf5ca4d624ea511c8e3197dc3d352d" + name = "github.com/spf13/pflag" + packages = ["."] + pruneopts = "" + revision = "583c0c0531f06d5278b7d917446061adc344b5cd" + version = "v1.0.1" + +[[projects]] + digest = "1:2e7f653483e51243b6cd6de60ce39bde0d6927d10a3c24295ab0f82cb1efeae2" + name = "github.com/ugorji/go" + packages = ["codec"] + pruneopts = "" + revision = "b4c50a2b199d93b13dc15e78929cfb23bfdf21ab" + version = "v1.1.1" + +[[projects]] + branch = "master" + digest = "1:6ef14be530be39b6b9d75d54ce1d546ae9231e652d9e3eef198cbb19ce8ed3e7" + name = "golang.org/x/crypto" + packages = ["ssh/terminal"] + pruneopts = "" + revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602" + +[[projects]] + branch = "master" + digest = "1:7f964bcb1ea681ed36b80aeb72653eaa349372074918363615ce935faeeb54fb" + name = "golang.org/x/net" + packages = [ + "context", + "context/ctxhttp", + "html", + "html/atom", + "http/httpguts", + "http2", + "http2/hpack", + "idna", + "internal/timeseries", + "trace", + "websocket", + ] + pruneopts = "" + revision = "039a4258aec0ad3c79b905677cceeab13b296a77" + +[[projects]] + branch = "master" + digest = "1:a8172cf4304ef01f0c7dd634c331880247d10f9e28b041821f2321a8e4bb3b7c" + name = "golang.org/x/oauth2" + packages = [ + ".", + "google", + "internal", + "jws", + "jwt", + ] + pruneopts = "" + revision = "3d292e4d0cdc3a0113e6d207bb137145ef1de42f" + +[[projects]] + branch = "master" + digest = "1:19f072f12708aaafef9064b49432953e3f813a98fcb356b30831cf2b0f5272b3" + name = "golang.org/x/sys" + packages = [ + "unix", + "windows", + ] + pruneopts = "" + revision = "1b2967e3c290b7c545b3db0deeda16e9be4f98a2" + +[[projects]] + digest = "1:5acd3512b047305d49e8763eef7ba423901e85d5dd2fd1e71778a0ea8de10bd4" + name = "golang.org/x/text" + packages = [ + "collate", + "collate/build", + "internal/colltab", + "internal/gen", + "internal/tag", + "internal/triegen", + "internal/ucd", + "language", + "secure/bidirule", + "transform", + "unicode/bidi", + "unicode/cldr", + "unicode/norm", + "unicode/rangetable", + "width", + ] + pruneopts = "" + revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" + version = "v0.3.0" + +[[projects]] + branch = "master" + digest = "1:b3123d1f332e4536a69174a97ae8333cfef1ef502942a9d956dee761314b44c9" + name = "golang.org/x/tools" + packages = [ + "go/ast/astutil", + "imports", + "internal/fastwalk", + ] + pruneopts = "" + revision = "2087f8c10712366cfc2f4fcb1bf99eeef61ab21e" + +[[projects]] + branch = "master" + digest = "1:d7f117233eb274f6ac01cdfe0a6c4ce2bc79ef4961854e8b6e9b0adee5d64b86" + name = "google.golang.org/api" + packages = [ + "cloudbilling/v1", + "cloudresourcemanager/v1", + "compute/v1", + "gensupport", + "googleapi", + "googleapi/internal/uritemplates", + "servicemanagement/v1", + ] + pruneopts = "" + revision = "0e8d13b5c025da6a7cf249bb854e5869921dd459" + +[[projects]] + digest = "1:c1771ca6060335f9768dff6558108bc5ef6c58506821ad43377ee23ff059e472" + name = "google.golang.org/appengine" + packages = [ + ".", + "internal", + "internal/app_identity", + "internal/base", + "internal/datastore", + "internal/log", + "internal/modules", + "internal/remote_api", + "internal/urlfetch", + "urlfetch", + ] + pruneopts = "" + revision = "b1f26356af11148e710935ed1ac8a7f5702c7612" + version = "v1.1.0" + +[[projects]] + branch = "master" + digest = "1:524c6df2f66ff8f36b07472a5510e6a3098fe42fa5b59362f912a08704204dca" + name = "google.golang.org/genproto" + packages = ["googleapis/rpc/status"] + pruneopts = "" + revision = "e92b116572682a5b432ddd840aeaba2a559eeff1" + +[[projects]] + digest = "1:5f31b45ee9da7a87f140bef3ed0a7ca34ea2a6d38eb888123b8e28170e8aa4f2" + name = "google.golang.org/grpc" + packages = [ + ".", + "balancer", + "balancer/base", + "balancer/roundrobin", + "codes", + "connectivity", + "credentials", + "encoding", + "encoding/proto", + "grpclog", + "health/grpc_health_v1", + "internal", + "internal/backoff", + "internal/channelz", + "internal/grpcrand", + "keepalive", + "metadata", + "naming", + "peer", + "resolver", + "resolver/dns", + "resolver/passthrough", + "stats", + "status", + "tap", + "transport", + ] + pruneopts = "" + revision = "168a6198bcb0ef175f7dacec0b8691fc141dc9b8" + version = "v1.13.0" + +[[projects]] + digest = "1:75fb3fcfc73a8c723efde7777b40e8e8ff9babf30d8c56160d01beffea8a95a6" + name = "gopkg.in/inf.v0" + packages = ["."] + pruneopts = "" + revision = "d2d2541c53f18d2a059457998ce2876cc8e67cbf" + version = "v0.9.1" + +[[projects]] + digest = "1:f0620375dd1f6251d9973b5f2596228cc8042e887cd7f827e4220bc1ce8c30e2" + name = "gopkg.in/yaml.v2" + packages = ["."] + pruneopts = "" + revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183" + version = "v2.2.1" + +[[projects]] + branch = "release-1.9" + digest = "1:8a154464dc1ea7a9c16a34583693b194235218c08e4ff668eee49a3746bcc0a5" + name = "k8s.io/api" + packages = [ + "admission/v1beta1", + "admissionregistration/v1alpha1", + "admissionregistration/v1beta1", + "apps/v1", + "apps/v1beta1", + "apps/v1beta2", + "authentication/v1", + "authentication/v1beta1", + "authorization/v1", + "authorization/v1beta1", + "autoscaling/v1", + "autoscaling/v2beta1", + "batch/v1", + "batch/v1beta1", + "batch/v2alpha1", + "certificates/v1beta1", + "core/v1", + "events/v1beta1", + "extensions/v1beta1", + "networking/v1", + "policy/v1beta1", + "rbac/v1", + "rbac/v1alpha1", + "rbac/v1beta1", + "scheduling/v1alpha1", + "settings/v1alpha1", + "storage/v1", + "storage/v1alpha1", + "storage/v1beta1", + ] + pruneopts = "" + revision = "9273ee02527c608cecc74969b3e489f5dba686da" + +[[projects]] + branch = "release-1.9" + digest = "1:5ab6164cabb8b939ae6d7a01d6e534c5e88eaf3c4f5040f803ad22591c95c639" + name = "k8s.io/apimachinery" + packages = [ + "pkg/api/equality", + "pkg/api/errors", + "pkg/api/meta", + "pkg/api/resource", + "pkg/api/validation", + "pkg/api/validation/path", + "pkg/apimachinery", + "pkg/apimachinery/announced", + "pkg/apimachinery/registered", + "pkg/apis/meta/internalversion", + "pkg/apis/meta/v1", + "pkg/apis/meta/v1/unstructured", + "pkg/apis/meta/v1/validation", + "pkg/apis/meta/v1alpha1", + "pkg/conversion", + "pkg/conversion/queryparams", + "pkg/fields", + "pkg/labels", + "pkg/runtime", + "pkg/runtime/schema", + "pkg/runtime/serializer", + "pkg/runtime/serializer/json", + "pkg/runtime/serializer/protobuf", + "pkg/runtime/serializer/recognizer", + "pkg/runtime/serializer/streaming", + "pkg/runtime/serializer/versioning", + "pkg/selection", + "pkg/types", + "pkg/util/cache", + "pkg/util/clock", + "pkg/util/diff", + "pkg/util/errors", + "pkg/util/framer", + "pkg/util/httpstream", + "pkg/util/intstr", + "pkg/util/json", + "pkg/util/mergepatch", + "pkg/util/net", + "pkg/util/proxy", + "pkg/util/rand", + "pkg/util/runtime", + "pkg/util/sets", + "pkg/util/strategicpatch", + "pkg/util/uuid", + "pkg/util/validation", + "pkg/util/validation/field", + "pkg/util/wait", + "pkg/util/waitgroup", + "pkg/util/yaml", + "pkg/version", + "pkg/watch", + "third_party/forked/golang/json", + "third_party/forked/golang/netutil", + "third_party/forked/golang/reflect", + ] + pruneopts = "" + revision = "fb40df2b502912cbe3a93aa61c2b2487f39cb42f" + +[[projects]] + branch = "release-1.9" + digest = "1:0649740cfbe0d1f8d9d529234d974efd57dcffa2d6179aa9215cf7103ef0dc31" + name = "k8s.io/apiserver" + packages = [ + "pkg/admission", + "pkg/admission/configuration", + "pkg/admission/initializer", + "pkg/admission/metrics", + "pkg/admission/plugin/initialization", + "pkg/admission/plugin/namespace/lifecycle", + "pkg/admission/plugin/webhook/config", + "pkg/admission/plugin/webhook/config/apis/webhookadmission", + "pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1", + "pkg/admission/plugin/webhook/errors", + "pkg/admission/plugin/webhook/mutating", + "pkg/admission/plugin/webhook/namespace", + "pkg/admission/plugin/webhook/request", + "pkg/admission/plugin/webhook/rules", + "pkg/admission/plugin/webhook/validating", + "pkg/admission/plugin/webhook/versioned", + "pkg/apis/apiserver", + "pkg/apis/apiserver/install", + "pkg/apis/apiserver/v1alpha1", + "pkg/apis/audit", + "pkg/apis/audit/v1alpha1", + "pkg/apis/audit/v1beta1", + "pkg/apis/audit/validation", + "pkg/audit", + "pkg/audit/policy", + "pkg/authentication/authenticator", + "pkg/authentication/authenticatorfactory", + "pkg/authentication/group", + "pkg/authentication/request/anonymous", + "pkg/authentication/request/bearertoken", + "pkg/authentication/request/headerrequest", + "pkg/authentication/request/union", + "pkg/authentication/request/websocket", + "pkg/authentication/request/x509", + "pkg/authentication/serviceaccount", + "pkg/authentication/token/tokenfile", + "pkg/authentication/user", + "pkg/authorization/authorizer", + "pkg/authorization/authorizerfactory", + "pkg/authorization/union", + "pkg/endpoints", + "pkg/endpoints/discovery", + "pkg/endpoints/filters", + "pkg/endpoints/handlers", + "pkg/endpoints/handlers/negotiation", + "pkg/endpoints/handlers/responsewriters", + "pkg/endpoints/metrics", + "pkg/endpoints/openapi", + "pkg/endpoints/request", + "pkg/features", + "pkg/registry/generic", + "pkg/registry/generic/registry", + "pkg/registry/rest", + "pkg/server", + "pkg/server/filters", + "pkg/server/healthz", + "pkg/server/httplog", + "pkg/server/mux", + "pkg/server/routes", + "pkg/server/routes/data/swagger", + "pkg/storage", + "pkg/storage/errors", + "pkg/storage/etcd", + "pkg/storage/etcd/metrics", + "pkg/storage/etcd/util", + "pkg/storage/etcd3", + "pkg/storage/names", + "pkg/storage/storagebackend", + "pkg/storage/storagebackend/factory", + "pkg/storage/value", + "pkg/util/feature", + "pkg/util/flushwriter", + "pkg/util/logs", + "pkg/util/trace", + "pkg/util/webhook", + "pkg/util/wsstream", + "plugin/pkg/authenticator/token/webhook", + "plugin/pkg/authorizer/webhook", + ] + pruneopts = "" + revision = "0c27ac7eec3e47fa7637c9dba4ecf70494bbc28a" + +[[projects]] + branch = "release-6.0" + digest = "1:1f4b732b2aceee905b23ec988196336a03f0cb370c0c24923de2d2360d103fb9" + name = "k8s.io/client-go" + packages = [ + "discovery", + "informers", + "informers/admissionregistration", + "informers/admissionregistration/v1alpha1", + "informers/admissionregistration/v1beta1", + "informers/apps", + "informers/apps/v1", + "informers/apps/v1beta1", + "informers/apps/v1beta2", + "informers/autoscaling", + "informers/autoscaling/v1", + "informers/autoscaling/v2beta1", + "informers/batch", + "informers/batch/v1", + "informers/batch/v1beta1", + "informers/batch/v2alpha1", + "informers/certificates", + "informers/certificates/v1beta1", + "informers/core", + "informers/core/v1", + "informers/events", + "informers/events/v1beta1", + "informers/extensions", + "informers/extensions/v1beta1", + "informers/internalinterfaces", + "informers/networking", + "informers/networking/v1", + "informers/policy", + "informers/policy/v1beta1", + "informers/rbac", + "informers/rbac/v1", + "informers/rbac/v1alpha1", + "informers/rbac/v1beta1", + "informers/scheduling", + "informers/scheduling/v1alpha1", + "informers/settings", + "informers/settings/v1alpha1", + "informers/storage", + "informers/storage/v1", + "informers/storage/v1alpha1", + "informers/storage/v1beta1", + "kubernetes", + "kubernetes/scheme", + "kubernetes/typed/admissionregistration/v1alpha1", + "kubernetes/typed/admissionregistration/v1beta1", + "kubernetes/typed/apps/v1", + "kubernetes/typed/apps/v1beta1", + "kubernetes/typed/apps/v1beta2", + "kubernetes/typed/authentication/v1", + "kubernetes/typed/authentication/v1beta1", + "kubernetes/typed/authorization/v1", + "kubernetes/typed/authorization/v1beta1", + "kubernetes/typed/autoscaling/v1", + "kubernetes/typed/autoscaling/v2beta1", + "kubernetes/typed/batch/v1", + "kubernetes/typed/batch/v1beta1", + "kubernetes/typed/batch/v2alpha1", + "kubernetes/typed/certificates/v1beta1", + "kubernetes/typed/core/v1", + "kubernetes/typed/events/v1beta1", + "kubernetes/typed/extensions/v1beta1", + "kubernetes/typed/networking/v1", + "kubernetes/typed/policy/v1beta1", + "kubernetes/typed/rbac/v1", + "kubernetes/typed/rbac/v1alpha1", + "kubernetes/typed/rbac/v1beta1", + "kubernetes/typed/scheduling/v1alpha1", + "kubernetes/typed/settings/v1alpha1", + "kubernetes/typed/storage/v1", + "kubernetes/typed/storage/v1alpha1", + "kubernetes/typed/storage/v1beta1", + "listers/admissionregistration/v1alpha1", + "listers/admissionregistration/v1beta1", + "listers/apps/v1", + "listers/apps/v1beta1", + "listers/apps/v1beta2", + "listers/autoscaling/v1", + "listers/autoscaling/v2beta1", + "listers/batch/v1", + "listers/batch/v1beta1", + "listers/batch/v2alpha1", + "listers/certificates/v1beta1", + "listers/core/v1", + "listers/events/v1beta1", + "listers/extensions/v1beta1", + "listers/networking/v1", + "listers/policy/v1beta1", + "listers/rbac/v1", + "listers/rbac/v1alpha1", + "listers/rbac/v1beta1", + "listers/scheduling/v1alpha1", + "listers/settings/v1alpha1", + "listers/storage/v1", + "listers/storage/v1alpha1", + "listers/storage/v1beta1", + "pkg/version", + "rest", + "rest/watch", + "tools/auth", + "tools/cache", + "tools/clientcmd", + "tools/clientcmd/api", + "tools/clientcmd/api/latest", + "tools/clientcmd/api/v1", + "tools/leaderelection", + "tools/leaderelection/resourcelock", + "tools/metrics", + "tools/pager", + "tools/record", + "tools/reference", + "transport", + "util/buffer", + "util/cert", + "util/cert/triple", + "util/flowcontrol", + "util/homedir", + "util/integer", + "util/workqueue", + ] + pruneopts = "" + revision = "e2680bfa771859c129bc5c8413fdb565af2b3dcd" + +[[projects]] + branch = "release-1.9" + digest = "1:e041412a6b251f795b4d001a0e67c9e7f52c4fe35263dd750af14019fa5735f9" + name = "k8s.io/code-generator" + packages = ["cmd/deepcopy-gen"] + pruneopts = "" + revision = "0ab89e584187c20cc7c1a3f30db69f3b4ab64196" + +[[projects]] + branch = "master" + digest = "1:f3ce5a03c50cf794f17d331fa9d8741db6fd8aeb5ec07d2a68eb039619f22967" + name = "k8s.io/gengo" + packages = [ + "args", + "examples/deepcopy-gen/generators", + "examples/set-gen/sets", + "generator", + "namer", + "parser", + "types", + ] + pruneopts = "" + revision = "fdcf9f9480fdd5bf2b3c3df9bf4ecd22b25b87e2" + +[[projects]] + branch = "master" + digest = "1:a2f78b8fd86be41f2aa77404245aed4f4f410ac3aabc5f3bd9bd1fcc09076c53" + name = "k8s.io/kube-openapi" + packages = [ + "pkg/builder", + "pkg/common", + "pkg/handler", + "pkg/util", + "pkg/util/proto", + ] + pruneopts = "" + revision = "0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803" + +[[projects]] + branch = "master" + digest = "1:b6d13c72948354f78dd4ab1cc3b01adb0654b6fce3790d1da515e22801025784" + name = "sigs.k8s.io/cluster-api" + packages = [ + "cloud/google", + "cloud/google/clients", + "cloud/google/clients/errors", + "cloud/google/config", + "cloud/google/gceproviderconfig", + "cloud/google/gceproviderconfig/v1alpha1", + "cloud/google/machinesetup", + "cloud/vsphere", + "cloud/vsphere/namedmachines", + "cloud/vsphere/vsphereproviderconfig", + "cloud/vsphere/vsphereproviderconfig/v1alpha1", + "clusterctl/clusterdeployer", + "clusterctl/clusterdeployer/minikube", + "clusterctl/cmd", + "clusterctl/providercomponents", + "pkg/apis/cluster", + "pkg/apis/cluster/common", + "pkg/apis/cluster/v1alpha1", + "pkg/cert", + "pkg/client/clientset_generated/clientset", + "pkg/client/clientset_generated/clientset/scheme", + "pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1", + "pkg/client/informers_generated/externalversions", + "pkg/client/informers_generated/externalversions/cluster", + "pkg/client/informers_generated/externalversions/cluster/v1alpha1", + "pkg/client/informers_generated/externalversions/internalinterfaces", + "pkg/client/listers_generated/cluster/v1alpha1", + "pkg/clientcmd", + "pkg/cmd-runner", + "pkg/controller/cluster", + "pkg/controller/config", + "pkg/controller/machine", + "pkg/controller/noderefutil", + "pkg/controller/sharedinformers", + "pkg/errors", + "pkg/kubeadm", + "pkg/util", + ] + pruneopts = "" + revision = "b770dd7b06fb75834ead5169db85ea79b6215563" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + input-imports = [ + "github.com/golang/glog", + "github.com/kubernetes-incubator/apiserver-builder/pkg/controller", + "github.com/spf13/pflag", + "k8s.io/api/core/v1", + "k8s.io/apimachinery/pkg/apis/meta/v1", + "k8s.io/apimachinery/pkg/runtime", + "k8s.io/apimachinery/pkg/runtime/schema", + "k8s.io/apimachinery/pkg/runtime/serializer", + "k8s.io/apimachinery/pkg/util/uuid", + "k8s.io/apiserver/pkg/util/logs", + "k8s.io/client-go/kubernetes", + "k8s.io/client-go/kubernetes/typed/core/v1", + "k8s.io/client-go/rest", + "k8s.io/client-go/tools/leaderelection", + "k8s.io/client-go/tools/leaderelection/resourcelock", + "k8s.io/client-go/tools/record", + "k8s.io/code-generator/cmd/deepcopy-gen", + "sigs.k8s.io/cluster-api/clusterctl/cmd", + "sigs.k8s.io/cluster-api/pkg/apis/cluster/common", + "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1", + "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset", + "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme", + "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1", + "sigs.k8s.io/cluster-api/pkg/controller/cluster", + "sigs.k8s.io/cluster-api/pkg/controller/config", + "sigs.k8s.io/cluster-api/pkg/controller/machine", + "sigs.k8s.io/cluster-api/pkg/controller/sharedinformers", + ] + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml new file mode 100644 index 000000000..08acff8c9 --- /dev/null +++ b/Gopkg.toml @@ -0,0 +1,37 @@ +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" +# +# [prune] +# non-go = false +# go-tests = true +# unused-packages = true + +required = [ + "k8s.io/code-generator/cmd/deepcopy-gen", +] + +[[constraint]] + name = "sigs.k8s.io/cluster-api" + branch = "master" + +[[constraint]] + name = "k8s.io/code-generator" + branch = "release-1.9" diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..30b9f9ffd --- /dev/null +++ b/Makefile @@ -0,0 +1,66 @@ +# Copyright 2018 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +.PHONY: gendeepcopy + +all: generate build images + +depend: + dep version || go get -u github.com/golang/dep/cmd/dep + dep ensure + +depend-update: + dep ensure -update + +generate: gendeepcopy + +gendeepcopy: + go build -o $$GOPATH/bin/deepcopy-gen github.com/kubermatic/cluster-api-provider-digitalocean/vendor/k8s.io/code-generator/cmd/deepcopy-gen + deepcopy-gen \ + -i ./cloud/digitalocean/providerconfig,./cloud/digitalocean/providerconfig/v1alpha1 \ + -O zz_generated.deepcopy \ + -h boilerplate.go.txt + +build: depend + CGO_ENABLED=0 go install -a -ldflags '-extldflags "-static"' github.com/kubermatic/cluster-api-provider-digitalocean/cmd/cluster-controller + CGO_ENABLED=0 go install -a -ldflags '-extldflags "-static"' github.com/kubermatic/cluster-api-provider-digitalocean/cmd/machine-controller + +images: depend + $(MAKE) -C cmd/cluster-controller image + $(MAKE) -C cmd/machine-controller image + +push: depend + $(MAKE) -C cmd/cluster-controller push + $(MAKE) -C cmd/machine-controller push + +check: depend fmt vet + +test: + go test -race -cover ./cmd/... ./cloud/... + +fmt: + hack/verify-gofmt.sh + +vet: + go vet ./... + +compile: + mkdir -p ./bin + go build -o ./bin/cluster-controller ./cmd/cluster-controller + go build -o ./bin/machine-controller ./cmd/machine-controller + go build -o ./bin/clusterctl ./clusterctl + +clean: + rm -rf ./bin + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 000000000..c5271bf33 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# cluster-api-provider-digitalocean \ No newline at end of file diff --git a/boilerplate.go.txt b/boilerplate.go.txt new file mode 100644 index 000000000..52a99d66e --- /dev/null +++ b/boilerplate.go.txt @@ -0,0 +1,12 @@ +// Copyright © 2018 The Kubernetes Authors. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. diff --git a/cloud/digitalocean/actuators/cluster/actuator.go b/cloud/digitalocean/actuators/cluster/actuator.go new file mode 100644 index 000000000..0bcac1ff5 --- /dev/null +++ b/cloud/digitalocean/actuators/cluster/actuator.go @@ -0,0 +1,51 @@ +// Copyright © 2018 The Kubernetes Authors. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cluster + +import ( + "fmt" + + "github.com/golang/glog" + clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + client "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" +) + +// Actuator is responsible for performing cluster reconciliation +type Actuator struct { + clusterClient client.ClusterInterface +} + +// ActuatorParams holds parameter information for Actuator +type ActuatorParams struct { + ClusterClient client.ClusterInterface +} + +// NewActuator creates a new Actuator +func NewActuator(params ActuatorParams) (*Actuator, error) { + return &Actuator{ + clusterClient: params.ClusterClient, + }, nil +} + +// Reconcile reconciles a cluster and is invoked by the Cluster Controller +func (a *Actuator) Reconcile(cluster *clusterv1.Cluster) error { + glog.Infof("Reconciling cluster %v.", cluster.Name) + return fmt.Errorf("TODO: Not yet implemented") +} + +// Delete deletes a cluster and is invoked by the Cluster Controller +func (a *Actuator) Delete(cluster *clusterv1.Cluster) error { + glog.Infof("Deleting cluster %v.", cluster.Name) + return fmt.Errorf("TODO: Not yet implemented") +} diff --git a/cloud/digitalocean/actuators/machine/actuator.go b/cloud/digitalocean/actuators/machine/actuator.go new file mode 100644 index 000000000..e8b16cd1b --- /dev/null +++ b/cloud/digitalocean/actuators/machine/actuator.go @@ -0,0 +1,76 @@ +// Copyright © 2018 The Kubernetes Authors. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package machine + +import ( + "fmt" + + "github.com/golang/glog" + clustercommon "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" + clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + client "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" +) + +const ( + ProviderName = "digitalocean" +) + +func init() { + actuator, err := NewActuator(ActuatorParams{}) + if err != nil { + glog.Fatalf("Error creating cluster provisioner for %v : %v", ProviderName, err) + } + clustercommon.RegisterClusterProvisioner(ProviderName, actuator) +} + +// Actuator is responsible for performing machine reconciliation +type Actuator struct { + clusterClient client.ClusterInterface +} + +// ActuatorParams holds parameter information for Actuator +type ActuatorParams struct { + ClusterClient client.ClusterInterface +} + +// NewActuator creates a new Actuator +func NewActuator(params ActuatorParams) (*Actuator, error) { + return &Actuator{ + clusterClient: params.ClusterClient, + }, nil +} + +// Create creates a machine and is invoked by the Machine Controller +func (a *Actuator) Create(cluster *clusterv1.Cluster, machine *clusterv1.Machine) error { + glog.Infof("Creating machine %v for cluster %v.", machine.Name, cluster.Name) + return fmt.Errorf("TODO: Not yet implemented") +} + +// Delete deletes a machine and is invoked by the Machine Controller +func (a *Actuator) Delete(cluster *clusterv1.Cluster, machine *clusterv1.Machine) error { + glog.Infof("Deleting machine %v for cluster %v.", machine.Name, cluster.Name) + return fmt.Errorf("TODO: Not yet implemented") +} + +// Update updates a machine and is invoked by the Machine Controller +func (a *Actuator) Update(cluster *clusterv1.Cluster, machine *clusterv1.Machine) error { + glog.Infof("Updating machine %v for cluster %v.", machine.Name, cluster.Name) + return fmt.Errorf("TODO: Not yet implemented") +} + +// Exists test for the existance of a machine and is invoked by the Machine Controller +func (a *Actuator) Exists(cluster *clusterv1.Cluster, machine *clusterv1.Machine) (bool, error) { + glog.Info("Checking if machine %v for cluster %v exists.", machine.Name, cluster.Name) + return false, fmt.Errorf("TODO: Not yet implemented") +} diff --git a/cloud/digitalocean/controllers/cluster/controller.go b/cloud/digitalocean/controllers/cluster/controller.go new file mode 100644 index 000000000..eca10613d --- /dev/null +++ b/cloud/digitalocean/controllers/cluster/controller.go @@ -0,0 +1,157 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cluster + +import ( + "os" + + "github.com/golang/glog" + "github.com/kubernetes-incubator/apiserver-builder/pkg/controller" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/uuid" + "k8s.io/client-go/kubernetes" + v1core "k8s.io/client-go/kubernetes/typed/core/v1" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/leaderelection" + "k8s.io/client-go/tools/leaderelection/resourcelock" + "k8s.io/client-go/tools/record" + "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" + clusterapiclientsetscheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" + "sigs.k8s.io/cluster-api/pkg/controller/cluster" + "sigs.k8s.io/cluster-api/pkg/controller/config" + "sigs.k8s.io/cluster-api/pkg/controller/sharedinformers" + + clusteractuator "github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/actuators/cluster" + "github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/controllers/cluster/options" +) + +const ( + controllerName = "digitalocean-cluster-controller" +) + +func Start(server *options.Server, shutdown <-chan struct{}) { + config, err := controller.GetConfig(server.CommonConfig.Kubeconfig) + if err != nil { + glog.Fatalf("Could not create Config for talking to the apiserver: %v", err) + } + + client, err := clientset.NewForConfig(config) + if err != nil { + glog.Fatalf("Could not create client for talking to the apiserver: %v", err) + } + + params := clusteractuator.ActuatorParams{ + ClusterClient: client.ClusterV1alpha1().Clusters(corev1.NamespaceDefault), + } + actuator, err := clusteractuator.NewActuator(params) + if err != nil { + glog.Fatalf("Could not create digitalocean cluster actuator: %v", err) + } + + si := sharedinformers.NewSharedInformers(config, shutdown) + c := cluster.NewClusterController(config, si, actuator) + c.RunAsync(shutdown) + + select {} +} + +func Run(server *options.Server) error { + kubeConfig, err := controller.GetConfig(server.CommonConfig.Kubeconfig) + if err != nil { + glog.Errorf("Could not create Config for talking to the apiserver: %v", err) + return err + } + + kubeClientControl, err := kubernetes.NewForConfig( + rest.AddUserAgent(kubeConfig, "cluster-controller-manager"), + ) + if err != nil { + glog.Errorf("Invalid API configuration for kubeconfig-control: %v", err) + return err + } + + recorder, err := createRecorder(kubeClientControl) + if err != nil { + glog.Errorf("Could not create event recorder : %v", err) + return err + } + + // run function will block and never return. + run := func(stop <-chan struct{}) { + Start(server, stop) + } + + leaderElectConfig := config.GetLeaderElectionConfig() + if !leaderElectConfig.LeaderElect { + run(make(<-chan (struct{}))) + } + + // Identity used to distinguish between multiple cluster controller instances. + id, err := os.Hostname() + if err != nil { + return err + } + + leaderElectionClient := kubernetes.NewForConfigOrDie(rest.AddUserAgent(kubeConfig, "cluster-leader-election")) + + id = id + "-" + string(uuid.NewUUID()) + // Lock required for leader election + rl, err := resourcelock.New( + leaderElectConfig.ResourceLock, + metav1.NamespaceSystem, + controllerName, + leaderElectionClient.CoreV1(), + resourcelock.ResourceLockConfig{ + Identity: id + "-" + controllerName, + EventRecorder: recorder, + }) + if err != nil { + return err + } + + // Try and become the leader and start cluster controller loops + leaderelection.RunOrDie(leaderelection.LeaderElectionConfig{ + Lock: rl, + LeaseDuration: leaderElectConfig.LeaseDuration.Duration, + RenewDeadline: leaderElectConfig.RenewDeadline.Duration, + RetryPeriod: leaderElectConfig.RetryPeriod.Duration, + Callbacks: leaderelection.LeaderCallbacks{ + OnStartedLeading: run, + OnStoppedLeading: func() { + glog.Fatalf("leaderelection lost") + }, + }, + }) + panic("unreachable") +} + +func createRecorder(kubeClient *kubernetes.Clientset) (record.EventRecorder, error) { + + eventsScheme := runtime.NewScheme() + if err := corev1.AddToScheme(eventsScheme); err != nil { + return nil, err + } + // We also emit events for our own types + clusterapiclientsetscheme.AddToScheme(eventsScheme) + + eventBroadcaster := record.NewBroadcaster() + eventBroadcaster.StartLogging(glog.Infof) + eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: v1core.New(kubeClient.CoreV1().RESTClient()).Events("")}) + return eventBroadcaster.NewRecorder(eventsScheme, corev1.EventSource{Component: controllerName}), nil +} diff --git a/cloud/digitalocean/controllers/cluster/options/options.go b/cloud/digitalocean/controllers/cluster/options/options.go new file mode 100644 index 000000000..fe5666042 --- /dev/null +++ b/cloud/digitalocean/controllers/cluster/options/options.go @@ -0,0 +1,32 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package options + +import ( + "sigs.k8s.io/cluster-api/pkg/controller/config" +) + +type Server struct { + CommonConfig *config.Configuration +} + +func NewServer() *Server { + s := Server{ + CommonConfig: &config.ControllerConfig, + } + return &s +} diff --git a/cloud/digitalocean/controllers/machine/controller.go b/cloud/digitalocean/controllers/machine/controller.go new file mode 100644 index 000000000..1691e1b15 --- /dev/null +++ b/cloud/digitalocean/controllers/machine/controller.go @@ -0,0 +1,157 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package machine + +import ( + "os" + + "github.com/golang/glog" + "github.com/kubernetes-incubator/apiserver-builder/pkg/controller" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/uuid" + "k8s.io/client-go/kubernetes" + v1core "k8s.io/client-go/kubernetes/typed/core/v1" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/leaderelection" + "k8s.io/client-go/tools/leaderelection/resourcelock" + "k8s.io/client-go/tools/record" + "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" + clusterapiclientsetscheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" + "sigs.k8s.io/cluster-api/pkg/controller/config" + machinecontroller "sigs.k8s.io/cluster-api/pkg/controller/machine" + "sigs.k8s.io/cluster-api/pkg/controller/sharedinformers" + + machineactuator "github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/actuators/machine" + "github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/controllers/machine/options" +) + +const ( + controllerName = "digitalocean-machine-controller" +) + +func Start(server *options.Server, shutdown <-chan struct{}) { + config, err := controller.GetConfig(server.CommonConfig.Kubeconfig) + if err != nil { + glog.Fatalf("Could not create Config for talking to the apiserver: %v", err) + } + + client, err := clientset.NewForConfig(config) + if err != nil { + glog.Fatalf("Could not create client for talking to the apiserver: %v", err) + } + + params := machineactuator.ActuatorParams{ + ClusterClient: client.ClusterV1alpha1().Clusters(corev1.NamespaceDefault), + } + actuator, err := machineactuator.NewActuator(params) + if err != nil { + glog.Fatalf("Could not create digitalocean machine actuator: %v", err) + } + + si := sharedinformers.NewSharedInformers(config, shutdown) + c := machinecontroller.NewMachineController(config, si, actuator) + c.RunAsync(shutdown) + + select {} +} + +func Run(server *options.Server) error { + kubeConfig, err := controller.GetConfig(server.CommonConfig.Kubeconfig) + if err != nil { + glog.Errorf("Could not create Config for talking to the apiserver: %v", err) + return err + } + + kubeClientControl, err := kubernetes.NewForConfig( + rest.AddUserAgent(kubeConfig, "machine-controller-manager"), + ) + if err != nil { + glog.Errorf("Invalid API configuration for kubeconfig-control: %v", err) + return err + } + + recorder, err := createRecorder(kubeClientControl) + if err != nil { + glog.Errorf("Could not create event recorder : %v", err) + return err + } + + // run function will block and never return. + run := func(stop <-chan struct{}) { + Start(server, stop) + } + + leaderElectConfig := config.GetLeaderElectionConfig() + if !leaderElectConfig.LeaderElect { + run(make(<-chan (struct{}))) + } + + // Identity used to distinguish between multiple machine controller instances. + id, err := os.Hostname() + if err != nil { + return err + } + + leaderElectionClient := kubernetes.NewForConfigOrDie(rest.AddUserAgent(kubeConfig, "machine-leader-election")) + + id = id + "-" + string(uuid.NewUUID()) + // Lock required for leader election + rl, err := resourcelock.New( + leaderElectConfig.ResourceLock, + metav1.NamespaceSystem, + controllerName, + leaderElectionClient.CoreV1(), + resourcelock.ResourceLockConfig{ + Identity: id + "-" + controllerName, + EventRecorder: recorder, + }) + if err != nil { + return err + } + + // Try and become the leader and start machine controller loops + leaderelection.RunOrDie(leaderelection.LeaderElectionConfig{ + Lock: rl, + LeaseDuration: leaderElectConfig.LeaseDuration.Duration, + RenewDeadline: leaderElectConfig.RenewDeadline.Duration, + RetryPeriod: leaderElectConfig.RetryPeriod.Duration, + Callbacks: leaderelection.LeaderCallbacks{ + OnStartedLeading: run, + OnStoppedLeading: func() { + glog.Fatalf("leaderelection lost") + }, + }, + }) + panic("unreachable") +} + +func createRecorder(kubeClient *kubernetes.Clientset) (record.EventRecorder, error) { + + eventsScheme := runtime.NewScheme() + if err := corev1.AddToScheme(eventsScheme); err != nil { + return nil, err + } + // We also emit events for our own types + clusterapiclientsetscheme.AddToScheme(eventsScheme) + + eventBroadcaster := record.NewBroadcaster() + eventBroadcaster.StartLogging(glog.Infof) + eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: v1core.New(kubeClient.CoreV1().RESTClient()).Events("")}) + return eventBroadcaster.NewRecorder(eventsScheme, corev1.EventSource{Component: controllerName}), nil +} diff --git a/cloud/digitalocean/controllers/machine/options/options.go b/cloud/digitalocean/controllers/machine/options/options.go new file mode 100644 index 000000000..fe5666042 --- /dev/null +++ b/cloud/digitalocean/controllers/machine/options/options.go @@ -0,0 +1,32 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package options + +import ( + "sigs.k8s.io/cluster-api/pkg/controller/config" +) + +type Server struct { + CommonConfig *config.Configuration +} + +func NewServer() *Server { + s := Server{ + CommonConfig: &config.ControllerConfig, + } + return &s +} diff --git a/cloud/digitalocean/providerconfig/doc.go b/cloud/digitalocean/providerconfig/doc.go new file mode 100644 index 000000000..26dd3c712 --- /dev/null +++ b/cloud/digitalocean/providerconfig/doc.go @@ -0,0 +1,19 @@ +// Copyright © 2018 The Kubernetes Authors. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/providerconfig +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +package providerconfig diff --git a/cloud/digitalocean/providerconfig/register.go b/cloud/digitalocean/providerconfig/register.go new file mode 100644 index 000000000..832901fb8 --- /dev/null +++ b/cloud/digitalocean/providerconfig/register.go @@ -0,0 +1,57 @@ +// Copyright © 2018 The Kubernetes Authors. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package providerconfig + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + SchemeBuilder runtime.SchemeBuilder + AddToScheme = SchemeBuilder.AddToScheme + localSchemeBuilder = &SchemeBuilder +) + +func init() { + localSchemeBuilder.Register(addKnownTypes) +} + +const GroupName = "digitaloceanproviderconfig" + +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &DigitalOceanMachineProviderConfig{}, + ) + scheme.AddKnownTypes(SchemeGroupVersion, + &DigitalOceanClusterProviderConfig{}, + ) + scheme.AddKnownTypes(SchemeGroupVersion, + &DigitalOceanMachineProviderStatus{}, + ) + scheme.AddKnownTypes(SchemeGroupVersion, + &DigitalOceanClusterProviderStatus{}, + ) + return nil +} diff --git a/cloud/digitalocean/providerconfig/types.go b/cloud/digitalocean/providerconfig/types.go new file mode 100644 index 000000000..32e5f3089 --- /dev/null +++ b/cloud/digitalocean/providerconfig/types.go @@ -0,0 +1,38 @@ +// Copyright © 2018 The Kubernetes Authors. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package providerconfig + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type DigitalOceanMachineProviderConfig struct { + metav1.TypeMeta `json:",inline"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type DigitalOceanClusterProviderConfig struct { + metav1.TypeMeta `json:",inline"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type DigitalOceanMachineProviderStatus struct { + metav1.TypeMeta `json:",inline"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type DigitalOceanClusterProviderStatus struct { + metav1.TypeMeta `json:",inline"` +} diff --git a/cloud/digitalocean/providerconfig/v1alpha1/doc.go b/cloud/digitalocean/providerconfig/v1alpha1/doc.go new file mode 100644 index 000000000..b139a24ef --- /dev/null +++ b/cloud/digitalocean/providerconfig/v1alpha1/doc.go @@ -0,0 +1,19 @@ +// Copyright © 2018 The Kubernetes Authors. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/providerconfig +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +package v1alpha1 diff --git a/cloud/digitalocean/providerconfig/v1alpha1/register.go b/cloud/digitalocean/providerconfig/v1alpha1/register.go new file mode 100644 index 000000000..03542fcae --- /dev/null +++ b/cloud/digitalocean/providerconfig/v1alpha1/register.go @@ -0,0 +1,138 @@ +// Copyright © 2018 The Kubernetes Authors. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +import ( + "bytes" + "fmt" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/runtime/serializer" + clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + + "github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/providerconfig" +) + +// +k8s:deepcopy-gen=false +type DigitalOceanProviderConfigCodec struct { + encoder runtime.Encoder + decoder runtime.Decoder +} + +const GroupName = "digitaloceanproviderconfig" + +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +var ( + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + localSchemeBuilder.Register(addKnownTypes) +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &DigitalOceanMachineProviderConfig{}, + ) + scheme.AddKnownTypes(SchemeGroupVersion, + &DigitalOceanClusterProviderConfig{}, + ) + scheme.AddKnownTypes(SchemeGroupVersion, + &DigitalOceanMachineProviderStatus{}, + ) + scheme.AddKnownTypes(SchemeGroupVersion, + &DigitalOceanClusterProviderStatus{}, + ) + return nil +} + +func NewScheme() (*runtime.Scheme, error) { + scheme := runtime.NewScheme() + if err := AddToScheme(scheme); err != nil { + return nil, err + } + if err := providerconfig.AddToScheme(scheme); err != nil { + return nil, err + } + return scheme, nil +} + +func NewCodec() (*DigitalOceanProviderConfigCodec, error) { + scheme, err := NewScheme() + if err != nil { + return nil, err + } + codecFactory := serializer.NewCodecFactory(scheme) + encoder, err := newEncoder(&codecFactory) + if err != nil { + return nil, err + } + codec := DigitalOceanProviderConfigCodec{ + encoder: encoder, + decoder: codecFactory.UniversalDecoder(SchemeGroupVersion), + } + return &codec, nil +} + +func (codec *DigitalOceanProviderConfigCodec) DecodeFromProviderConfig(providerConfig clusterv1.ProviderConfig, out runtime.Object) error { + if providerConfig.Value != nil { + _, _, err := codec.decoder.Decode(providerConfig.Value.Raw, nil, out) + if err != nil { + return fmt.Errorf("decoding failure: %v", err) + } + } + return nil +} + +func (codec *DigitalOceanProviderConfigCodec) EncodeToProviderConfig(in runtime.Object) (*clusterv1.ProviderConfig, error) { + var buf bytes.Buffer + if err := codec.encoder.Encode(in, &buf); err != nil { + return nil, fmt.Errorf("encoding failed: %v", err) + } + return &clusterv1.ProviderConfig{ + Value: &runtime.RawExtension{Raw: buf.Bytes()}, + }, nil +} + +func (codec *DigitalOceanProviderConfigCodec) EncodeProviderStatus(in runtime.Object) (*runtime.RawExtension, error) { + var buf bytes.Buffer + if err := codec.encoder.Encode(in, &buf); err != nil { + return nil, fmt.Errorf("encoding failed: %v", err) + } + + return &runtime.RawExtension{Raw: buf.Bytes()}, nil +} + +func (codec *DigitalOceanProviderConfigCodec) DecodeProviderStatus(providerStatus *runtime.RawExtension, out runtime.Object) error { + if providerStatus != nil { + _, _, err := codec.decoder.Decode(providerStatus.Raw, nil, out) + if err != nil { + return fmt.Errorf("decoding failure: %v", err) + } + } + return nil +} + +func newEncoder(codecFactory *serializer.CodecFactory) (runtime.Encoder, error) { + serializerInfos := codecFactory.SupportedMediaTypes() + if len(serializerInfos) == 0 { + return nil, fmt.Errorf("unable to find any serlializers") + } + encoder := codecFactory.EncoderForVersion(serializerInfos[0].Serializer, SchemeGroupVersion) + return encoder, nil +} diff --git a/cloud/digitalocean/providerconfig/v1alpha1/types.go b/cloud/digitalocean/providerconfig/v1alpha1/types.go new file mode 100644 index 000000000..7f0869552 --- /dev/null +++ b/cloud/digitalocean/providerconfig/v1alpha1/types.go @@ -0,0 +1,38 @@ +// Copyright © 2018 The Kubernetes Authors. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type DigitalOceanMachineProviderConfig struct { + metav1.TypeMeta `json:",inline"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type DigitalOceanClusterProviderConfig struct { + metav1.TypeMeta `json:",inline"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type DigitalOceanMachineProviderStatus struct { + metav1.TypeMeta `json:",inline"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type DigitalOceanClusterProviderStatus struct { + metav1.TypeMeta `json:",inline"` +} diff --git a/cloud/digitalocean/providerconfig/v1alpha1/zz_generated.deepcopy.go b/cloud/digitalocean/providerconfig/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..a9b5374c8 --- /dev/null +++ b/cloud/digitalocean/providerconfig/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,122 @@ +// +build !ignore_autogenerated + +// Copyright © 2018 The Kubernetes Authors. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DigitalOceanClusterProviderConfig) DeepCopyInto(out *DigitalOceanClusterProviderConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DigitalOceanClusterProviderConfig. +func (in *DigitalOceanClusterProviderConfig) DeepCopy() *DigitalOceanClusterProviderConfig { + if in == nil { + return nil + } + out := new(DigitalOceanClusterProviderConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DigitalOceanClusterProviderConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DigitalOceanClusterProviderStatus) DeepCopyInto(out *DigitalOceanClusterProviderStatus) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DigitalOceanClusterProviderStatus. +func (in *DigitalOceanClusterProviderStatus) DeepCopy() *DigitalOceanClusterProviderStatus { + if in == nil { + return nil + } + out := new(DigitalOceanClusterProviderStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DigitalOceanClusterProviderStatus) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DigitalOceanMachineProviderConfig) DeepCopyInto(out *DigitalOceanMachineProviderConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DigitalOceanMachineProviderConfig. +func (in *DigitalOceanMachineProviderConfig) DeepCopy() *DigitalOceanMachineProviderConfig { + if in == nil { + return nil + } + out := new(DigitalOceanMachineProviderConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DigitalOceanMachineProviderConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DigitalOceanMachineProviderStatus) DeepCopyInto(out *DigitalOceanMachineProviderStatus) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DigitalOceanMachineProviderStatus. +func (in *DigitalOceanMachineProviderStatus) DeepCopy() *DigitalOceanMachineProviderStatus { + if in == nil { + return nil + } + out := new(DigitalOceanMachineProviderStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DigitalOceanMachineProviderStatus) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/cloud/digitalocean/providerconfig/zz_generated.deepcopy.go b/cloud/digitalocean/providerconfig/zz_generated.deepcopy.go new file mode 100644 index 000000000..ba44b5c80 --- /dev/null +++ b/cloud/digitalocean/providerconfig/zz_generated.deepcopy.go @@ -0,0 +1,122 @@ +// +build !ignore_autogenerated + +// Copyright © 2018 The Kubernetes Authors. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package providerconfig + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DigitalOceanClusterProviderConfig) DeepCopyInto(out *DigitalOceanClusterProviderConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DigitalOceanClusterProviderConfig. +func (in *DigitalOceanClusterProviderConfig) DeepCopy() *DigitalOceanClusterProviderConfig { + if in == nil { + return nil + } + out := new(DigitalOceanClusterProviderConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DigitalOceanClusterProviderConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DigitalOceanClusterProviderStatus) DeepCopyInto(out *DigitalOceanClusterProviderStatus) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DigitalOceanClusterProviderStatus. +func (in *DigitalOceanClusterProviderStatus) DeepCopy() *DigitalOceanClusterProviderStatus { + if in == nil { + return nil + } + out := new(DigitalOceanClusterProviderStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DigitalOceanClusterProviderStatus) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DigitalOceanMachineProviderConfig) DeepCopyInto(out *DigitalOceanMachineProviderConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DigitalOceanMachineProviderConfig. +func (in *DigitalOceanMachineProviderConfig) DeepCopy() *DigitalOceanMachineProviderConfig { + if in == nil { + return nil + } + out := new(DigitalOceanMachineProviderConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DigitalOceanMachineProviderConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DigitalOceanMachineProviderStatus) DeepCopyInto(out *DigitalOceanMachineProviderStatus) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DigitalOceanMachineProviderStatus. +func (in *DigitalOceanMachineProviderStatus) DeepCopy() *DigitalOceanMachineProviderStatus { + if in == nil { + return nil + } + out := new(DigitalOceanMachineProviderStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DigitalOceanMachineProviderStatus) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/clusterctl/examples/digitalocean/.gitignore b/clusterctl/examples/digitalocean/.gitignore new file mode 100644 index 000000000..89f9ac04a --- /dev/null +++ b/clusterctl/examples/digitalocean/.gitignore @@ -0,0 +1 @@ +out/ diff --git a/clusterctl/examples/digitalocean/README.md b/clusterctl/examples/digitalocean/README.md new file mode 100644 index 000000000..e455b3e13 --- /dev/null +++ b/clusterctl/examples/digitalocean/README.md @@ -0,0 +1,24 @@ +# Openstack Example Files +## Contents +*.yaml files - concrete example files that can be used as is. +*.yaml.template files - template example files that need values filled in before use. + +## Generation +For convenience, a generation script which populates templates based on openstack cloud provider +configuration is provided. + +1. Run the generation script. +``` +./generate-yaml.sh +``` + +If yaml file already exists, you will see an error like the one below: + +``` +$ ./generate-yaml.sh +File provider-components.yaml already exists. Delete it manually before running this script. +``` + +## Manual Modification +You may always manually curate files based on the examples provided. + diff --git a/clusterctl/examples/digitalocean/cluster.yaml.template b/clusterctl/examples/digitalocean/cluster.yaml.template new file mode 100644 index 000000000..16bce7ed9 --- /dev/null +++ b/clusterctl/examples/digitalocean/cluster.yaml.template @@ -0,0 +1,16 @@ +apiVersion: "cluster.k8s.io/v1alpha1" +kind: Cluster +metadata: + name: test1 +spec: + clusterNetwork: + services: + cidrBlocks: ["10.96.0.0/12"] + pods: + cidrBlocks: ["192.168.0.0/16"] + serviceDomain: "cluster.local" + providerConfig: + value: + apiVersion: "digitaloceanproviderconfig/v1alpha1" + kind: "DigitaloceanClusterProviderConfig" + diff --git a/clusterctl/examples/digitalocean/generate-yaml.sh b/clusterctl/examples/digitalocean/generate-yaml.sh new file mode 100644 index 000000000..c24d51cfd --- /dev/null +++ b/clusterctl/examples/digitalocean/generate-yaml.sh @@ -0,0 +1,54 @@ +#!/bin/sh +set -e + +PROVIDERCOMPONENT_TEMPLATE_FILE=provider-components.yaml.template +PROVIDERCOMPONENT_GENERATED_FILE=provider-components.yaml + +OVERWRITE=0 + +SCRIPT=$(basename $0) +while test $# -gt 0; do + case "$1" in + -h|--help) + echo "$SCRIPT - generates input yaml files for Cluster API on openstack" + echo " " + echo "$SCRIPT [options]" + echo " " + echo "options:" + echo "-h, --help show brief help" + echo "-f, --force-overwrite if file to be generated already exists, force script to overwrite it" + exit 0 + ;; + -f) + OVERWRITE=1 + shift + ;; + --force-overwrite) + OVERWRITE=1 + shift + ;; + *) + break + ;; + esac +done + +if [ $OVERWRITE -ne 1 ] && [ -f $PROVIDERCOMPONENT_GENERATED_FILE ]; then + echo "File $PROVIDERCOMPONENT_GENERATED_FILE already exists. Delete it manually before running this script." + exit 1 +fi + +OS=$(uname) +if [[ "$OS" =~ "Linux" ]]; then +elif [[ "$OS" =~ "Darwin" ]]; then +else + echo "Unrecognized OS : $OS" + exit 1 +fi + +cat $PROVIDERCOMPONENT_TEMPLATE_FILE \ + > $PROVIDERCOMPONENT_GENERATED_FILE + +echo "Done generating $PROVIDERCOMPONENT_GENERATED_FILE" +echo "You will still need to generate the cluster.yaml and machines.yaml" + diff --git a/clusterctl/examples/digitalocean/machines.yaml.template b/clusterctl/examples/digitalocean/machines.yaml.template new file mode 100644 index 000000000..23aea85dc --- /dev/null +++ b/clusterctl/examples/digitalocean/machines.yaml.template @@ -0,0 +1,15 @@ +items: +- apiVersion: "cluster.k8s.io/v1alpha1" + kind: Machine + metadata: + generateName: digitalocean-controlplane- + labels: + set: controlplane + spec: +- apiVersion: "cluster.k8s.io/v1alpha1" + kind: Machine + metadata: + generateName: digitalocean-node- + labels: + set: node + spec: diff --git a/clusterctl/examples/digitalocean/provider-components.yaml.template b/clusterctl/examples/digitalocean/provider-components.yaml.template new file mode 100644 index 000000000..f6d438527 --- /dev/null +++ b/clusterctl/examples/digitalocean/provider-components.yaml.template @@ -0,0 +1,101 @@ +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + name: clusterapi-controllers + labels: + api: clusterapi +spec: + replicas: 1 + template: + metadata: + labels: + api: clusterapi + spec: + nodeSelector: + node-role.kubernetes.io/master: "" + tolerations: + - effect: NoSchedule + key: node-role.kubernetes.io/master + - key: CriticalAddonsOnly + operator: Exists + - effect: NoExecute + key: node.alpha.kubernetes.io/notReady + operator: Exists + - effect: NoExecute + key: node.alpha.kubernetes.io/unreachable + operator: Exists + containers: + - name: controller-manager + image: gcr.io/k8s-cluster-api/controller-manager:0.0.7 + volumeMounts: + - name: config + mountPath: /etc/kubernetes + - name: certs + mountPath: /etc/ssl/certs + command: + - "./controller-manager" + args: + - --kubeconfig=/etc/kubernetes/admin.conf + - --leader-elect + resources: + requests: + cpu: 100m + memory: 20Mi + limits: + cpu: 100m + memory: 30Mi + - name: digitalocean-cluster-controller + image: gcr.io/k8s-cluster-api/digitalocean-cluster-controller:0.0.1 + volumeMounts: + - name: config + mountPath: /etc/kubernetes + - name: certs + mountPath: /etc/ssl/certs + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + command: + - "./cluster-controller" + args: + - --kubeconfig=/etc/kubernetes/admin.conf + - --leader-elect + resources: + requests: + cpu: 200m + memory: 200Mi + limits: + cpu: 400m + memory: 500Mi + - name: digitalocean-machine-controller + image: gcr.io/k8s-cluster-api/digitalocean-machine-controller:0.0.1 + volumeMounts: + - name: config + mountPath: /etc/kubernetes + - name: certs + mountPath: /etc/ssl/certs + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + command: + - "./machine-controller" + args: + - --kubeconfig=/etc/kubernetes/admin.conf + - --leader-elect + resources: + requests: + cpu: 200m + memory: 200Mi + limits: + cpu: 400m + memory: 500Mi + volumes: + - name: config + hostPath: + path: /etc/kubernetes + - name: certs + hostPath: + path: /etc/ssl/certs diff --git a/clusterctl/main.go b/clusterctl/main.go new file mode 100644 index 000000000..716cbe0e9 --- /dev/null +++ b/clusterctl/main.go @@ -0,0 +1,26 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + _ "github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/actuators/machine" + "sigs.k8s.io/cluster-api/clusterctl/cmd" +) + +func main() { + cmd.Execute() +} diff --git a/cmd/cluster-controller/Dockerfile b/cmd/cluster-controller/Dockerfile new file mode 100644 index 000000000..081c24d51 --- /dev/null +++ b/cmd/cluster-controller/Dockerfile @@ -0,0 +1,29 @@ +# Copyright 2018 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Reproducible builder image +FROM golang:1.10.0 as builder +WORKDIR /go/src/github.com/kubermatic/cluster-api-provider-digitalocean +# This expects that the context passed to the docker build command is +# the cluster-api-provider-digitalocean directory. +# e.g. docker build -t -f +COPY . . + +RUN CGO_ENABLED=0 GOOS=linux go install -a -ldflags '-extldflags "-static"' github.com/kubermatic/cluster-api-provider-digitalocean/cmd/cluster-controller + +# Final container +FROM debian:stretch-slim +RUN apt-get update && apt-get install -y ca-certificates openssh-server && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /go/bin/cluster-controller . diff --git a/cmd/cluster-controller/Makefile b/cmd/cluster-controller/Makefile new file mode 100644 index 000000000..5dee0ace5 --- /dev/null +++ b/cmd/cluster-controller/Makefile @@ -0,0 +1,38 @@ +# Copyright 2018 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +.PHONY: image + +GCR_BUCKET = k8s-cluster-api +PREFIX = gcr.io/$(GCR_BUCKET) +DEV_PREFIX ?= gcr.io/$(shell gcloud config get-value project) +NAME = digitalocean-cluster-controller +TAG = 0.0.1 + +image: + docker build -t "$(PREFIX)/$(NAME):$(TAG)" -f ./Dockerfile ../.. + +push: image + docker push "$(PREFIX)/$(NAME):$(TAG)" + $(MAKE) fix_gcs_permissions + +fix_gcs_permissions: + gsutil acl ch -u AllUsers:READ gs://artifacts.$(GCR_BUCKET).appspot.com + gsutil -m acl ch -r -u AllUsers:READ gs://artifacts.$(GCR_BUCKET).appspot.com + +dev_image: + docker build -t "$(DEV_PREFIX)/$(NAME):$(TAG)-dev" -f ./Dockerfile ../.. + +dev_push: dev_image + docker push "$(DEV_PREFIX)/$(NAME):$(TAG)-dev" diff --git a/cmd/cluster-controller/main.go b/cmd/cluster-controller/main.go new file mode 100644 index 000000000..6ed254c70 --- /dev/null +++ b/cmd/cluster-controller/main.go @@ -0,0 +1,47 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "flag" + + "github.com/golang/glog" + "github.com/spf13/pflag" + "k8s.io/apiserver/pkg/util/logs" + "sigs.k8s.io/cluster-api/pkg/controller/config" + + "github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/controllers/cluster" + "github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/controllers/cluster/options" +) + +func init() { + config.ControllerConfig.AddFlags(pflag.CommandLine) +} + +func main() { + // the following line exists to make glog happy, for more information, see: https://github.com/kubernetes/kubernetes/issues/17162 + flag.CommandLine.Parse([]string{}) + pflag.Parse() + + logs.InitLogs() + defer logs.FlushLogs() + + clusterServer := options.NewServer() + if err := cluster.Run(clusterServer); err != nil { + glog.Errorf("Failed to start cluster controller. Err: %v", err) + } +} diff --git a/cmd/machine-controller/Dockerfile b/cmd/machine-controller/Dockerfile new file mode 100644 index 000000000..e3f96a345 --- /dev/null +++ b/cmd/machine-controller/Dockerfile @@ -0,0 +1,29 @@ +# Copyright 2018 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Reproducible builder image +FROM golang:1.10.0 as builder +WORKDIR /go/src/github.com/kubermatic/cluster-api-provider-digitalocean +# This expects that the context passed to the docker build command is +# the cluster-api-provider-digitalocean directory. +# e.g. docker build -t -f +COPY . . + +RUN CGO_ENABLED=0 GOOS=linux go install -a -ldflags '-extldflags "-static"' github.com/kubermatic/cluster-api-provider-digitalocean/cmd/machine-digitalocean + +# Final container +FROM debian:stretch-slim +RUN apt-get update && apt-get install -y ca-certificates openssh-server && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /go/bin/machine-controller . diff --git a/cmd/machine-controller/Makefile b/cmd/machine-controller/Makefile new file mode 100644 index 000000000..8c6a0c448 --- /dev/null +++ b/cmd/machine-controller/Makefile @@ -0,0 +1,38 @@ +# Copyright 2018 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +.PHONY: image + +GCR_BUCKET = k8s-cluster-api +PREFIX = gcr.io/$(GCR_BUCKET) +DEV_PREFIX ?= gcr.io/$(shell gcloud config get-value project) +NAME = digitalocean-machine-controller +TAG = 0.0.1 + +image: + docker build -t "$(PREFIX)/$(NAME):$(TAG)" -f ./Dockerfile ../.. + +push: image + docker push "$(PREFIX)/$(NAME):$(TAG)" + $(MAKE) fix_gcs_permissions + +fix_gcs_permissions: + gsutil acl ch -u AllUsers:READ gs://artifacts.$(GCR_BUCKET).appspot.com + gsutil -m acl ch -r -u AllUsers:READ gs://artifacts.$(GCR_BUCKET).appspot.com + +dev_image: + docker build -t "$(DEV_PREFIX)/$(NAME):$(TAG)-dev" -f ./Dockerfile ../.. + +dev_push: dev_image + docker push "$(DEV_PREFIX)/$(NAME):$(TAG)-dev" diff --git a/cmd/machine-controller/main.go b/cmd/machine-controller/main.go new file mode 100644 index 000000000..2d40c14c0 --- /dev/null +++ b/cmd/machine-controller/main.go @@ -0,0 +1,47 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "flag" + + "github.com/golang/glog" + "github.com/spf13/pflag" + "k8s.io/apiserver/pkg/util/logs" + "sigs.k8s.io/cluster-api/pkg/controller/config" + + "github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/controllers/machine" + "github.com/kubermatic/cluster-api-provider-digitalocean/cloud/digitalocean/controllers/machine/options" +) + +func init() { + config.ControllerConfig.AddFlags(pflag.CommandLine) +} + +func main() { + // the following line exists to make glog happy, for more information, see: https://github.com/kubernetes/kubernetes/issues/17162 + flag.CommandLine.Parse([]string{}) + pflag.Parse() + + logs.InitLogs() + defer logs.FlushLogs() + + machineServer := options.NewServer() + if err := machine.Run(machineServer); err != nil { + glog.Errorf("Failed to start the machine controller. Err: %v", err) + } +} diff --git a/code-of-conduct.md b/code-of-conduct.md new file mode 100644 index 000000000..0d15c00cf --- /dev/null +++ b/code-of-conduct.md @@ -0,0 +1,3 @@ +# Kubernetes Community Code of Conduct + +Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md) diff --git a/hack/update-gofmt.sh b/hack/update-gofmt.sh new file mode 100755 index 000000000..a14aecbbd --- /dev/null +++ b/hack/update-gofmt.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Copyright 2017 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o errexit +set -o nounset +set -o pipefail + +find . -name "*.go" | grep -v "\/vendor\/" | xargs gofmt -s -w diff --git a/hack/verify-gofmt.sh b/hack/verify-gofmt.sh new file mode 100755 index 000000000..693412cc5 --- /dev/null +++ b/hack/verify-gofmt.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# Copyright 2017 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o errexit +set -o nounset +set -o pipefail + +if ! which gofmt > /dev/null; then + echo "Can not find gofmt" + exit 1 +fi + +diff=$(find . -name "*.go" | grep -v "\/vendor\/" | xargs gofmt -s -d 2>&1) +if [[ -n "${diff}" ]]; then + echo "${diff}" + echo + echo "Please run hack/update-gofmt.sh" + exit 1 +fi