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
This commit is contained in:
parent
8b05b31a06
commit
ac2488d242
@ -58,6 +58,8 @@ spec:
|
|||||||
type: string
|
type: string
|
||||||
secretName:
|
secretName:
|
||||||
type: string
|
type: string
|
||||||
|
storageClassName:
|
||||||
|
type: string
|
||||||
env:
|
env:
|
||||||
type: object
|
type: object
|
||||||
x-kubernetes-preserve-unknown-fields: true
|
x-kubernetes-preserve-unknown-fields: true
|
||||||
@ -73,6 +75,8 @@ spec:
|
|||||||
type: integer
|
type: integer
|
||||||
default: 1
|
default: 1
|
||||||
minimum: 1
|
minimum: 1
|
||||||
|
storageClassName:
|
||||||
|
type: string
|
||||||
launcher:
|
launcher:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@ -176,3 +180,5 @@ spec:
|
|||||||
properties:
|
properties:
|
||||||
secretName:
|
secretName:
|
||||||
type: string
|
type: string
|
||||||
|
storageClassName:
|
||||||
|
type: string
|
||||||
|
@ -378,6 +378,12 @@ verbatim):
|
|||||||
* ``tls.crt``
|
* ``tls.crt``
|
||||||
* ``tls.key``
|
* ``tls.key``
|
||||||
|
|
||||||
|
.. attr:: storageClassName
|
||||||
|
:default: ''
|
||||||
|
|
||||||
|
The name of the Kubernetes storage class to use when
|
||||||
|
running using the managed ZooKeeper instance.
|
||||||
|
|
||||||
.. attr:: env
|
.. attr:: env
|
||||||
|
|
||||||
A list of environment variables. This will be passed through
|
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``.
|
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:: launcher
|
||||||
|
|
||||||
.. attr:: config
|
.. attr:: config
|
||||||
@ -617,6 +629,12 @@ verbatim):
|
|||||||
|
|
||||||
The requested size of the registry storage volume.
|
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:: tls
|
||||||
|
|
||||||
.. attr:: secretName
|
.. attr:: secretName
|
||||||
|
@ -363,3 +363,6 @@ spec:
|
|||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: "5Gi"
|
storage: "5Gi"
|
||||||
|
{%- if spec.storageClassName != "" %}
|
||||||
|
storageClassName: {{ spec.zookeeper.storageClassName }}
|
||||||
|
{%- endif %}
|
||||||
|
@ -106,3 +106,6 @@ spec:
|
|||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: {{ spec.registry.volumeSize }} #80Gi
|
storage: {{ spec.registry.volumeSize }} #80Gi
|
||||||
|
{%- if spec.registry.storageClassName != "" %}
|
||||||
|
storageClassName: {{ spec.registry.storageClassName }}
|
||||||
|
{%- endif %}
|
||||||
|
@ -169,6 +169,9 @@ spec:
|
|||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 80Gi
|
storage: 80Gi
|
||||||
|
{%- if spec.scheduler.storageClassName != "" %}
|
||||||
|
storageClassName: {{ spec.scheduler.storageClassName }}
|
||||||
|
{%- endif %}
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
|
@ -19,14 +19,15 @@ from . import utils
|
|||||||
|
|
||||||
|
|
||||||
class ZooKeeper:
|
class ZooKeeper:
|
||||||
def __init__(self, api, namespace, logger):
|
def __init__(self, api, namespace, logger, spec):
|
||||||
self.api = api
|
self.api = api
|
||||||
self.namespace = namespace
|
self.namespace = namespace
|
||||||
self.log = logger
|
self.log = logger
|
||||||
|
self.spec = spec
|
||||||
|
|
||||||
def create(self):
|
def create(self):
|
||||||
utils.apply_file(self.api, 'zookeeper.yaml',
|
utils.apply_file(self.api, 'zookeeper.yaml',
|
||||||
namespace=self.namespace)
|
namespace=self.namespace, spec=self.spec)
|
||||||
|
|
||||||
def wait_for_cluster(self):
|
def wait_for_cluster(self):
|
||||||
while True:
|
while True:
|
||||||
|
@ -49,6 +49,7 @@ class Zuul:
|
|||||||
get('secretName')
|
get('secretName')
|
||||||
|
|
||||||
zk_spec = self.spec.setdefault('zookeeper', {})
|
zk_spec = self.spec.setdefault('zookeeper', {})
|
||||||
|
zk_spec.setdefault('storageClassName', '')
|
||||||
zk_str = spec.get('zookeeper', {}).get('hosts')
|
zk_str = spec.get('zookeeper', {}).get('hosts')
|
||||||
if zk_str:
|
if zk_str:
|
||||||
self.manage_zk = False
|
self.manage_zk = False
|
||||||
@ -67,7 +68,8 @@ class Zuul:
|
|||||||
|
|
||||||
self.spec.setdefault('scheduler', {})['tenant_config'] = \
|
self.spec.setdefault('scheduler', {})['tenant_config'] = \
|
||||||
'/etc/zuul/tenant/main.yaml'
|
'/etc/zuul/tenant/main.yaml'
|
||||||
|
self.spec.setdefault('scheduler', {}).setdefault(
|
||||||
|
'storageClassName', '')
|
||||||
self.spec.setdefault('executor', {}).setdefault('count', 1)
|
self.spec.setdefault('executor', {}).setdefault('count', 1)
|
||||||
self.spec.setdefault('executor', {}).setdefault(
|
self.spec.setdefault('executor', {}).setdefault(
|
||||||
'terminationGracePeriodSeconds', 21600)
|
'terminationGracePeriodSeconds', 21600)
|
||||||
@ -78,6 +80,8 @@ class Zuul:
|
|||||||
registry = self.spec.setdefault('registry', {})
|
registry = self.spec.setdefault('registry', {})
|
||||||
registry.setdefault('count', 0)
|
registry.setdefault('count', 0)
|
||||||
registry.setdefault('volumeSize', '80Gi')
|
registry.setdefault('volumeSize', '80Gi')
|
||||||
|
registry.setdefault('storageClassName', '')
|
||||||
|
|
||||||
registry_tls = registry.setdefault('tls', {})
|
registry_tls = registry.setdefault('tls', {})
|
||||||
self.manage_registry_cert = ('secretName' not in registry_tls)
|
self.manage_registry_cert = ('secretName' not in registry_tls)
|
||||||
registry_tls.setdefault('secretName', 'zuul-registry-tls')
|
registry_tls.setdefault('secretName', 'zuul-registry-tls')
|
||||||
@ -126,7 +130,8 @@ class Zuul:
|
|||||||
if not self.manage_zk:
|
if not self.manage_zk:
|
||||||
self.log.info("ZK is externally managed")
|
self.log.info("ZK is externally managed")
|
||||||
return
|
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()
|
self.zk.create()
|
||||||
|
|
||||||
def wait_for_zk(self):
|
def wait_for_zk(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user