Skip to content

Commit

Permalink
feat: netapp-volume-worker support (rackerlabs#527)
Browse files Browse the repository at this point in the history
This creates a new Kustomize deployment for cinder with a netapp volume
backend. The worker uses an existing cinder deployment managed by helm
kustomizes the configuration values and produces a netapp specific volume
container which has the ability to run with multiple netapp backends.

To use this container the following secret must be created

``` shell
kubectl --namespace openstack \
        create secret generic cinder-netapp \
        --type Opaque \
        --from-literal=BACKENDS="netapp-backend-1,root,10.0.0.1,80,vserver1,qos-something,True,True,True,True,enabled"
```

Each backend has 11 values which correspond to the needed configuration.
Multiple backends are supported using a semicolon.

Signed-off-by: Kevin Carter <[email protected]>
  • Loading branch information
cloudnull authored Nov 3, 2024
1 parent 415dda8 commit f1d9b84
Show file tree
Hide file tree
Showing 7 changed files with 530 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/kustomize-cinder-volume-netapp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Kustomize GitHub Actions for cinder-volume-netapp

on:
pull_request:
paths:
- base-kustomize/cinder/netapp/**
- .github/workflows/kustomize-cinder-volume-netapp.yaml
jobs:
kustomize:
name: Kustomize
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Kustomize Install
working-directory: /usr/local/bin/
run: |
if [ ! -f /usr/local/bin/kustomize ]; then
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | sudo bash
fi
- name: Run Kustomize Build
run: |
kustomize build base-kustomize/cinder/netapp/ > /tmp/rendered.yaml
- name: Return Kustomize Build
uses: actions/upload-artifact@v4
with:
name: kustomize-cinder-volume-netapp-artifact
path: /tmp/rendered.yaml
53 changes: 53 additions & 0 deletions base-kustomize/cinder/netapp/configmap-etc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cinder-volume-netapp-config
namespace: openstack
data:
cinder-volume.sh: |
#!/bin/bash
set -ex
exec cinder-volume --config-file /etc/cinder/cinder.conf \
--config-file /tmp/pod-shared/backends.conf \
--config-file /tmp/pod-shared/internal_tenant.conf \
--config-file /tmp/pod-shared/cinder-netapp.conf
generate-backends.py: |
#!/usr/bin/env python3
import configparser
import os
netapp_backends = os.environ.get('NETAPP_BACKENDS')
config = configparser.ConfigParser()
for backend in netapp_backends.split(';'):
backend = backend.split(',')
assert len(backend) == 11
config.add_section(backend[0])
config.set(backend[0], 'netapp_login', backend[1])
config.set(backend[0], 'netapp_password', backend[2])
config.set(backend[0], 'netapp_server_hostname', backend[3])
config.set(backend[0], 'netapp_server_port', backend[4])
config.set(backend[0], 'netapp_storage_family', 'ontap_cluster')
config.set(backend[0], 'netapp_storage_protocol', 'iscsi')
config.set(backend[0], 'netapp_transport_type', 'http')
config.set(backend[0], 'netapp_vserver', backend[5])
config.set(backend[0], 'netapp:qos_policy_group', backend[6])
config.set(backend[0], 'netapp_dedup', backend[7])
config.set(backend[0], 'netapp_compression', backend[8])
config.set(backend[0], 'netapp_thick_provisioned', backend[9])
config.set(backend[0], 'netapp_lun_space_reservation', backend[10])
config.set(backend[0], 'volume_driver', 'cinder.volume.drivers.netapp.common.NetAppDriver')
config.set(backend[0], 'volume_backend_name', backend[0])
print(f'Added backend {backend[0]}')
with open('/tmp/pod-shared/backends.conf', 'w') as configfile:
config.write(configfile)
print('Generated backends.conf')
config = configparser.ConfigParser()
backends = ','.join([i.split(',')[0] for i in netapp_backends.split(';')])
config.set('DEFAULT', 'enabled_backends', backends)
config.set('DEFAULT', 'host', 'cinder-volume-netapp-worker')
with open('/tmp/pod-shared/cinder-netapp.conf', 'w') as configfile:
config.write(configfile)
print('Updated cinder.conf')
ssh_known_hosts: |
# Empty SSH host file managed by cinder-volume-netapp
Loading

0 comments on commit f1d9b84

Please sign in to comment.