avionix.kube.apps

Classes related to Deployments, StatefulSets, ReplicaSets and DaemonSets

class avionix.kube.apps.ControllerRevision(metadata, data, revision, api_version=None)
Parameters
class avionix.kube.apps.DaemonSet(metadata, spec, api_version=None)
Parameters
class avionix.kube.apps.DaemonSetSpec(template, selector, min_ready_seconds=None, revision_history_limit=None, update_strategy=None)
Parameters
  • template (PodTemplateSpec) – An object that describes the pod that will be created. The DaemonSet will create exactly one copy of this pod on every node that matches the template’s node selector (or on every node if no node selector is specified). More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template # noqa

  • selector (LabelSelector) – A label query over pods that are managed by the daemon set. Must match in order to be controlled. It must match the pod template’s labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors # noqa

  • min_ready_seconds (Optional[int]) – The minimum number of seconds for which a newly created DaemonSet pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready).

  • revision_history_limit (Optional[int]) – The number of old history to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.

  • update_strategy (Optional[DaemonSetUpdateStrategy]) – An update strategy to replace existing DaemonSet pods with new pods.

class avionix.kube.apps.DaemonSetUpdateStrategy(rolling_update=None, type=None)
Parameters
  • rolling_update (Optional[RollingUpdateDaemonSet]) – Rolling update config params. Present only if type = “RollingUpdate”.

  • type (Optional[str]) – Type of daemon set update. Can be “RollingUpdate” or “OnDelete”. Default is RollingUpdate.

class avionix.kube.apps.Deployment(metadata, spec, api_version=None)
Parameters
class avionix.kube.apps.DeploymentSpec(template, selector, min_ready_seconds=None, paused=None, progress_deadline_seconds=None, replicas=None, revision_history_limit=None, strategy=None)
Parameters
  • template (PodTemplateSpec) – Template describes the pods that will be created.

  • selector (LabelSelector) – Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template’s labels.

  • min_ready_seconds (Optional[int]) – Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)

  • paused (Optional[bool]) – Indicates that the deployment is paused.

  • progress_deadline_seconds (Optional[int]) – The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that progress will not be estimated during the time a deployment is paused. Defaults to 600s.

  • replicas (Optional[int]) – Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.

  • revision_history_limit (Optional[int]) – The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.

  • strategy (Optional[DeploymentStrategy]) – The deployment strategy to use to replace existing pods with new ones.

class avionix.kube.apps.DeploymentStrategy(rolling_update=None, type=None)
Parameters
  • rolling_update (Optional[RollingUpdateDeployment]) – Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.

  • type (Optional[str]) – Type of deployment. Can be “Recreate” or “RollingUpdate”. Default is RollingUpdate.

class avionix.kube.apps.ReplicaSet(metadata, spec, api_version=None)
Parameters
class avionix.kube.apps.ReplicaSetSpec(template, selector, min_ready_seconds=None, replicas=None)
Parameters
class avionix.kube.apps.RollingUpdateDaemonSet(max_unavailable)
Parameters

max_unavailable (Union[int, str]) – The maximum number of DaemonSet pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of total number of DaemonSet pods at the start of the update (ex: 10%). Absolute number is calculated from percentage by rounding up. This cannot be 0. Default value is 1. Example: when this is set to 30%, at most 30% of the total number of nodes that should be running the daemon pod (i.e. status.desiredNumberScheduled) can have their pods stopped for an update at any given time. The update starts by stopping at most 30% of those DaemonSet pods and then brings up new DaemonSet pods in their place. Once the new pods are available, it then proceeds onto other DaemonSet pods, thus ensuring that at least 70% of original number of DaemonSet pods are available at all times during the update.

class avionix.kube.apps.RollingUpdateDeployment(max_surge=None, max_unavailable=None)
Parameters
  • max_surge (Union[int, str, None]) – The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods.

  • max_unavailable (Union[int, str, None]) – The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Defaults to 25%. Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods.

class avionix.kube.apps.RollingUpdateStatefulSetStrategy(partition)
Parameters

partition (int) – Partition indicates the ordinal at which the StatefulSet should be partitioned. Default value is 0.

class avionix.kube.apps.StatefulSet(metadata, spec, api_version=None)
Parameters
class avionix.kube.apps.StatefulSetSpec(template, selector, service_name, pod_management_policy=None, revision_history_limit=None, volume_claim_templates=None, replicas=None, update_strategy=None)
Parameters
  • template (PodTemplateSpec) – template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet.

  • selector (LabelSelector) – selector is a label query over pods that should match the replica count. It must match the pod template’s labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors # noqa

  • service_name (str) – serviceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where “pod-specific-string” is managed by the StatefulSet controller.

  • pod_management_policy (Optional[str]) – podManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. The default policy is OrderedReady, where pods are created in increasing order (pod-0, then pod-1, etc) and the controller will wait until each pod is ready before continuing. When scaling down, the pods are removed in the opposite order. The alternative policy is Parallel which will create pods in parallel to match the desired scale without waiting, and on scale down will delete all pods at once.

  • revision_history_limit (Optional[int]) – revisionHistoryLimit is the maximum number of revisions that will be maintained in the StatefulSet’s revision history. The revision history consists of all revisions not represented by a currently applied StatefulSetSpec version. The default value is 10.

  • volume_claim_templates (Optional[List[PersistentVolumeClaim]]) – volumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.

  • replicas (Optional[int]) – replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.

  • update_strategy (Optional[StatefulSetUpdateStrategy]) – updateStrategy indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.

class avionix.kube.apps.StatefulSetUpdateStrategy(rolling_update=None, type=None)
Parameters
  • rolling_update (Optional[RollingUpdateStatefulSetStrategy]) – RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType.

  • type (Optional[str]) – Type indicates the type of the StatefulSetUpdateStrategy. Default is RollingUpdate.