Models

Base Models

class kubernetes_manager.models.base.KubernetesBase(*args, **kwargs)

Bases: django_extensions.db.models.TitleSlugDescriptionModel

Type

model (abstract)

Description

Base parent model that all subsequent models inherit from.

Inherits

django_extensions.db.models.TitleSlugDescriptionModel

Fields

id, cluster, config, deployed, deleted

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

class Meta

Bases: object

abstract = False
cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

cluster_id
config

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

deployed

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_client(API=<class 'kubernetes.client.apis.core_v1_api.CoreV1Api'>, **kwargs)

Gets a k8s api client

Args:

API (client.<type>) - Kubernetes Client Type

Returns:

object of type <API>

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

removed

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

slugify_function(content)
Description

Overrides default slugify with custom logic.

class kubernetes_manager.models.base.KubernetesMetadataObjBase(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesBase

Type

model (abstract)

Description

Extends KubernetesBase to include metadata fields.

Inherits

kubernetes_manager.models.base.KubernetesBase

Fields

labels, annotations

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

  • labels (JSONField) – Dictionary store equivalent to Labels in Kubernetes API

  • annotations (JSONField) – Dictionary store equivalent to Annotations in Kubernetes API

class Meta

Bases: object

abstract = False
annotations

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

labels

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kubernetes_manager.models.base.KubernetesNetworkingBase(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesMetadataObjBase

Type

model (abstract)

Description

Extends KubernetesMetadataObjBase to include network fields.

Inherits

kubernetes_manager.models.base.KubernetesMetadataObjBase

Fields

labels, annotations

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

  • labels (JSONField) – Dictionary store equivalent to Labels in Kubernetes API

  • annotations (JSONField) – Dictionary store equivalent to Annotations in Kubernetes API

  • api_version (CharField) – API version used to deploy child object.

  • kind (CharField) – String representation of Kubernetes object kind

  • port (IntegerField) – Port object will expose

  • namespace_id (ForeignKey) – Live namespace the object is associated with.

  • kuid (CharField) – Object’s UID in the cluster

class Meta

Bases: object

abstract = False
api_version

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

kind

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

kuid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

namespace

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

namespace_id
port

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Kubernetes Models

class kubernetes_manager.models.kube.KubernetesConfigMap(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesMetadataObjBase

Type

model

Description

Holds data related to a kubernetes volume mount.

Inherits

kubernetes_manager.models.base.KubernetesMetadataObjBase

Fields

kind, data, binary, override_name, namespace

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

  • labels (JSONField) – Dictionary store equivalent to Labels in Kubernetes API

  • annotations (JSONField) – Dictionary store equivalent to Annotations in Kubernetes API

  • kind (CharField) – Kind

  • data (JSONField) – Data

  • binary (BinaryField) – Binary

  • override_name (CharField) – Override name

  • namespace_id (ForeignKey) – Namespace

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

binary

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

data

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

deploy()
Description

Deploy configmap obj.

get_obj()
Description

Generate configmap spec.

kind

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

namespace

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

namespace_id
objects = <django.db.models.manager.Manager object>
override_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

remove()
Description

Delete configmap from namespace.

class kubernetes_manager.models.kube.KubernetesContainer(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesBase

Type

model

Description

Holds data related to a kubernetes contaienr.

Inherits

kubernetes_manager.models.base.KubernetesBase

Fields

image_name, image_tag, image_pull_policy, command, args, port, volume_mount

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

  • image_name (CharField) – Properly qualified image name.

  • image_tag (CharField) – Tag name for the image to be used for this job

  • image_pull_policy (CharField) – Image pull policy

  • command (TextField) – Command to run when start container

  • args (TextField) – Comma separated args to run with command when instantiating container.

  • port (IntegerField) – Port to expose.

  • volume_mounts (ManyToManyField) – Mounts for any number of volumes

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

args

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

command

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_image_pull_policy_display(*, field=<django.db.models.fields.CharField: image_pull_policy>)
get_obj()
Description

Generate container spec.

image_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

image_pull_policy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

image_tag

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

kubernetespodtemplate_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
port

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

volume_mounts

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class kubernetes_manager.models.kube.KubernetesDeployment(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesNetworkingBase, kubernetes_manager.models.mixins.KubernetesTelemetryMixin

Type

model

Description

Holds data related to a kubernetes deployment.

Inherits

kubernetes_manager.models.base.KubernetesNetworkingBase, kubernetes_manager.models.base.KubernetesTelemetryMixin

Fields

selector, replicas, pod_template

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

  • labels (JSONField) – Dictionary store equivalent to Labels in Kubernetes API

  • annotations (JSONField) – Dictionary store equivalent to Annotations in Kubernetes API

  • api_version (CharField) – API version used to deploy child object.

  • kind (CharField) – String representation of Kubernetes object kind

  • port (IntegerField) – Port object will expose

  • namespace_id (ForeignKey) – Live namespace the object is associated with.

  • kuid (CharField) – Object’s UID in the cluster

  • object_status (CharField) – status of the object in Kubernetes

  • average_cpu_usage (DecimalField) – Average PIT CPU units consumed

  • average_mem_usage (IntegerField) – Average PIT bytes consumed

  • cpu_usage_seconds (DecimalField) – Average cpu usage * seconds live

  • mem_usage_seconds (IntegerField) – Average mem usage * seconds live

  • selector (JSONField) – Selector

  • replicas (IntegerField) – Replicas

  • pod_template_id (ForeignKey) – Pod template

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

deploy()
Description

Deploy deployment obj.

get_obj()
Description

Generate Deployment spec.

namespace

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

objects = <django.db.models.manager.Manager object>
pod_template

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

pod_template_id
remove()
Description

Remove deployment from namespace.

replicas

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

selector

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kubernetes_manager.models.kube.KubernetesIngress(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesNetworkingBase

Type

model

Description

Holds data related to a kubernetes ingress.

Inherits

kubernetes_manager.models.base.KubernetesNetworkingBase

Fields

hostname, path, target_service

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

  • labels (JSONField) – Dictionary store equivalent to Labels in Kubernetes API

  • annotations (JSONField) – Dictionary store equivalent to Annotations in Kubernetes API

  • api_version (CharField) – API version used to deploy child object.

  • kind (CharField) – String representation of Kubernetes object kind

  • port (IntegerField) – Port object will expose

  • namespace_id (ForeignKey) – Live namespace the object is associated with.

  • kuid (CharField) – Object’s UID in the cluster

  • hostname (CharField) – Hostname

  • path (CharField) – Path

  • target_service_id (ForeignKey) – Target service

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

deploy()
Description

Deploy ingress to ns.

get_obj()
Description

Generate ingress obj.

hostname

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

namespace

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

objects = <django.db.models.manager.Manager object>
path

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

remove()
Description

Remove ingress from ns.

target_service

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

target_service_id
class kubernetes_manager.models.kube.KubernetesJob(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesNetworkingBase, kubernetes_manager.models.mixins.KubernetesTelemetryMixin

Type

model

Description

Holds data related to a kubernetes pod spec.

Inherits

kubernetes_manager.models.base.KubernetesNetworkingBase, kubernetes_manager.models.base.KubernetesTelemetryMixin

Fields

selector, replicas, pod_template

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

  • labels (JSONField) – Dictionary store equivalent to Labels in Kubernetes API

  • annotations (JSONField) – Dictionary store equivalent to Annotations in Kubernetes API

  • api_version (CharField) – API version used to deploy child object.

  • kind (CharField) – String representation of Kubernetes object kind

  • port (IntegerField) – Port object will expose

  • namespace_id (ForeignKey) – Live namespace the object is associated with.

  • kuid (CharField) – Object’s UID in the cluster

  • object_status (CharField) – status of the object in Kubernetes

  • average_cpu_usage (DecimalField) – Average PIT CPU units consumed

  • average_mem_usage (IntegerField) – Average PIT bytes consumed

  • cpu_usage_seconds (DecimalField) – Average cpu usage * seconds live

  • mem_usage_seconds (IntegerField) – Average mem usage * seconds live

  • pod_template_id (ForeignKey) – Pod template

  • backoff_limit (IntegerField) – Backoff limit

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

backoff_limit

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

deploy()
Description

Deploy job to ns.

get_obj()
Description

Generate job spec.

namespace

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

objects = <django.db.models.manager.Manager object>
pod_template

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

pod_template_id
remove()
Description

Remove job from ns.

class kubernetes_manager.models.kube.KubernetesNamespace(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesMetadataObjBase

Type

model

Description

Holds data related to a Kubernetes namespace.

Inherits

kubernetes_manager.models.base.KubernetesBase

Fields

api_version, kind, exists

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

  • labels (JSONField) – Dictionary store equivalent to Labels in Kubernetes API

  • annotations (JSONField) – Dictionary store equivalent to Annotations in Kubernetes API

  • api_version (CharField) – Api version

  • kind (CharField) – Kind

  • exists (BooleanField) – Exists

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

api_version

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

deploy()
Description

Deploy namespace obj.

exists

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_obj()
Description

Generate namespace spec.

kind

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

kubernetesconfigmap_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesdeployment_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesingress_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesjob_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesservice_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
remove()
Description

Delete namespace from cluster.

class kubernetes_manager.models.kube.KubernetesPodTemplate(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesMetadataObjBase

Type

model

Description

Holds data related to a kubernetes pod spec.

Inherits

kubernetes_manager.models.base.KubernetesMetadataObjBase

Fields

volume, primary_container, secondary_container, restart_policy

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

  • labels (JSONField) – Dictionary store equivalent to Labels in Kubernetes API

  • annotations (JSONField) – Dictionary store equivalent to Annotations in Kubernetes API

  • restart_policy (CharField) – How the pod should handle restart om case of failures

  • volumes (ManyToManyField) – All volumes to be created for a pod.

  • containers (ManyToManyField) – All containers to be included in a pod.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

containers

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_obj()
Description

Generate pod spec.

get_restart_policy_display(*, field=<django.db.models.fields.CharField: restart_policy>)
kubernetesdeployment_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesjob_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
restart_policy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

volumes

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class kubernetes_manager.models.kube.KubernetesService(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesNetworkingBase

Type

model

Description

Holds data related to a kubernetes service.

Inherits

kubernetes_manager.models.base.KubernetesNetworkingBase

Fields

selector, target_port

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

  • labels (JSONField) – Dictionary store equivalent to Labels in Kubernetes API

  • annotations (JSONField) – Dictionary store equivalent to Annotations in Kubernetes API

  • api_version (CharField) – API version used to deploy child object.

  • kind (CharField) – String representation of Kubernetes object kind

  • port (IntegerField) – Port object will expose

  • namespace_id (ForeignKey) – Live namespace the object is associated with.

  • kuid (CharField) – Object’s UID in the cluster

  • selector (JSONField) – Selector

  • target_port (IntegerField) – Target port

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

deploy()
Description

Deploy service to ns.

get_obj()
Description

Generate service spec.

kubernetesingress_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

namespace

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

objects = <django.db.models.manager.Manager object>
remove()
Description

Remove service from ns.

selector

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

target_port

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kubernetes_manager.models.kube.KubernetesVolume(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesBase

Type

model

Description

Holds data related to a kubernetes volume.

Inherits

kubernetes_manager.models.base.KubernetesBase

Fields
Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

get_obj()
Description

Generate volume spec.

kubernetespodtemplate_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
class kubernetes_manager.models.kube.KubernetesVolumeMount(*args, **kwargs)

Bases: kubernetes_manager.models.base.KubernetesBase

Type

model

Description

Holds data related to a kubernetes volume mount.

Inherits

kubernetes_manager.models.base.KubernetesBase

Fields

mount_path, sub_path

Parameters
  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • id (UUIDField) – UUID Auto field.

  • cluster_id (ForeignKey) – ForeignKey to TargetCluster object.

  • config (JSONField) – Pass in extra parameters here.

  • deployed (DateTimeField) – Time when object is applied to cluster.

  • removed (DateTimeField) – Time when object is removed from cluster.

  • mount_path (CharField) – Mount path

  • sub_path (CharField) – Sub path

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

cluster

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

get_obj()
Description

Generate mount spec.

kubernetescontainer_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

mount_path

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
sub_path

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Kubernetes Model-Mixins

class kubernetes_manager.models.mixins.KubernetesTelemetryMixin(*args, **kwargs)

Bases: django.db.models.base.Model

Type

mixin

Description

Extends child model to include telemetry features.

Inherits

django.db.models.Model

Fields

object_status, average_cpu_usage, average_mem_usage, cpu_usage_seconds, mem_usage_seconds

Parameters
  • object_status (CharField) – status of the object in Kubernetes

  • average_cpu_usage (DecimalField) – Average PIT CPU units consumed

  • average_mem_usage (IntegerField) – Average PIT bytes consumed

  • cpu_usage_seconds (DecimalField) – Average cpu usage * seconds live

  • mem_usage_seconds (IntegerField) – Average mem usage * seconds live

class Meta

Bases: object

abstract = False
average_cpu_usage

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

average_mem_usage

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cpu_usage_seconds

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

mem_usage_seconds

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

object_status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

parseSize(size)
Description

Parses string as numeric, suffix and converts to bytes.

read_pod_metrics()
Description

Uses metrics_server to get cadvisor data.

read_pod_usage()
Description

Converts metrics into dictionary for api usage.

splitNumeric(size)
Description

Parses string into numeric component.

status()
Description

Returns status data of object.

Target Cluster Model

class kubernetes_manager.models.target_cluster.TargetCluster(*args, **kwargs)

Bases: django_extensions.db.models.TitleSlugDescriptionModel

Type

model

Description

Holds data related to a cluster context.

Inherits

django_extensions.db.models.TitleSlugDescriptionModel

Fields

api_endpoint, telemetry_endpoint, telemetry_source, config

Parameters
  • id (AutoField) – Id

  • title (CharField) – Title

  • description (TextField) – Description

  • slug (AutoSlugField) – Slug

  • api_endpoint (URLField) – Cluster Endpoint URL

  • telemetry_endpoint (URLField) – Telemetry Endpoint URL

  • telemetry_source (CharField) – Telemetry source

  • config (JSONField) – Equivalent to .kube/config but all JSON

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

classmethod add(kubeconfig)

Class method to a new TargetCluster

Args:

kubeconfig (str) - string contents of kubeconfig file

Returns:

list(TargetCluster)

api_endpoint

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

config

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_telemetry_source_display(*, field=<django.db.models.fields.CharField: telemetry_source>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

kubernetesconfigmap_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetescontainer_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesdeployment_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesingress_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesjob_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesnamespace_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetespodtemplate_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesservice_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesvolume_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

kubernetesvolumemount_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
telemetry_endpoint

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

telemetry_source

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.