Commit e23d2227 authored by Arie Peterson's avatar Arie Peterson 🐚
Browse files

Add option for backup flag for disks

parent 56755968
apiVersion: "v1"
name: "kubernetes-ghost"
version: "0.1.0"
version: "0.1.2"
appVersion: "0.2.0"
description: "A storage provisioner using Greenhost's cloud platform."
sources:
- "https://code.greenhost.net/open/kubernetes-ghost"
......
......@@ -59,6 +59,13 @@ func (p *GreenhostProvisioner) Provision(options controller.VolumeOptions) (*v1.
pvName := options.PVC.ObjectMeta.Name
name := "kubernetes-ghost:" + pvName
region := os.Getenv("GHOST_CLOUD_REGION")
backup := os.Getenv("GHOST_IMAGE_BACKUP")
backupBool := backup == "true"
if (backupBool) {
glog.Info("disk image backups on")
} else {
glog.Info("disk image backups off")
}
requestedSize := options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
// Round the requested size up to nearest integer number of gigabytes.
size := requestedSize.ScaledValue(9)
......@@ -69,6 +76,7 @@ func (p *GreenhostProvisioner) Provision(options controller.VolumeOptions) (*v1.
Region: region,
SizeGigaBytes: size,
ProjectID: p.projectID,
Backup: backupBool,
}
// The Cosmos API returns a description of the created disk image.
glog.Infof("Creating new disk image with specs %v", specs)
......
......@@ -14,6 +14,7 @@ type Specs struct {
Region string `json:"region"`
SizeGigaBytes int64 `json:"size_gigabytes"`
ProjectID string `json:"project_id"`
Backup bool `json:"backup"`
}
// This captures the response to a Cosmos2 API call for creating a disk.
......
......@@ -25,6 +25,8 @@ spec:
value: "{{ .Values.provisioner.cosmos_api_url }}"
- name: GHOST_CLOUD_REGION
value: "{{ .Values.provisioner.cosmos_location }}"
- name: GHOST_IMAGE_BACKUP
value: "{{ .Values.provisioner.backup }}"
volumeMounts:
- name: ca-certificates
mountPath: /etc/ssl/certs/ca-certificates.crt
......
provisioner:
image:
repository: "docker.greenhost.net/open/kubernetes-ghost/provisioner"
tag: "0.2.0"
tag: "0.3.0"
pullPolicy: "Always"
cosmos_api_url: "https://service.greenhost.net/api/v2"
cosmos_location: "ams1"
# Set the value of the `backup` flag on newly created disk images, specifying
# whether automatic backups should be made.
backup: false
driver:
image:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment