Skip to content

Commit

Permalink
Update to use reasonably recent dependencies (PR #160 from joyent/kusor)
Browse files Browse the repository at this point in the history
- Migrate from deps to Go 1.11+ modules
- Update triton-go to v1.8.4
- Update providers to terraform 0.12
- Bump Terraform Triton provider to 0.7.0
- Update Docker from 17.03 to 19.03
- Upgrade to rancher v2.4.4
- Allow overriding docker_engine_install_url from config file
- Update to build using git tags
  • Loading branch information
kusor authored Jun 10, 2020
2 parents 182b1a2 + bca8d54 commit ca1760e
Show file tree
Hide file tree
Showing 11,323 changed files with 2,121 additions and 7,787,435 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
418 changes: 0 additions & 418 deletions Gopkg.lock

This file was deleted.

66 changes: 0 additions & 66 deletions Gopkg.toml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=0.9.1-pre2
VERSION=$(shell git describe --tags)
LDFLAGS=-X github.com/joyent/triton-kubernetes/cmd.cliVersion=$(shell git rev-list -1 HEAD)
BUILD_PATH=build

Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ var versionCmd = &cobra.Command{
fmt.Print("no version set for this build... ")
cliVersion = "local"
}
fmt.Printf("triton-kubernetes 0.9.1-pre2 (%s)\n", cliVersion)
fmt.Printf("triton-kubernetes 1.0.0-pre1 (%s)\n", cliVersion)
},
}
2 changes: 1 addition & 1 deletion cmd/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestVersion(t *testing.T) {
versionCmd.Run(versionCmd, []string{})
})

expected := "triton-kubernetes 0.9.1-pre2 (beta)\n"
expected := "triton-kubernetes 1.0.0-pre1 (beta)\n"

