diff --git a/.golangci.yml b/.golangci.yml index 494a907..c0e5d7a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -108,12 +108,10 @@ linters: - govet - gocyclo - gocritic - - interfacer - goconst - goimports - gofmt # We enable this as well as goimports for its simplify mode. - prealloc - - golint - unconvert - misspell - nakedret @@ -134,7 +132,6 @@ issues: - errcheck - dupl - gosec - - scopelint - unparam # Ease some gocritic warnings on test files. diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..723f832 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,96 @@ +# Building and Installing the Crossplane Vultr Provider + +`provider-vultr` is composed of a golang project and can be built directly with standard `golang` tools. We currently support two different platforms for building: + +* Linux: most modern distros should work although most testing has been done on Ubuntu +* Mac: macOS 10.6+ is supported + +## Build Requirements + +An Intel-based machine (recommend 2+ cores, 2+ GB of memory and 128GB of SSD). Inside your build environment (Docker for Mac or a VM), 6+ GB memory is also recommended. + +The following tools are need on the host: + +* curl +* docker (1.12+) or Docker for Mac (17+) +* git +* make +* golang +* rsync (if you're using the build container on mac) +* helm (v2.8.2+) +* kubebuilder (v1.0.4+) + +## Build +You can build the Crossplane Vultr Provider for the host platform by simply running the command below. +Building in parallel with the `-j` option is recommended. + +```console +make -j4 +``` + +The first time `make` is run, the build submodule will be synced and +updated. After initial setup, it can be updated by running `make submodules`. + +Run `make help` for more options. + +## Building inside the cross container + +Official Crossplane builds are done inside a build container. This ensures that we get a consistent build, test and release environment. To run the build inside the cross container run: + +```console +build/run make -j4 +``` + +The first run of `build/run` will build the container itself and could take a few minutes to complete, but subsequent builds should go much faster. + +## Install Crossplane in Your Cluster +Once your Cluster is up and running, you'll need to install Crossplane. + +We recommend using Helm to install Crossplane. You can find the [official documentation here](https://crossplane.io/docs/v1.5/getting-started/install-configure.html#install-crossplane). These are the commands: + +```console +kubectl create namespace crossplane-system + +helm repo add crossplane-stable https://charts.crossplane.io/stable +helm repo update + +helm install crossplane --namespace crossplane-system crossplane-stable/crossplane +``` + +## Getting started + +Next install this Vultr Crossplane provider: +```bash +# clone this repo +git clone git@github.com:vultr/crossplane-provider-vultr.git +cd provider-vultr + +# install the crds +kubectl apply -f package/crds +``` + +Run the provider: +```bash +make run +``` + +Configure the provider: +```bash +# change the examples/secret.yaml to use your VULTR_API_KEY +kubectl apply -f examples/providerconfig/secret.yaml +kubectl apply -f examples/providerconfig/providerconfig.yaml +``` + + +## Provision Vultr Resources + +Go to the [examples-generated](./examples-generated) directory in this repo, find the Vultr product you'd like to deploy, make any needed changes to the yaml file, and then create the resource. + +For example, if you'd like to spin up a VKE Cluster, run the command + +```console +kubectl apply -f examples-generated/vultr/kubernetes.yaml +# wait a bit +kubectl get managed +``` +and check your Vultr account to see if the resource has been created. \ No newline at end of file diff --git a/Makefile b/Makefile index df9cd23..5f18a54 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,9 @@ export TERRAFORM_VERSION ?= 1.3.3 export TERRAFORM_PROVIDER_SOURCE ?= vultr/vultr export TERRAFORM_PROVIDER_REPO ?= https://github.com/vultr/terraform-provider-vultr -export TERRAFORM_PROVIDER_VERSION ?= 2.15.0 +export TERRAFORM_PROVIDER_VERSION ?= 2.15.1 export TERRAFORM_PROVIDER_DOWNLOAD_NAME ?= terraform-provider-vultr -export TERRAFORM_NATIVE_PROVIDER_BINARY ?= terraform-provider-vultr_2.15.0 +export TERRAFORM_NATIVE_PROVIDER_BINARY ?= terraform-provider-vultr_2.15.1 export TERRAFORM_DOCS_PATH ?= website/docs/r PLATFORMS ?= linux_amd64 linux_arm64 @@ -39,7 +39,7 @@ NPROCS ?= 1 GO_TEST_PARALLEL := $(shell echo $$(( $(NPROCS) / 2 ))) GO_REQUIRED_VERSION ?= 1.20 -GOLANGCILINT_VERSION ?= 1.50.0 +GOLANGCILINT_VERSION ?= 1.54.2 GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider $(GO_PROJECT)/cmd/generator GO_LDFLAGS += -X $(GO_PROJECT)/internal/version.Version=$(VERSION) GO_SUBDIRS += cmd internal apis @@ -49,9 +49,9 @@ GO_SUBDIRS += cmd internal apis # Setup Kubernetes tools KIND_VERSION = v0.15.0 -UP_VERSION = v0.14.0 +UP_VERSION = v0.18.0 UP_CHANNEL = stable -UPTEST_VERSION = v0.2.1 +UPTEST_VERSION = v0.5.0 -include build/makelib/k8s_tools.mk # ==================================================================================== @@ -198,4 +198,4 @@ crossplane.help: help-special: crossplane.help -.PHONY: crossplane.help help-special +.PHONY: crossplane.help help-special \ No newline at end of file diff --git a/README.md b/README.md index 274bab0..f317cf1 100644 --- a/README.md +++ b/README.md @@ -5,56 +5,68 @@ is built using [Upjet](https://github.com/upbound/upjet) code generation tools and exposes XRM-conformant managed resources for the Vultr API. -## Getting Started +## Overview -Install the provider by using the following command after changing the image tag -to the [latest release](https://marketplace.upbound.io/providers/crossplane-contrib/provider-vultr): -``` -up ctp provider install crossplane-contrib/provider-vultr:v0.1.0 -``` +This `provider-vultr` repository is the Crossplane infrastructure provider for +[vultr](https://vultr.com/). The provider that is built from +the source code in this repository can be installed into a Crossplane control +plane and adds the following new functionality: -Alternatively, you can use declarative installation: -``` -cat <