Ejemplo n.º 1
0
def get_e2e_configuration():
    config = Configuration()
    config.host = None
    if os.path.exists(
            os.path.expanduser(kube_config.KUBE_CONFIG_DEFAULT_LOCATION)):
        kube_config.load_kube_config(client_configuration=config)
    else:
        print('Unable to load config from %s' %
              kube_config.KUBE_CONFIG_DEFAULT_LOCATION)
        for url in ['https://%s:8443' % DEFAULT_E2E_HOST,
                    'http://%s:8080' % DEFAULT_E2E_HOST]:
            try:
                urllib3.PoolManager().request('GET', url)
                config.host = url
                config.verify_ssl = False
                urllib3.disable_warnings()
                break
            except urllib3.exceptions.HTTPError:
                pass
    if config.host is None:
        raise unittest.SkipTest('Unable to find a running Kubernetes instance')
    print('Running test against : %s' % config.host)
    config.assert_hostname = False
    return config
Ejemplo n.º 2
0
    def test_rest_proxycare(self):

        pool = { 'proxy': urllib3.ProxyManager, 'direct': urllib3.PoolManager }

        for dst, proxy, no_proxy, expected_pool in [
             ( 'http://kube.local/',           None,                       None,                           pool['direct']),
             ( 'http://kube.local/',          'http://proxy.local:8080/',  None,                           pool['proxy']),
             ( 'http://127.0.0.1:8080/',      'http://proxy.local:8080/',  'localhost,127.0.0.0/8,.local', pool['direct']),
             ( 'http://kube.local/',          'http://proxy.local:8080/',  'localhost,127.0.0.0/8,.local', pool['direct']),
             ( 'http://kube.others.com:1234/','http://proxy.local:8080/',  'localhost,127.0.0.0/8,.local', pool['proxy']),
             ( 'http://kube.others.com:1234/','http://proxy.local:8080/',  '*',                            pool['direct']),
        ]:
            # setup input
            config = Configuration()
            setattr(config, 'host', dst)
            if proxy is not None:
                setattr(config, 'proxy', proxy)
            if no_proxy is not None:
                setattr(config, 'no_proxy', no_proxy)
            # setup done

            # test
            client = kubernetes.client.ApiClient(configuration=config)
            self.assertEqual( expected_pool, type(client.rest_client.pool_manager) )
