cloudstack-csi-driver

module
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: Apache-2.0

README

CloudStack CSI Driver

Go Reference Go Report Card Release

This repository provides a Container Storage Interface (CSI) plugin for Apache CloudStack.

Usage with Kubernetes

Requirements
  • Minimal Kubernetes version: v1.25

  • The Kubernetes cluster must run in CloudStack. Tested only in a KVM zone.

  • A disk offering with custom size must be available, with type "shared".

  • In order to match the Kubernetes node and the CloudStack instance, they should both have the same name. If not, it is also possible to use cloud-init instance metadata to get the instance name: if the node has cloud-init enabled, metadata will be available in /run/cloud-init/instance-data.json; you should then make sure that /run/cloud-init/ is mounted from the node.

  • Kubernetes nodes must be in the Root domain, and be created by the CloudStack account whose credentials are used in configuration.

Configuration

Create the CloudStack configuration file cloud-config.

It should have the following format, defined for the CloudStack Kubernetes Provider:

[Global]
api-url = <CloudStack API URL>
api-key = <CloudStack API Key>
secret-key = <CloudStack API Secret>
ssl-no-verify = <Disable SSL certificate validation: true or false (optional)>
project-id = <CloudStack project ID (optional)>

Create a secret named cloudstack-secret in namespace kube-system:

kubectl create secret generic \
  --namespace kube-system \
  --from-file ./cloud-config \
  cloudstack-secret

If you have also deployed the CloudStack Kubernetes Provider, you may use the same secret for both tools.

Deployment
kubectl apply -f https://github.com/leaseweb/cloudstack-csi-driver/releases/latest/download/manifest.yaml
Creation of Storage classes
Manually

A storage class can be created manually: see example.

The provisioner value must be csi.cloudstack.apache.org.

The volumeBindingMode must be WaitForFirstConsumer, in order to delay the binding and provisioning of a PersistentVolume until a Pod using the PersistentVolumeClaim is created. It enables the provisioning of volumes in respect to topology constraints (e.g. volume in the right zone).

The storage class must also have a parameter named csi.cloudstack.apache.org/disk-offering-id whose value is the CloudStack disk offering ID.

Using cloudstack-csi-sc-syncer

The tool cloudstack-csi-sc-syncer may also be used to synchronize CloudStack disk offerings to Kubernetes storage classes.

More info...

Usage

Example:

kubectl apply -f ./examples/k8s/pvc.yaml
kubectl apply -f ./examples/k8s/pod.yaml

Building

To build the driver binary:

make build-cloudstack-csi-driver

To build the container images:

make container

See also


Copyright 2021 Apalia SAS

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.

Directories

Path Synopsis
cmd
cloudstack-csi-driver
cloudstack-csi-driver binary.
cloudstack-csi-driver binary.
cloudstack-csi-sc-syncer
Small utility to synchronize CloudStack disk offerings to Kubernetes storage classes.
Small utility to synchronize CloudStack disk offerings to Kubernetes storage classes.
pkg
cloud
Package cloud contains CloudStack related functions.
Package cloud contains CloudStack related functions.
cloud/fake
Package fake provides a fake implementation of the cloud connector interface, to be used in tests.
Package fake provides a fake implementation of the cloud connector interface, to be used in tests.
driver
Package driver provides the implementation of the CSI plugin.
Package driver provides the implementation of the CSI plugin.
mount
Package mount provides utilities to detect, format and mount storage devices.
Package mount provides utilities to detect, format and mount storage devices.
syncer
Package syncer provides the logic used by command line tool cloudstack-csi-sc-syncer.
Package syncer provides the logic used by command line tool cloudstack-csi-sc-syncer.
util
Package util provides shared utility functions.
Package util provides shared utility functions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL