Allow the specification of storageClassName in PVCs

Not every cluster has a default storage class and even if they do, we
don't always want to use that default storage class for our persistent
volumes.  Instead, allow the user to specific this via the cluster
configuration itself for the three cases we require (zookeeper,
scheduler, and registry).

Change-Id: I948d57ce59d9b16c1c70fc52af2e22bd6131e6e2
changes/92/853592/15
Michael Kelly 6 months ago
parent 8b05b31a06
commit ac2488d242
No known key found for this signature in database
GPG Key ID: 77F7FE93040ECF3E

@ -58,6 +58,8 @@ spec:
type: string
secretName:
type: string
storageClassName:
type: string
env:
type: object
x-kubernetes-preserve-unknown-fields: true
@ -73,6 +75,8 @@ spec:
type: integer
default: 1
minimum: 1
storageClassName:
type: string
launcher:
type: object
properties:
@ -176,3 +180,5 @@ spec:
properties:
secretName:
type: string
storageClassName:
type: string

@ -378,6 +378,12 @@ verbatim):
* ``tls.crt``
* ``tls.key``
.. attr:: storageClassName
:default: ''
The name of the Kubernetes storage class to use when
running using the managed ZooKeeper instance.
.. attr:: env
A list of environment variables. This will be passed through
@ -396,6 +402,12 @@ verbatim):
The key name in the secret should be ``main.yaml``.
.. attr:: storageClassName
:default: ''
The name of the Kubernetes storage class to use when
running using the managed ZooKeeper instance.
.. attr:: launcher
.. attr:: config
@ -617,6 +629,12 @@ verbatim):
The requested size of the registry storage volume.
.. attr:: storageClassName
:default: ''
The name of the Kubernetes storage class to use when
running using the managed ZooKeeper instance.
.. attr:: tls
.. attr:: secretName

@ -363,3 +363,6 @@ spec:
resources:
requests:
storage: "5Gi"
{%- if spec.storageClassName != "" %}
storageClassName: {{ spec.zookeeper.storageClassName }}
{%- endif %}

@ -106,3 +106,6 @@ spec:
resources:
requests:
storage: {{ spec.registry.volumeSize }} #80Gi
{%- if spec.registry.storageClassName != "" %}
storageClassName: {{ spec.registry.storageClassName }}
{%- endif %}

@ -169,6 +169,9 @@ spec:
resources:
requests:
storage: 80Gi
{%- if spec.scheduler.storageClassName != "" %}
storageClassName: {{ spec.scheduler.storageClassName }}
{%- endif %}
---
apiVersion: apps/v1
kind: Deployment

@ -19,14 +19,15 @@ from . import utils
class ZooKeeper:
def __init__(self, api, namespace, logger):
def __init__(self, api, namespace, logger, spec):
self.api = api
self.namespace = namespace
self.log = logger
self.spec = spec
def create(self):
utils.apply_file(self.api, 'zookeeper.yaml',
namespace=self.namespace)
namespace=self.namespace, spec=self.spec)
def wait_for_cluster(self):
while True:

@ -49,6 +49,7 @@ class Zuul:
get('secretName')
zk_spec = self.spec.setdefault('zookeeper', {})
zk_spec.setdefault('storageClassName', '')
zk_str = spec.get('zookeeper', {}).get('hosts')
if zk_str:
self.manage_zk = False
@ -67,7 +68,8 @@ class Zuul:
self.spec.setdefault('scheduler', {})['tenant_config'] = \
'/etc/zuul/tenant/main.yaml'
self.spec.setdefault('scheduler', {}).setdefault(
'storageClassName', '')
self.spec.setdefault('executor', {}).setdefault('count', 1)
self.spec.setdefault('executor', {}).setdefault(
'terminationGracePeriodSeconds', 21600)
@ -78,6 +80,8 @@ class Zuul:
registry = self.spec.setdefault('registry', {})
registry.setdefault('count', 0)
registry.setdefault('volumeSize', '80Gi')
registry.setdefault('storageClassName', '')
registry_tls = registry.setdefault('tls', {})
self.manage_registry_cert = ('secretName' not in registry_tls)
registry_tls.setdefault('secretName', 'zuul-registry-tls')
@ -126,7 +130,8 @@ class Zuul:
if not self.manage_zk:
self.log.info("ZK is externally managed")
return
self.zk = zookeeper.ZooKeeper(self.api, self.namespace, self.log)
self.zk = zookeeper.ZooKeeper(self.api, self.namespace, self.log,
self.spec['zookeeper'])
self.zk.create()
def wait_for_zk(self):

Loading…
Cancel
Save