def scale(namespace: str, default_uptime: str, default_downtime: str, kinds: FrozenSet[str], exclude_namespaces: FrozenSet[str], exclude_deployments: FrozenSet[str], exclude_statefulsets: FrozenSet[str], dry_run: bool, grace_period: int): api = helper.get_kube_api() now = datetime.datetime.utcnow() forced_uptime = pods_force_uptime(api, namespace) if 'deployment' in kinds: autoscale_resources(api, Deployment, namespace, exclude_namespaces, exclude_deployments, default_uptime, default_downtime, forced_uptime, dry_run, now, grace_period) if 'statefulset' in kinds: autoscale_resources(api, StatefulSet, namespace, exclude_namespaces, exclude_statefulsets, default_uptime, default_downtime, forced_uptime, dry_run, now, grace_period) if 'stackset' in kinds: autoscale_resources(api, StackSet, namespace, exclude_namespaces, exclude_statefulsets, default_uptime, default_downtime, forced_uptime, dry_run, now, grace_period)
def scale( namespace: str, upscale_period: str, downscale_period: str, default_uptime: str, default_downtime: str, include_resources: FrozenSet[str], exclude_namespaces: FrozenSet[Pattern], exclude_deployments: FrozenSet[str], dry_run: bool, grace_period: int, downtime_replicas: int = 0, deployment_time_annotation: Optional[str] = None, enable_events: bool = False, upscale_step_size: int = 0, ): api = helper.get_kube_api() now = datetime.datetime.now(datetime.timezone.utc) forced_uptime = pods_force_uptime(api, namespace) for clazz in RESOURCE_CLASSES: plural = clazz.endpoint if plural in include_resources: autoscale_resources( api, clazz, namespace, exclude_namespaces, exclude_deployments, upscale_period, downscale_period, default_uptime, default_downtime, forced_uptime, dry_run, now, grace_period, downtime_replicas, deployment_time_annotation, enable_events, upscale_step_size, )
def scale(namespace: str, upscale_period: str, downscale_period: str, default_uptime: str, default_downtime: str, include_resources: FrozenSet[str], exclude_namespaces: FrozenSet[str], exclude_deployments: FrozenSet[str], exclude_statefulsets: FrozenSet[str], dry_run: bool, grace_period: int, downtime_replicas: int): api = helper.get_kube_api() now = datetime.datetime.now(datetime.timezone.utc) forced_uptime = pods_force_uptime(api, namespace) if 'deployments' in include_resources: autoscale_resources(api, Deployment, namespace, exclude_namespaces, exclude_deployments, upscale_period, downscale_period, default_uptime, default_downtime, forced_uptime, dry_run, now, grace_period, downtime_replicas) if 'statefulsets' in include_resources: autoscale_resources(api, StatefulSet, namespace, exclude_namespaces, exclude_statefulsets, upscale_period, downscale_period, default_uptime, default_downtime, forced_uptime, dry_run, now, grace_period, downtime_replicas) if 'stacks' in include_resources: autoscale_resources(api, Stack, namespace, exclude_namespaces, exclude_statefulsets, upscale_period, downscale_period, default_uptime, default_downtime, forced_uptime, dry_run, now, grace_period, downtime_replicas)