select {
case err := <-errch:
Expand Down
25 changes: 20 additions & 5 deletions create/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package create
import (
"errors"
"fmt"
"os"
"regexp"
"strings"

Expand All @@ -26,6 +27,8 @@ type baseClusterTerraformConfig struct {

Name string `json:"name"`

DockerEngineInstallURL string `json:"docker_engine_install_url,omitempty"`

RancherAPIURL string `json:"rancher_api_url"`
RancherAccessKey string `json:"rancher_access_key"`
RancherSecretKey string `json:"rancher_secret_key"`
Expand Down Expand Up @@ -181,6 +184,7 @@ func NewCluster(remoteBackend backend.Backend) error {
viper.Set("rancher_host_label", nodeToAdd["rancher_host_label"])
viper.Set("node_count", nodeToAdd["node_count"])
viper.Set("hostname", nodeToAdd["hostname"])
viper.Set("docker_engine_install_url", nodeToAdd["docker_engine_install_url"])

// Figure out cloud provider
if selectedCloudProvider == "aws" {
Expand Down Expand Up @@ -311,8 +315,14 @@ func getBaseClusterTerraformConfig(terraformModulePath string) (baseClusterTerra
baseSourceRef = viper.GetString("source_ref")
}

// Module Source location e.g. github.com/joyent/triton-kubernetes//terraform/modules/azure-rancher-k8s?ref=master
cfg.Source = fmt.Sprintf("%s//%s?ref=%s", baseSource, terraformModulePath, baseSourceRef)
_, err := os.Stat(baseSource)
if err != nil {
// Module Source location e.g. github.com/joyent/triton-kubernetes//terraform/modules/triton-rancher?ref=master
cfg.Source = fmt.Sprintf("%s//%s?ref=%s", baseSource, terraformModulePath, baseSourceRef)
} else {
// This is a local file, ignore ref
cfg.Source = fmt.Sprintf("%s//%s", baseSource, terraformModulePath)
}

// Name
clusterNameRegexp := regexp.MustCompile("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
Expand Down Expand Up @@ -349,7 +359,7 @@ func getBaseClusterTerraformConfig(terraformModulePath string) (baseClusterTerra
} else if nonInteractiveMode {
return baseClusterTerraformConfig{}, errors.New("k8s_version must be specified")
} else {

// https://github.com/rancher/kontainer-driver-metadata/blob/master/rke/k8s_rke_system_images.go
var kubernetesVersions = []struct {
DisplayName string
Name string
Expand All @@ -361,8 +371,9 @@ func getBaseClusterTerraformConfig(terraformModulePath string) (baseClusterTerra
{"v1.12.6", "v1.12.6-rancher1-1"},
{"v1.13.4", "v1.13.4-rancher1-1"},
{"v1.14.9", "v1.14.9-rancher1-1"},
{"v1.15.6", "v1.15.6-rancher1-2"},
{"v1.16.3", "v1.16.3-rancher1-1"},
{"v1.15.12", "v1.15.12-rancher1-1"},
{"v1.16.10", "v1.16.10-rancher2-1"},
{"v1.17.6", "v1.17.6-rancher2-1"},
}
prompt := promptui.Select{
Label: "Kubernetes Version",
Expand Down Expand Up @@ -522,6 +533,10 @@ func getBaseClusterTerraformConfig(terraformModulePath string) (baseClusterTerra
}
}

if viper.IsSet("docker_engine_install_url") {
cfg.DockerEngineInstallURL = viper.GetString("docker_engine_install_url")
}

return cfg, nil
}

Expand Down
17 changes: 15 additions & 2 deletions create/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package create
import (
"errors"
"fmt"
"os"
"strings"

"github.com/joyent/triton-kubernetes/backend"
Expand All @@ -18,6 +19,8 @@ type baseManagerTerraformConfig struct {

Name string `json:"name"`

DockerEngineInstallURL string `json:"docker_engine_install_url,omitempty"`

RancherAdminPassword string `json:"rancher_admin_password,omitempty"`
RancherServerImage string `json:"rancher_server_image,omitempty"`
RancherAgentImage string `json:"rancher_agent_image,omitempty"`
Expand Down Expand Up @@ -167,8 +170,14 @@ func getBaseManagerTerraformConfig(terraformModulePath, name string) (baseManage
baseSourceRef = viper.GetString("source_ref")
}

// Module Source location e.g. github.com/joyent/triton-kubernetes//terraform/modules/triton-rancher?ref=master
cfg.Source = fmt.Sprintf("%s//%s?ref=%s", baseSource, terraformModulePath, baseSourceRef)
_, err := os.Stat(baseSource)
if err != nil {
// Module Source location e.g. github.com/joyent/triton-kubernetes//terraform/modules/triton-rancher?ref=master
cfg.Source = fmt.Sprintf("%s//%s?ref=%s", baseSource, terraformModulePath, baseSourceRef)
} else {
// This is a local file, ignore ref
cfg.Source = fmt.Sprintf("%s//%s", baseSource, terraformModulePath)
}

cfg.Name = name

Expand Down Expand Up @@ -296,5 +305,9 @@ func getBaseManagerTerraformConfig(terraformModulePath, name string) (baseManage
return baseManagerTerraformConfig{}, errors.New("Invalid UI Admin password")
}

if viper.IsSet("docker_engine_install_url") {
cfg.DockerEngineInstallURL = viper.GetString("docker_engine_install_url")
}

return cfg, nil
}
14 changes: 13 additions & 1 deletion create/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package create
import (
"errors"
"fmt"
"os"
"sort"
"strconv"
"strings"
Expand All @@ -22,6 +23,8 @@ type baseNodeTerraformConfig struct {
Hostname string `json:"hostname,omitempty"`
NodeCount int `json:"-"`

DockerEngineInstallURL string `json:"docker_engine_install_url,omitempty"`

RancherAPIURL string `json:"rancher_api_url"`
RancherClusterRegistrationToken string `json:"rancher_cluster_registration_token"`
RancherClusterCAChecksum string `json:"rancher_cluster_ca_checksum"`
Expand Down Expand Up @@ -206,6 +209,8 @@ func getBaseNodeTerraformConfig(terraformModulePath, selectedCluster string, cur
RancherRegistry: currentState.Get(fmt.Sprintf("module.%s.rancher_registry", selectedCluster)),
RancherRegistryUsername: currentState.Get(fmt.Sprintf("module.%s.rancher_registry_username", selectedCluster)),
RancherRegistryPassword: currentState.Get(fmt.Sprintf("module.%s.rancher_registry_password", selectedCluster)),

DockerEngineInstallURL: currentState.Get(fmt.Sprintf("module.%s.docker_engine_install_url", selectedCluster)),
}

baseSource := defaultSourceURL
Expand All @@ -218,7 +223,14 @@ func getBaseNodeTerraformConfig(terraformModulePath, selectedCluster string, cur
baseSourceRef = viper.GetString("source_ref")
}

cfg.Source = fmt.Sprintf("%s//%s?ref=%s", baseSource, terraformModulePath, baseSourceRef)
_, err := os.Stat(baseSource)
if err != nil {
// Module Source location e.g. github.com/joyent/triton-kubernetes//terraform/modules/triton-rancher?ref=master
cfg.Source = fmt.Sprintf("%s//%s?ref=%s", baseSource, terraformModulePath, baseSourceRef)
} else {
// This is a local file, ignore ref
cfg.Source = fmt.Sprintf("%s//%s", baseSource, terraformModulePath)
}

// Rancher Host Label
selectedHostLabel := ""
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/aws/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ create cluster called
✔ Cluster Manager: dev-manager
✔ Cloud Provider: AWS
✔ Cluster Name: dev-cluster
✔ Kubernetes Version: v1.16.3
✔ Kubernetes Version: v1.17.6
✔ Kubernetes Network Provider: calico
✔ Private Registry: None
✔ k8s Registry: None
Expand Down Expand Up @@ -78,4 +78,4 @@ $ triton-kubernetes get cluster
```


`triton-kubernetes` cli can take a configuration file (yaml) with `--config` option to run in silent mode. To read about the yaml arguments, look at the [silent-install documentation](https://github.com/joyent/triton-kubernetes/tree/master/docs/guide/silent-install-yaml.md).
`triton-kubernetes` cli can take a configuration file (yaml) with `--config` option to run in silent mode. To read about the yaml arguments, look at the [silent-install documentation](https://github.com/joyent/triton-kubernetes/tree/master/docs/guide/silent-install-yaml.md).
2 changes: 1 addition & 1 deletion docs/guide/azure/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ create cluster called
✔ Cluster Manager: dev-manager
✔ Cloud Provider: Azure
✔ Cluster Name: azure-cluster
✔ Kubernetes Version: v1.16.3
✔ Kubernetes Version: v1.17.6
✔ Kubernetes Network Provider: calico
✔ Private Registry: None
✔ k8s Registry: None
Expand Down
9 changes: 5 additions & 4 deletions docs/guide/building-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ Save and exit your editor. Then, source your `~/.bash_profile`.
source ~/.bash_profile
```

> Note: Set the GOBIN path to generate a binary file when `go install` is run.
> ```bash
> export GOBIN=$HOME/go/bin
> ```
Note: Set the GOBIN path to generate a binary file when `go install` is run.

```bash
export GOBIN=$HOME/go/bin
```

### Zsh

Expand Down
4 changes: 2 additions & 2 deletions docs/guide/gcp/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ create cluster called
✔ Cluster Manager: dev-manager
✔ Cloud Provider: GCP
✔ Cluster Name: gcp-cluster
✔ Kubernetes Version: v1.16.3
✔ Kubernetes Version: v1.17.6
✔ Kubernetes Network Provider: calico
✔ Private Registry: None
✔ k8s Registry: None
Expand Down Expand Up @@ -68,4 +68,4 @@ $ triton-kubernetes get cluster
```


`triton-kubernetes` cli can take a configuration file (yaml) with `--config` option to run in silent mode. To read about the yaml arguments, look at the [silent-install documentation](https://github.com/joyent/triton-kubernetes/tree/master/docs/guide/silent-install-yaml.md).
`triton-kubernetes` cli can take a configuration file (yaml) with `--config` option to run in silent mode. To read about the yaml arguments, look at the [silent-install documentation](https://github.com/joyent/triton-kubernetes/tree/master/docs/guide/silent-install-yaml.md).
4 changes: 2 additions & 2 deletions docs/guide/silent-install-yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ YAML parameters for cluster are:
| `cluster_manager` | Which cluster manager should manage this new cluster that is going to be created. |
| `cluster_cloud_provider` | Which cloud should the cluster run on. Options are `triton`, `aws`, `gcp`, or `azure`. |
| `name` | Cluster name |
| `k8s_version` | Version of Kubernetes to deploy for this cluster. Available versions are: `v1.8.11-rancher2-1`, `v1.9.7-rancher2-2`, `v1.10.3-rancher2-1`, `v1.11.8-rancher1-1`, `v1.12.6-rancher1-1`, `v1.13.4-rancher1-1`, `v1.14.9-rancher1-1`, `v1.15.6-rancher1-2`, and `v1.16.3-rancher1-1`. |
| `k8s_version` | Version of Kubernetes to deploy for this cluster. Available versions are: `v2.8.11-rancher2-1`, `v1.9.7-rancher2-2`, `v1.10.3-rancher2-1`, `v1.11.8-rancher1-1`, `v1.12.6-rancher1-1`, `v1.13.4-rancher1-1`, `v1.14.9-rancher1-1`, `v1.15.12-rancher1-1`, `v1.16.10-rancher2-1` and `v1.17.6-rancher-2-1` (default). |
| `k8s_network_provider` | Network stack to use for this Kubernetes cluster. Available options are: `calico` and `flannel`. |
| `private_registry` | URL of the private registry that includes rancher containers |
| `private_registry_username` | Username for the private registry |
Expand All @@ -50,4 +50,4 @@ YAML parameters for cluster are:

For examples, look in [examples/silent-install](https://github.com/joyent/triton-kubernetes/tree/master/examples/silent-install).

> Note: Spreading a cluster across multiple clouds could cause performance issues.
> Note: Spreading a cluster across multiple clouds could cause performance issues.
2 changes: 1 addition & 1 deletion docs/guide/triton/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ create cluster called
✔ Cluster Manager: dev-manager
✔ Cloud Provider: Triton
✔ Cluster Name: dev-cluster
✔ Kubernetes Version: v1.16.3
✔ Kubernetes Version: v1.17.6
✔ Kubernetes Network Provider: calico
✔ Private Registry: None
✔ k8s Registry: None
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/vSphere/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ create cluster called
✔ Cluster Manager: dev-manager
✔ Cloud Provider: vSphere
✔ Cluster Name: dev-cluster
✔ Kubernetes Version: v1.16.3
✔ Kubernetes Version: v1.17.6
✔ Kubernetes Network Provider: calico
✔ Private Registry: None
✔ k8s Registry: None
Expand Down
4 changes: 2 additions & 2 deletions examples/silent-install/gcp/cluster-gcp-ha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cluster_manager: manager-on-triton
backend_provider: local
name: gcp-ha
cluster_cloud_provider: gcp
k8s_version: v1.16.3-rancher1-1
k8s_version: v1.17.6-rancher2-1
k8s_network_provider: calico
private_registry: ""
private_registry_username: ""
Expand Down Expand Up @@ -40,4 +40,4 @@ nodes:
gcp_image: ubuntu-1604-xenial-v20180424
gcp_public_key_path: ~/.ssh/id_rsa.pub
gcp_private_key_path: ~/.ssh/id_rsa
gcp_ssh_user: root
gcp_ssh_user: root
Loading

0 comments on commit ca1760e

Please sign in to comment.