Ejemplo n.º 3
0
    def __init__(self,
                 average_utilization=None,
                 average_value=None,
                 type=None,
                 value=None,
                 local_vars_configuration=None):  # noqa: E501
        """V2beta2MetricTarget - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._average_utilization = None
        self._average_value = None
        self._type = None
        self._value = None
        self.discriminator = None

        if average_utilization is not None:
            self.average_utilization = average_utilization
        if average_value is not None:
            self.average_value = average_value
        self.type = type
        if value is not None:
            self.value = value
    def __init__(self, address_type=None, api_version=None, endpoints=None, kind=None, metadata=None, ports=None, local_vars_configuration=None):  # noqa: E501
        """V1beta1EndpointSlice - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._address_type = None
        self._api_version = None
        self._endpoints = None
        self._kind = None
        self._metadata = None
        self._ports = None
        self.discriminator = None

        self.address_type = address_type
        if api_version is not None:
            self.api_version = api_version
        self.endpoints = endpoints
        if kind is not None:
            self.kind = kind
        if metadata is not None:
            self.metadata = metadata
        if ports is not None:
            self.ports = ports
    def __init__(self,
                 api_version=None,
                 items=None,
                 kind=None,
                 metadata=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1beta1PodSecurityPolicyList - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._api_version = None
        self._items = None
        self._kind = None
        self._metadata = None
        self.discriminator = None

        if api_version is not None:
            self.api_version = api_version
        self.items = items
        if kind is not None:
            self.kind = kind
        if metadata is not None:
            self.metadata = metadata
Ejemplo n.º 6
0
    def __init__(self,
                 api_version=None,
                 kind=None,
                 metadata=None,
                 target=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1Binding - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._api_version = None
        self._kind = None
        self._metadata = None
        self._target = None
        self.discriminator = None

        if api_version is not None:
            self.api_version = api_version
        if kind is not None:
            self.kind = kind
        if metadata is not None:
            self.metadata = metadata
        self.target = target
    def __init__(self,
                 fs_type=None,
                 partition=None,
                 read_only=None,
                 volume_id=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1AWSElasticBlockStoreVolumeSource - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._fs_type = None
        self._partition = None
        self._read_only = None
        self._volume_id = None
        self.discriminator = None

        if fs_type is not None:
            self.fs_type = fs_type
        if partition is not None:
            self.partition = partition
        if read_only is not None:
            self.read_only = read_only
        self.volume_id = volume_id
Ejemplo n.º 8
0
    def __init__(self, group=None, read_only=None, registry=None, tenant=None, user=None, volume=None, local_vars_configuration=None):  # noqa: E501
        """V1QuobyteVolumeSource - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._group = None
        self._read_only = None
        self._registry = None
        self._tenant = None
        self._user = None
        self._volume = None
        self.discriminator = None

        if group is not None:
            self.group = group
        if read_only is not None:
            self.read_only = read_only
        self.registry = registry
        if tenant is not None:
            self.tenant = tenant
        if user is not None:
            self.user = user
        self.volume = volume
Ejemplo n.º 9
0
    def __init__(self,
                 hostname=None,
                 ip=None,
                 node_name=None,
                 target_ref=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1EndpointAddress - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._hostname = None
        self._ip = None
        self._node_name = None
        self._target_ref = None
        self.discriminator = None

        if hostname is not None:
            self.hostname = hostname
        self.ip = ip
        if node_name is not None:
            self.node_name = node_name
        if target_ref is not None:
            self.target_ref = target_ref
Ejemplo n.º 10
0
    def __init__(self,
                 app_protocol=None,
                 name=None,
                 port=None,
                 protocol=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1EndpointPort - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._app_protocol = None
        self._name = None
        self._port = None
        self._protocol = None
        self.discriminator = None

        if app_protocol is not None:
            self.app_protocol = app_protocol
        if name is not None:
            self.name = name
        self.port = port
        if protocol is not None:
            self.protocol = protocol
Ejemplo n.º 11
0
    def __init__(self,
                 min_ready_seconds=None,
                 replicas=None,
                 selector=None,
                 template=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1ReplicaSetSpec - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._min_ready_seconds = None
        self._replicas = None
        self._selector = None
        self._template = None
        self.discriminator = None

        if min_ready_seconds is not None:
            self.min_ready_seconds = min_ready_seconds
        if replicas is not None:
            self.replicas = replicas
        self.selector = selector
        if template is not None:
            self.template = template
Ejemplo n.º 12
0
    def __init__(self,
                 api_version=None,
                 description=None,
                 global_default=None,
                 kind=None,
                 metadata=None,
                 preemption_policy=None,
                 value=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1PriorityClass - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._api_version = None
        self._description = None
        self._global_default = None
        self._kind = None
        self._metadata = None
        self._preemption_policy = None
        self._value = None
        self.discriminator = None

        if api_version is not None:
            self.api_version = api_version
        if description is not None:
            self.description = description
        if global_default is not None:
            self.global_default = global_default
        if kind is not None:
            self.kind = kind
        if metadata is not None:
            self.metadata = metadata
        if preemption_policy is not None:
            self.preemption_policy = preemption_policy
        self.value = value
Ejemplo n.º 13
0
    def __init__(self,
                 build_date=None,
                 compiler=None,
                 git_commit=None,
                 git_tree_state=None,
                 git_version=None,
                 go_version=None,
                 major=None,
                 minor=None,
                 platform=None,
                 local_vars_configuration=None):  # noqa: E501
        """VersionInfo - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._build_date = None
        self._compiler = None
        self._git_commit = None
        self._git_tree_state = None
        self._git_version = None
        self._go_version = None
        self._major = None
        self._minor = None
        self._platform = None
        self.discriminator = None

        self.build_date = build_date
        self.compiler = compiler
        self.git_commit = git_commit
        self.git_tree_state = git_tree_state
        self.git_version = git_version
        self.go_version = go_version
        self.major = major
        self.minor = minor
        self.platform = platform
Ejemplo n.º 14
0
    def __init__(self,
                 metric_name=None,
                 metric_selector=None,
                 target_average_value=None,
                 target_value=None,
                 local_vars_configuration=None):  # noqa: E501
        """V2beta1ExternalMetricSource - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._metric_name = None
        self._metric_selector = None
        self._target_average_value = None
        self._target_value = None
        self.discriminator = None

        self.metric_name = metric_name
        if metric_selector is not None:
            self.metric_selector = metric_selector
        if target_average_value is not None:
            self.target_average_value = target_average_value
        if target_value is not None:
            self.target_value = target_value
Ejemplo n.º 15
0
    def __init__(self,
                 container_id=None,
                 exit_code=None,
                 finished_at=None,
                 message=None,
                 reason=None,
                 signal=None,
                 started_at=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1ContainerStateTerminated - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._container_id = None
        self._exit_code = None
        self._finished_at = None
        self._message = None
        self._reason = None
        self._signal = None
        self._started_at = None
        self.discriminator = None

        if container_id is not None:
            self.container_id = container_id
        self.exit_code = exit_code
        if finished_at is not None:
            self.finished_at = finished_at
        if message is not None:
            self.message = message
        if reason is not None:
            self.reason = reason
        if signal is not None:
            self.signal = signal
        if started_at is not None:
            self.started_at = started_at
Ejemplo n.º 16
0
    def __init__(self, mount_path=None, mount_propagation=None, name=None, read_only=None, sub_path=None, sub_path_expr=None, local_vars_configuration=None):  # noqa: E501
        """V1VolumeMount - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._mount_path = None
        self._mount_propagation = None
        self._name = None
        self._read_only = None
        self._sub_path = None
        self._sub_path_expr = None
        self.discriminator = None

        self.mount_path = mount_path
        if mount_propagation is not None:
            self.mount_propagation = mount_propagation
        self.name = name
        if read_only is not None:
            self.read_only = read_only
        if sub_path is not None:
            self.sub_path = sub_path
        if sub_path_expr is not None:
            self.sub_path_expr = sub_path_expr
Ejemplo n.º 17
0
    def __init__(self,
                 fs_type=None,
                 storage_policy_id=None,
                 storage_policy_name=None,
                 volume_path=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1VsphereVirtualDiskVolumeSource - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._fs_type = None
        self._storage_policy_id = None
        self._storage_policy_name = None
        self._volume_path = None
        self.discriminator = None

        if fs_type is not None:
            self.fs_type = fs_type
        if storage_policy_id is not None:
            self.storage_policy_id = storage_policy_id
        if storage_policy_name is not None:
            self.storage_policy_name = storage_policy_name
        self.volume_path = volume_path
Ejemplo n.º 18
0
    def __init__(self,
                 egress=None,
                 ingress=None,
                 pod_selector=None,
                 policy_types=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1NetworkPolicySpec - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._egress = None
        self._ingress = None
        self._pod_selector = None
        self._policy_types = None
        self.discriminator = None

        if egress is not None:
            self.egress = egress
        if ingress is not None:
            self.ingress = ingress
        self.pod_selector = pod_selector
        if policy_types is not None:
            self.policy_types = policy_types
    def __init__(self,
                 attach_error=None,
                 attached=None,
                 attachment_metadata=None,
                 detach_error=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1beta1VolumeAttachmentStatus - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._attach_error = None
        self._attached = None
        self._attachment_metadata = None
        self._detach_error = None
        self.discriminator = None

        if attach_error is not None:
            self.attach_error = attach_error
        self.attached = attached
        if attachment_metadata is not None:
            self.attachment_metadata = attachment_metadata
        if detach_error is not None:
            self.detach_error = detach_error
Ejemplo n.º 20
0
    def __init__(self,
                 fs_type=None,
                 partition=None,
                 pd_name=None,
                 read_only=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1GCEPersistentDiskVolumeSource - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._fs_type = None
        self._partition = None
        self._pd_name = None
        self._read_only = None
        self.discriminator = None

        if fs_type is not None:
            self.fs_type = fs_type
        if partition is not None:
            self.partition = partition
        self.pd_name = pd_name
        if read_only is not None:
            self.read_only = read_only
    def __init__(self,
                 allowed=None,
                 denied=None,
                 evaluation_error=None,
                 reason=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1SubjectAccessReviewStatus - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._allowed = None
        self._denied = None
        self._evaluation_error = None
        self._reason = None
        self.discriminator = None

        self.allowed = allowed
        if denied is not None:
            self.denied = denied
        if evaluation_error is not None:
            self.evaluation_error = evaluation_error
        if reason is not None:
            self.reason = reason
Ejemplo n.º 22
0
    def __init__(self, last_probe_time=None, last_transition_time=None, message=None, reason=None, status=None, type=None, local_vars_configuration=None):  # noqa: E501
        """V1JobCondition - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._last_probe_time = None
        self._last_transition_time = None
        self._message = None
        self._reason = None
        self._status = None
        self._type = None
        self.discriminator = None

        if last_probe_time is not None:
            self.last_probe_time = last_probe_time
        if last_transition_time is not None:
            self.last_transition_time = last_transition_time
        if message is not None:
            self.message = message
        if reason is not None:
            self.reason = reason
        self.status = status
        self.type = type
    def __init__(self,
                 fs_type=None,
                 read_only=None,
                 secret_ref=None,
                 volume_id=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1CinderPersistentVolumeSource - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._fs_type = None
        self._read_only = None
        self._secret_ref = None
        self._volume_id = None
        self.discriminator = None

        if fs_type is not None:
            self.fs_type = fs_type
        if read_only is not None:
            self.read_only = read_only
        if secret_ref is not None:
            self.secret_ref = secret_ref
        self.volume_id = volume_id
Ejemplo n.º 24
0
    def __init__(self,
                 group=None,
                 kind=None,
                 service_account=None,
                 user=None,
                 local_vars_configuration=None):  # noqa: E501
        """FlowcontrolV1beta1Subject - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._group = None
        self._kind = None
        self._service_account = None
        self._user = None
        self.discriminator = None

        if group is not None:
            self.group = group
        self.kind = kind
        if service_account is not None:
            self.service_account = service_account
        if user is not None:
            self.user = user
    def __init__(self,
                 field_ref=None,
                 mode=None,
                 path=None,
                 resource_field_ref=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1DownwardAPIVolumeFile - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._field_ref = None
        self._mode = None
        self._path = None
        self._resource_field_ref = None
        self.discriminator = None

        if field_ref is not None:
            self.field_ref = field_ref
        if mode is not None:
            self.mode = mode
        self.path = path
        if resource_field_ref is not None:
            self.resource_field_ref = resource_field_ref
 def setup_k8s_responses(self, mock_config, mock_client, pod_name):
     os.environ['KUBERNETES_SERVICE_HOST'] = '127.0.0.1'
     os.environ['KUBERNETES_SERVICE_PORT'] = '9988'
     os.environ['POD_NAME'] = pod_name
     configuration = Configuration()
     configuration.host = 'http://127.0.0.1:9988'
     configuration.api_key = {'authorization': 'bearer T0ken'}
     Configuration.set_default(configuration)
     mock_config.return_value = None
     pod1 = mock.MagicMock()
     pod1.metadata.name = 'api-123'
     pod1.status.phase = 'Running'
     pod2 = mock.MagicMock()
     pod2.metadata.name = 'api-234'
     pod2.status.phase = 'Running'
     pod3 = mock.MagicMock()
     pod3.metadata.name = 'api-345'
     pod3.status.phase = 'Terminating'
     mock_client.CoreV1Api().list_namespaced_pod().items = [
         pod1, pod2, pod3
     ]
    def __init__(self, allow_privilege_escalation=None, allowed_csi_drivers=None, allowed_capabilities=None, allowed_flex_volumes=None, allowed_host_paths=None, allowed_proc_mount_types=None, allowed_unsafe_sysctls=None, default_add_capabilities=None, default_allow_privilege_escalation=None, forbidden_sysctls=None, fs_group=None, host_ipc=None, host_network=None, host_pid=None, host_ports=None, privileged=None, read_only_root_filesystem=None, required_drop_capabilities=None, run_as_group=None, run_as_user=None, runtime_class=None, se_linux=None, supplemental_groups=None, volumes=None, local_vars_configuration=None):  # noqa: E501
        """V1beta1PodSecurityPolicySpec - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._allow_privilege_escalation = None
        self._allowed_csi_drivers = None
        self._allowed_capabilities = None
        self._allowed_flex_volumes = None
        self._allowed_host_paths = None
        self._allowed_proc_mount_types = None
        self._allowed_unsafe_sysctls = None
        self._default_add_capabilities = None
        self._default_allow_privilege_escalation = None
        self._forbidden_sysctls = None
        self._fs_group = None
        self._host_ipc = None
        self._host_network = None
        self._host_pid = None
        self._host_ports = None
        self._privileged = None
        self._read_only_root_filesystem = None
        self._required_drop_capabilities = None
        self._run_as_group = None
        self._run_as_user = None
        self._runtime_class = None
        self._se_linux = None
        self._supplemental_groups = None
        self._volumes = None
        self.discriminator = None

        if allow_privilege_escalation is not None:
            self.allow_privilege_escalation = allow_privilege_escalation
        if allowed_csi_drivers is not None:
            self.allowed_csi_drivers = allowed_csi_drivers
        if allowed_capabilities is not None:
            self.allowed_capabilities = allowed_capabilities
        if allowed_flex_volumes is not None:
            self.allowed_flex_volumes = allowed_flex_volumes
        if allowed_host_paths is not None:
            self.allowed_host_paths = allowed_host_paths
        if allowed_proc_mount_types is not None:
            self.allowed_proc_mount_types = allowed_proc_mount_types
        if allowed_unsafe_sysctls is not None:
            self.allowed_unsafe_sysctls = allowed_unsafe_sysctls
        if default_add_capabilities is not None:
            self.default_add_capabilities = default_add_capabilities
        if default_allow_privilege_escalation is not None:
            self.default_allow_privilege_escalation = default_allow_privilege_escalation
        if forbidden_sysctls is not None:
            self.forbidden_sysctls = forbidden_sysctls
        self.fs_group = fs_group
        if host_ipc is not None:
            self.host_ipc = host_ipc
        if host_network is not None:
            self.host_network = host_network
        if host_pid is not None:
            self.host_pid = host_pid
        if host_ports is not None:
            self.host_ports = host_ports
        if privileged is not None:
            self.privileged = privileged
        if read_only_root_filesystem is not None:
            self.read_only_root_filesystem = read_only_root_filesystem
        if required_drop_capabilities is not None:
            self.required_drop_capabilities = required_drop_capabilities
        if run_as_group is not None:
            self.run_as_group = run_as_group
        self.run_as_user = run_as_user
        if runtime_class is not None:
            self.runtime_class = runtime_class
        self.se_linux = se_linux
        self.supplemental_groups = supplemental_groups
        if volumes is not None:
            self.volumes = volumes
with open(os.path.join(service_account_path, 'namespace')) as fp:
    namespace = fp.read().strip()

# Initialise client for the REST API used doing configuration.
#
# XXX Currently have a workaround here for OpenShift 4.0 beta versions
# which disables verification of the certificate. If don't use this the
# Python openshift/kubernetes clients will fail. We also disable any
# warnings from urllib3 to get rid of the noise in the logs this creates.

load_incluster_config()

import urllib3
urllib3.disable_warnings()
instance = Configuration()
instance.verify_ssl = False
Configuration.set_default(instance)

api_client = DynamicClient(ApiClient())

image_stream_resource = api_client.resources.get(
    api_version='image.openshift.io/v1', kind='ImageStream')

# Helper function for determining the correct name for the image. We
# need to do this for references to image streams because of the image
# lookup policy often not being correctly setup on OpenShift clusters.


def resolve_image_name(name):
    # If the image name contains a slash, we assume it is already
Ejemplo n.º 29
0
    def __init__(self,
                 annotations=None,
                 cluster_name=None,
                 creation_timestamp=None,
                 deletion_grace_period_seconds=None,
                 deletion_timestamp=None,
                 finalizers=None,
                 generate_name=None,
                 generation=None,
                 labels=None,
                 managed_fields=None,
                 name=None,
                 namespace=None,
                 owner_references=None,
                 resource_version=None,
                 self_link=None,
                 uid=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1ObjectMeta - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._annotations = None
        self._cluster_name = None
        self._creation_timestamp = None
        self._deletion_grace_period_seconds = None
        self._deletion_timestamp = None
        self._finalizers = None
        self._generate_name = None
        self._generation = None
        self._labels = None
        self._managed_fields = None
        self._name = None
        self._namespace = None
        self._owner_references = None
        self._resource_version = None
        self._self_link = None
        self._uid = None
        self.discriminator = None

        if annotations is not None:
            self.annotations = annotations
        if cluster_name is not None:
            self.cluster_name = cluster_name
        if creation_timestamp is not None:
            self.creation_timestamp = creation_timestamp
        if deletion_grace_period_seconds is not None:
            self.deletion_grace_period_seconds = deletion_grace_period_seconds
        if deletion_timestamp is not None:
            self.deletion_timestamp = deletion_timestamp
        if finalizers is not None:
            self.finalizers = finalizers
        if generate_name is not None:
            self.generate_name = generate_name
        if generation is not None:
            self.generation = generation
        if labels is not None:
            self.labels = labels
        if managed_fields is not None:
            self.managed_fields = managed_fields
        if name is not None:
            self.name = name
        if namespace is not None:
            self.namespace = namespace
        if owner_references is not None:
            self.owner_references = owner_references
        if resource_version is not None:
            self.resource_version = resource_version
        if self_link is not None:
            self.self_link = self_link
        if uid is not None:
            self.uid = uid
Ejemplo n.º 30
0
    def __init__(self,
                 aws_elastic_block_store=None,
                 azure_disk=None,
                 azure_file=None,
                 cephfs=None,
                 cinder=None,
                 config_map=None,
                 csi=None,
                 downward_api=None,
                 empty_dir=None,
                 ephemeral=None,
                 fc=None,
                 flex_volume=None,
                 flocker=None,
                 gce_persistent_disk=None,
                 git_repo=None,
                 glusterfs=None,
                 host_path=None,
                 iscsi=None,
                 name=None,
                 nfs=None,
                 persistent_volume_claim=None,
                 photon_persistent_disk=None,
                 portworx_volume=None,
                 projected=None,
                 quobyte=None,
                 rbd=None,
                 scale_io=None,
                 secret=None,
                 storageos=None,
                 vsphere_volume=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1Volume - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._aws_elastic_block_store = None
        self._azure_disk = None
        self._azure_file = None
        self._cephfs = None
        self._cinder = None
        self._config_map = None
        self._csi = None
        self._downward_api = None
        self._empty_dir = None
        self._ephemeral = None
        self._fc = None
        self._flex_volume = None
        self._flocker = None
        self._gce_persistent_disk = None
        self._git_repo = None
        self._glusterfs = None
        self._host_path = None
        self._iscsi = None
        self._name = None
        self._nfs = None
        self._persistent_volume_claim = None
        self._photon_persistent_disk = None
        self._portworx_volume = None
        self._projected = None
        self._quobyte = None
        self._rbd = None
        self._scale_io = None
        self._secret = None
        self._storageos = None
        self._vsphere_volume = None
        self.discriminator = None

        if aws_elastic_block_store is not None:
            self.aws_elastic_block_store = aws_elastic_block_store
        if azure_disk is not None:
            self.azure_disk = azure_disk
        if azure_file is not None:
            self.azure_file = azure_file
        if cephfs is not None:
            self.cephfs = cephfs
        if cinder is not None:
            self.cinder = cinder
        if config_map is not None:
            self.config_map = config_map
        if csi is not None:
            self.csi = csi
        if downward_api is not None:
            self.downward_api = downward_api
        if empty_dir is not None:
            self.empty_dir = empty_dir
        if ephemeral is not None:
            self.ephemeral = ephemeral
        if fc is not None:
            self.fc = fc
        if flex_volume is not None:
            self.flex_volume = flex_volume
        if flocker is not None:
            self.flocker = flocker
        if gce_persistent_disk is not None:
            self.gce_persistent_disk = gce_persistent_disk
        if git_repo is not None:
            self.git_repo = git_repo
        if glusterfs is not None:
            self.glusterfs = glusterfs
        if host_path is not None:
            self.host_path = host_path
        if iscsi is not None:
            self.iscsi = iscsi
        self.name = name
        if nfs is not None:
            self.nfs = nfs
        if persistent_volume_claim is not None:
            self.persistent_volume_claim = persistent_volume_claim
        if photon_persistent_disk is not None:
            self.photon_persistent_disk = photon_persistent_disk
        if portworx_volume is not None:
            self.portworx_volume = portworx_volume
        if projected is not None:
            self.projected = projected
        if quobyte is not None:
            self.quobyte = quobyte
        if rbd is not None:
            self.rbd = rbd
        if scale_io is not None:
            self.scale_io = scale_io
        if secret is not None:
            self.secret = secret
        if storageos is not None:
            self.storageos = storageos
        if vsphere_volume is not None:
            self.vsphere_volume = vsphere_volume
Ejemplo n.º 31
0
    def __init__(self,
                 ref=None,
                 schema=None,
                 additional_items=None,
                 additional_properties=None,
                 all_of=None,
                 any_of=None,
                 default=None,
                 definitions=None,
                 dependencies=None,
                 description=None,
                 enum=None,
                 example=None,
                 exclusive_maximum=None,
                 exclusive_minimum=None,
                 external_docs=None,
                 format=None,
                 id=None,
                 items=None,
                 max_items=None,
                 max_length=None,
                 max_properties=None,
                 maximum=None,
                 min_items=None,
                 min_length=None,
                 min_properties=None,
                 minimum=None,
                 multiple_of=None,
                 _not=None,
                 nullable=None,
                 one_of=None,
                 pattern=None,
                 pattern_properties=None,
                 properties=None,
                 required=None,
                 title=None,
                 type=None,
                 unique_items=None,
                 x_kubernetes_embedded_resource=None,
                 x_kubernetes_int_or_string=None,
                 x_kubernetes_list_map_keys=None,
                 x_kubernetes_list_type=None,
                 x_kubernetes_map_type=None,
                 x_kubernetes_preserve_unknown_fields=None,
                 local_vars_configuration=None):  # noqa: E501
        """V1JSONSchemaProps - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._ref = None
        self._schema = None
        self._additional_items = None
        self._additional_properties = None
        self._all_of = None
        self._any_of = None
        self._default = None
        self._definitions = None
        self._dependencies = None
        self._description = None
        self._enum = None
        self._example = None
        self._exclusive_maximum = None
        self._exclusive_minimum = None
        self._external_docs = None
        self._format = None
        self._id = None
        self._items = None
        self._max_items = None
        self._max_length = None
        self._max_properties = None
        self._maximum = None
        self._min_items = None
        self._min_length = None
        self._min_properties = None
        self._minimum = None
        self._multiple_of = None
        self.__not = None
        self._nullable = None
        self._one_of = None
        self._pattern = None
        self._pattern_properties = None
        self._properties = None
        self._required = None
        self._title = None
        self._type = None
        self._unique_items = None
        self._x_kubernetes_embedded_resource = None
        self._x_kubernetes_int_or_string = None
        self._x_kubernetes_list_map_keys = None
        self._x_kubernetes_list_type = None
        self._x_kubernetes_map_type = None
        self._x_kubernetes_preserve_unknown_fields = None
        self.discriminator = None

        if ref is not None:
            self.ref = ref
        if schema is not None:
            self.schema = schema
        if additional_items is not None:
            self.additional_items = additional_items
        if additional_properties is not None:
            self.additional_properties = additional_properties
        if all_of is not None:
            self.all_of = all_of
        if any_of is not None:
            self.any_of = any_of
        if default is not None:
            self.default = default
        if definitions is not None:
            self.definitions = definitions
        if dependencies is not None:
            self.dependencies = dependencies
        if description is not None:
            self.description = description
        if enum is not None:
            self.enum = enum
        if example is not None:
            self.example = example
        if exclusive_maximum is not None:
            self.exclusive_maximum = exclusive_maximum
        if exclusive_minimum is not None:
            self.exclusive_minimum = exclusive_minimum
        if external_docs is not None:
            self.external_docs = external_docs
        if format is not None:
            self.format = format
        if id is not None:
            self.id = id
        if items is not None:
            self.items = items
        if max_items is not None:
            self.max_items = max_items
        if max_length is not None:
            self.max_length = max_length
        if max_properties is not None:
            self.max_properties = max_properties
        if maximum is not None:
            self.maximum = maximum
        if min_items is not None:
            self.min_items = min_items
        if min_length is not None:
            self.min_length = min_length
        if min_properties is not None:
            self.min_properties = min_properties
        if minimum is not None:
            self.minimum = minimum
        if multiple_of is not None:
            self.multiple_of = multiple_of
        if _not is not None:
            self._not = _not
        if nullable is not None:
            self.nullable = nullable
        if one_of is not None:
            self.one_of = one_of
        if pattern is not None:
            self.pattern = pattern
        if pattern_properties is not None:
            self.pattern_properties = pattern_properties
        if properties is not None:
            self.properties = properties
        if required is not None:
            self.required = required
        if title is not None:
            self.title = title
        if type is not None:
            self.type = type
        if unique_items is not None:
            self.unique_items = unique_items
        if x_kubernetes_embedded_resource is not None:
            self.x_kubernetes_embedded_resource = x_kubernetes_embedded_resource
        if x_kubernetes_int_or_string is not None:
            self.x_kubernetes_int_or_string = x_kubernetes_int_or_string
        if x_kubernetes_list_map_keys is not None:
            self.x_kubernetes_list_map_keys = x_kubernetes_list_map_keys
        if x_kubernetes_list_type is not None:
            self.x_kubernetes_list_type = x_kubernetes_list_type
        if x_kubernetes_map_type is not None:
            self.x_kubernetes_map_type = x_kubernetes_map_type
        if x_kubernetes_preserve_unknown_fields is not None:
            self.x_kubernetes_preserve_unknown_fields = x_kubernetes_preserve_unknown_fields