Skip to content

Commit

Permalink
Merge pull request #6 from cloud-ca/MC-5244-resize-root-volume
Browse files Browse the repository at this point in the history
MC-5244: Added changes to have resizable root volume
  • Loading branch information
franzpgarcia committed May 25, 2017
2 parents 89e934b + 2fa0149 commit 221e0db
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 6 deletions.
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,17 @@ build-all: clean

clean:
rm -rf dist bin/docker-machine-driver-cloudca

upload:
rm -f ./dist/docker-machine-driver-cloudca_${VERSION}_SWIFTURLS ;
SWIFT_ACCOUNT=`swift stat | grep Account: | sed s/Account:// | tr -d '[:space:]'` ; \
SWIFT_URL=https://objects-qc.cloud.ca/v1 ; \
SWIFT_CONTAINER=docker-machine-driver-cloudca ; \
for FILE in `ls ./dist | grep -i docker-machine.*\.zip` ; do \
echo "Uploading $$FILE to swift" ; \
swift upload $${SWIFT_CONTAINER} ./dist/$$FILE --object-name ${VERSION}/$$FILE ; \
echo "$${SWIFT_URL}/$${SWIFT_ACCOUNT}/$${SWIFT_CONTAINER}/${VERSION}/$$FILE" >> ./dist/docker-machine-driver-cloudca_${VERSION}_SWIFTURLS ; \
done
release-notes:
./release-notes.sh > ./dist/release.md ;
release: build-all upload release-notes
.PHONY: init build install build-all clean
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ docker-machine create -d cloudca \
--cloudca-template "Ubuntu 16.04.01 HVM" \
--cloudca-compute-offering "1vCPU.1GB" \
--cloudca-network-id "bbefe8dd-bb3e-4f37-b467-b63f8334c15b" \
--cloudca-root-disk-size-in-gb 60 \
--cloudca-additional-disk-offering "50GB - 50 IOPS Min." \
test-machine1
```
**Notes:**
* It is recommended to use Environment variables to store sensitive information like API keys. See the options below for the list of supported variables.
* The cloud.ca instances have limited disk space on their root volumes. In order to get more disk space for your Docker machines, use the `--cloudca-additional-disk-offering` option to specify an additional volume that Docker will be able to use.
* The cloud.ca instances have limited disk space on their root volumes. In order to get more disk space for your Docker machines, use the `--cloudca-root-disk-size-in-gb` if you have a resizable template or `--cloudca-additional-disk-offering` option to specify an additional volume that Docker will be able to use.

## Options

Expand All @@ -40,6 +41,7 @@ docker-machine create -d cloudca \
|``--cloudca-template`` |``CLOUDCA_TEMPLATE`` |cloud.ca template name or ID |none |yes|
|``--cloudca-compute-offering``|``CLOUDCA_COMPUTE_OFFERING``|cloud.ca compute offering name or ID|none |yes|
|``--cloudca-network-id`` |``CLOUDCA_NETWORK_ID`` |cloud.ca network ID (where the machine will be deployed)|none |yes|
|``--cloudca-root-disk-size-in-gb`` |``CLOUDCA_ROOT_DISK_SIZE_IN_GB`` |cloud.ca root disk size in gb (for resizable templates) |size defined by template |no|
|``--cloudca-additional-disk-offering``|``CLOUDCA_ADDITIONAL_DISK_OFFERING``|cloud.ca additional disk offering name or ID to attach to the machine|none |no|
|``--cloudca-use-private-ip`` |``CLOUDCA_USE_PRIVATE_IP`` |Use a private IP to access the machine|false |no|
|``--cloudca-ssh-user`` |``CLOUDCA_SSH_USER`` |cloud.ca SSH user|cca-user|no|
Expand Down
14 changes: 14 additions & 0 deletions cloudca.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type Driver struct {
MemoryInMb string
NetworkId string
VpcId string
RootDiskSizeInGb string
AdditionalDiskOfferingId string
AdditionalDiskSizeGb string
AdditionalDiskIops string
Expand Down Expand Up @@ -142,6 +143,11 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Usage: "cloud.ca memory in MB for custom compute offerings",
EnvVar: "CLOUDCA_MEMORY_MB",
},
mcnflag.StringFlag{
Name: "cloudca-root-disk-size-in-gb",
Usage: "cloud.ca root disk size in GB (for resizable templates)",
EnvVar: "CLOUDCA_ROOT_DISK_SIZE_GB",
},
mcnflag.StringFlag{
Name: "cloudca-additional-disk-offering",
Usage: "cloud.ca additional disk offering name or ID to attach to the machine",
Expand Down Expand Up @@ -222,6 +228,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
}
d.CpuCount = flags.String("cloudca-cpu-count")
d.MemoryInMb = flags.String("cloudca-memory-mb")
d.RootDiskSizeInGb = flags.String("cloudca-root-disk-size-in-gb")

if err := d.setNetwork(flags.String("cloudca-network-id")); err != nil {
return err
Expand Down Expand Up @@ -382,6 +389,13 @@ func (d *Driver) Create() error {
memory, _ := strconv.Atoi(d.MemoryInMb)
instanceToCreate.MemoryInMB = memory
}
if d.RootDiskSizeInGb != "" {
rootDiskSizeInGb, err := strconv.Atoi(d.RootDiskSizeInGb)
if err != nil {
return err
}
instanceToCreate.RootVolumeSizeInGb = rootDiskSizeInGb
}
if d.AdditionalDiskOfferingId != "" {
instanceToCreate.UserData = userDataToMountVolume
instanceToCreate.AdditionalDiskOfferingId = d.AdditionalDiskOfferingId
Expand Down
8 changes: 4 additions & 4 deletions glide.lock

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

1 change: 1 addition & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package: github.com/cloud-ca/docker-machine-driver-cloudca
import:
- package: github.com/cloud-ca/go-cloudca
version: v1.0.1
subpackages:
- services/cloudca
- package: github.com/docker/machine
Expand Down
26 changes: 26 additions & 0 deletions release-notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

VERSION="$(git describe --tags)"
function getUrl() {
echo $(cat ./dist/docker-machine-driver-cloudca_${VERSION}_SWIFTURLS | grep $1)
}

echo "[DESCRIPTION HERE]
# Issues fixed
[ISSUES HERE]
# Downloads
**macOS**
- 64-bit: $(getUrl darwin)
**Linux**
- 64-bit: $(getUrl linux-amd64)
- 32-bit: $(getUrl linux-386)
- Arm: $(getUrl linux-arm)
**Windows**
- 64-bit: $(getUrl windows-amd64)
- 32-bit: $(getUrl windows-386)
"

0 comments on commit 221e0db

Please sign in to comment.