Exemplo n.º 1
0
 def get_pvc_manifest(self):
     """
     Make a pvc manifest that will spawn current user's pvc.
     """
     return make_pvc_spec(self.pvc_name, self.user_storage_class,
                          self.user_storage_access_modes,
                          self.user_storage_capacity)
Exemplo n.º 2
0
def test_make_resources_all():
    """
    Test specifying all possible resource limits & guarantees
    """
    assert make_pvc_spec(
        name='test',
        storage_class='gce-standard-storage',
        access_modes=['ReadWriteOnce'],
        storage='10Gi'
    ) == {
        'kind': 'PersistentVolumeClaim',
        'apiVersion': 'v1',
        'metadata': {
            'name': 'test',
            'annotations': {
                'volume.beta.kubernetes.io/storage-class': 'gce-standard-storage'
            }
        },
        'spec': {
            'accessModes': ['ReadWriteOnce'],
            'resources': {
                'requests': {
                    'storage': '10Gi'
                }
            }
        }
    }
Exemplo n.º 3
0
def test_make_pvc_simple():
    """
    Test specification of the simplest possible pvc specification
    """
    assert make_pvc_spec(
        name='test',
        storage_class='',
        access_modes=[],
        storage=None
    ) == {
        'kind': 'PersistentVolumeClaim',
        'apiVersion': 'v1',
        'metadata': {
            'name': 'test',
            'annotations': {
                'volume.beta.kubernetes.io/storage-class': ''
            }
        },
        'spec': {
            'accessModes': [],
            'resources': {
                'requests': {
                    'storage': None
                }
            }
        }
    }
def test_make_resources_all():
    """
    Test specifying all possible resource limits & guarantees
    """
    assert make_pvc_spec(
        name='test',
        storage_class='gce-standard-storage',
        access_modes=['ReadWriteOnce'],
        storage='10Gi'
    ) == {
        'kind': 'PersistentVolumeClaim',
        'apiVersion': 'v1',
        'metadata': {
            'name': 'test',
            'annotations': {
                'volume.beta.kubernetes.io/storage-class': 'gce-standard-storage'
            }
        },
        'spec': {
            'accessModes': ['ReadWriteOnce'],
            'resources': {
                'requests': {
                    'storage': '10Gi'
                }
            }
        }
    }
def test_make_pvc_simple():
    """
    Test specification of the simplest possible pvc specification
    """
    assert make_pvc_spec(
        name='test',
        storage_class='',
        access_modes=[],
        storage=None
    ) == {
        'kind': 'PersistentVolumeClaim',
        'apiVersion': 'v1',
        'metadata': {
            'name': 'test',
            'annotations': {
                'volume.beta.kubernetes.io/storage-class': ''
            }
        },
        'spec': {
            'accessModes': [],
            'resources': {
                'requests': {
                    'storage': None
                }
            }
        }
    }
 def get_pvc_manifest(self):
     """
     Make a pvc manifest that will spawn current user's pvc.
     """
     return make_pvc_spec(
         self.pvc_name,
         self.user_storage_class,
         self.user_storage_access_modes,
         self.user_storage_capacity
     )