paasta-tools 1.27.0__py3-none-any.whl → 1.35.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of paasta-tools might be problematic. Click here for more details.
- paasta_tools/__init__.py +1 -1
- paasta_tools/api/api_docs/swagger.json +9 -1
- paasta_tools/api/tweens/auth.py +2 -1
- paasta_tools/api/views/instance.py +9 -2
- paasta_tools/api/views/remote_run.py +2 -0
- paasta_tools/async_utils.py +4 -1
- paasta_tools/bounce_lib.py +8 -5
- paasta_tools/check_services_replication_tools.py +10 -4
- paasta_tools/check_spark_jobs.py +1 -1
- paasta_tools/cli/cli.py +4 -4
- paasta_tools/cli/cmds/autoscale.py +2 -0
- paasta_tools/cli/cmds/check.py +2 -0
- paasta_tools/cli/cmds/cook_image.py +2 -0
- paasta_tools/cli/cmds/get_docker_image.py +2 -0
- paasta_tools/cli/cmds/get_image_version.py +2 -0
- paasta_tools/cli/cmds/get_latest_deployment.py +2 -0
- paasta_tools/cli/cmds/info.py +10 -3
- paasta_tools/cli/cmds/itest.py +2 -0
- paasta_tools/cli/cmds/list_namespaces.py +2 -0
- paasta_tools/cli/cmds/local_run.py +122 -27
- paasta_tools/cli/cmds/logs.py +31 -7
- paasta_tools/cli/cmds/mark_for_deployment.py +14 -4
- paasta_tools/cli/cmds/mesh_status.py +3 -2
- paasta_tools/cli/cmds/push_to_registry.py +2 -0
- paasta_tools/cli/cmds/remote_run.py +156 -12
- paasta_tools/cli/cmds/rollback.py +6 -2
- paasta_tools/cli/cmds/secret.py +4 -2
- paasta_tools/cli/cmds/security_check.py +2 -0
- paasta_tools/cli/cmds/spark_run.py +7 -3
- paasta_tools/cli/cmds/status.py +59 -29
- paasta_tools/cli/cmds/validate.py +325 -40
- paasta_tools/cli/cmds/wait_for_deployment.py +2 -0
- paasta_tools/cli/schemas/adhoc_schema.json +3 -0
- paasta_tools/cli/schemas/autoscaling_schema.json +3 -2
- paasta_tools/cli/schemas/eks_schema.json +24 -1
- paasta_tools/cli/schemas/kubernetes_schema.json +1 -0
- paasta_tools/cli/schemas/smartstack_schema.json +14 -0
- paasta_tools/cli/utils.py +34 -20
- paasta_tools/contrib/bounce_log_latency_parser.py +1 -1
- paasta_tools/contrib/check_orphans.py +1 -1
- paasta_tools/contrib/get_running_task_allocation.py +1 -1
- paasta_tools/contrib/ide_helper.py +14 -14
- paasta_tools/contrib/mock_patch_checker.py +1 -1
- paasta_tools/contrib/paasta_update_soa_memcpu.py +10 -14
- paasta_tools/contrib/render_template.py +1 -1
- paasta_tools/contrib/shared_ip_check.py +1 -1
- paasta_tools/generate_deployments_for_service.py +2 -0
- paasta_tools/instance/hpa_metrics_parser.py +3 -5
- paasta_tools/instance/kubernetes.py +70 -36
- paasta_tools/kubernetes/application/controller_wrappers.py +23 -2
- paasta_tools/kubernetes/remote_run.py +52 -25
- paasta_tools/kubernetes_tools.py +60 -69
- paasta_tools/long_running_service_tools.py +15 -5
- paasta_tools/mesos/master.py +1 -1
- paasta_tools/metrics/metastatus_lib.py +1 -25
- paasta_tools/metrics/metrics_lib.py +12 -3
- paasta_tools/paastaapi/__init__.py +1 -1
- paasta_tools/paastaapi/api/autoscaler_api.py +1 -1
- paasta_tools/paastaapi/api/default_api.py +1 -1
- paasta_tools/paastaapi/api/remote_run_api.py +1 -1
- paasta_tools/paastaapi/api/resources_api.py +1 -1
- paasta_tools/paastaapi/api/service_api.py +1 -1
- paasta_tools/paastaapi/api_client.py +1 -1
- paasta_tools/paastaapi/configuration.py +2 -2
- paasta_tools/paastaapi/exceptions.py +1 -1
- paasta_tools/paastaapi/model/adhoc_launch_history.py +1 -1
- paasta_tools/paastaapi/model/autoscaler_count_msg.py +1 -1
- paasta_tools/paastaapi/model/autoscaling_override.py +1 -1
- paasta_tools/paastaapi/model/deploy_queue.py +1 -1
- paasta_tools/paastaapi/model/deploy_queue_service_instance.py +1 -1
- paasta_tools/paastaapi/model/envoy_backend.py +1 -1
- paasta_tools/paastaapi/model/envoy_location.py +1 -1
- paasta_tools/paastaapi/model/envoy_status.py +1 -1
- paasta_tools/paastaapi/model/flink_cluster_overview.py +1 -1
- paasta_tools/paastaapi/model/flink_config.py +1 -1
- paasta_tools/paastaapi/model/flink_job.py +1 -1
- paasta_tools/paastaapi/model/flink_job_details.py +1 -1
- paasta_tools/paastaapi/model/flink_jobs.py +1 -1
- paasta_tools/paastaapi/model/float_and_error.py +1 -1
- paasta_tools/paastaapi/model/hpa_metric.py +1 -1
- paasta_tools/paastaapi/model/inline_object.py +1 -1
- paasta_tools/paastaapi/model/inline_response200.py +1 -1
- paasta_tools/paastaapi/model/inline_response2001.py +1 -1
- paasta_tools/paastaapi/model/inline_response202.py +1 -1
- paasta_tools/paastaapi/model/inline_response403.py +1 -1
- paasta_tools/paastaapi/model/instance_bounce_status.py +1 -1
- paasta_tools/paastaapi/model/instance_mesh_status.py +1 -1
- paasta_tools/paastaapi/model/instance_status.py +1 -1
- paasta_tools/paastaapi/model/instance_status_adhoc.py +1 -1
- paasta_tools/paastaapi/model/instance_status_cassandracluster.py +1 -1
- paasta_tools/paastaapi/model/instance_status_flink.py +1 -1
- paasta_tools/paastaapi/model/instance_status_kafkacluster.py +1 -1
- paasta_tools/paastaapi/model/instance_status_kubernetes.py +1 -1
- paasta_tools/paastaapi/model/instance_status_kubernetes_autoscaling_status.py +1 -1
- paasta_tools/paastaapi/model/instance_status_kubernetes_v2.py +1 -1
- paasta_tools/paastaapi/model/instance_status_tron.py +1 -1
- paasta_tools/paastaapi/model/instance_tasks.py +1 -1
- paasta_tools/paastaapi/model/integer_and_error.py +1 -1
- paasta_tools/paastaapi/model/kubernetes_container.py +1 -1
- paasta_tools/paastaapi/model/kubernetes_container_v2.py +1 -1
- paasta_tools/paastaapi/model/kubernetes_healthcheck.py +1 -1
- paasta_tools/paastaapi/model/kubernetes_pod.py +1 -1
- paasta_tools/paastaapi/model/kubernetes_pod_event.py +1 -1
- paasta_tools/paastaapi/model/kubernetes_pod_v2.py +1 -1
- paasta_tools/paastaapi/model/kubernetes_replica_set.py +1 -1
- paasta_tools/paastaapi/model/kubernetes_version.py +4 -1
- paasta_tools/paastaapi/model/remote_run_outcome.py +1 -1
- paasta_tools/paastaapi/model/remote_run_start.py +4 -1
- paasta_tools/paastaapi/model/remote_run_stop.py +1 -1
- paasta_tools/paastaapi/model/remote_run_token.py +1 -1
- paasta_tools/paastaapi/model/resource.py +1 -1
- paasta_tools/paastaapi/model/resource_item.py +1 -1
- paasta_tools/paastaapi/model/resource_value.py +1 -1
- paasta_tools/paastaapi/model/smartstack_backend.py +1 -1
- paasta_tools/paastaapi/model/smartstack_location.py +1 -1
- paasta_tools/paastaapi/model/smartstack_status.py +1 -1
- paasta_tools/paastaapi/model/task_tail_lines.py +1 -1
- paasta_tools/paastaapi/model_utils.py +1 -1
- paasta_tools/paastaapi/rest.py +1 -1
- paasta_tools/remote_git.py +2 -2
- paasta_tools/run-paasta-api-in-dev-mode.py +2 -2
- paasta_tools/run-paasta-api-playground.py +2 -2
- paasta_tools/setup_kubernetes_job.py +43 -1
- paasta_tools/setup_prometheus_adapter_config.py +82 -0
- paasta_tools/setup_tron_namespace.py +2 -2
- paasta_tools/tron_tools.py +4 -1
- paasta_tools/utils.py +29 -11
- paasta_tools/yaml_tools.py +1 -1
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/check_orphans.py +1 -1
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/check_spark_jobs.py +1 -1
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/generate_deployments_for_service.py +2 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/get_running_task_allocation.py +1 -1
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/ide_helper.py +14 -14
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/paasta_update_soa_memcpu.py +10 -14
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/setup_kubernetes_job.py +43 -1
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/setup_prometheus_adapter_config.py +82 -0
- paasta_tools-1.35.8.dist-info/METADATA +79 -0
- {paasta_tools-1.27.0.dist-info → paasta_tools-1.35.8.dist-info}/RECORD +186 -191
- {paasta_tools-1.27.0.dist-info → paasta_tools-1.35.8.dist-info}/WHEEL +1 -1
- paasta_tools/frameworks/adhoc_scheduler.py +0 -71
- paasta_tools/frameworks/native_scheduler.py +0 -652
- paasta_tools/frameworks/task_store.py +0 -245
- paasta_tools/mesos_maintenance.py +0 -848
- paasta_tools/paasta_native_serviceinit.py +0 -21
- paasta_tools-1.27.0.dist-info/METADATA +0 -75
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/apply_external_resources.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/bounce_log_latency_parser.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/check_autoscaler_max_instances.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/check_cassandracluster_services_replication.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/check_flink_services_health.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/check_kubernetes_api.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/check_kubernetes_services_replication.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/check_manual_oapi_changes.sh +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/check_oom_events.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/cleanup_kubernetes_cr.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/cleanup_kubernetes_crd.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/cleanup_kubernetes_jobs.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/create_dynamodb_table.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/create_paasta_playground.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/delete_kubernetes_deployments.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/emit_allocated_cpu_metrics.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/generate_all_deployments +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/generate_authenticating_services.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/generate_services_file.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/generate_services_yaml.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/habitat_fixer.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/is_pod_healthy_in_proxy.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/is_pod_healthy_in_smartstack.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/kill_bad_containers.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/kubernetes_remove_evicted_pods.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/mass-deploy-tag.sh +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/mock_patch_checker.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/paasta_cleanup_remote_run_resources.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/paasta_cleanup_stale_nodes.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/paasta_deploy_tron_jobs +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/paasta_execute_docker_command.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/paasta_secrets_sync.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/paasta_tabcomplete.sh +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/render_template.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/rightsizer_soaconfigs_update.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/service_shard_remove.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/service_shard_update.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/setup_istio_mesh.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/setup_kubernetes_cr.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/setup_kubernetes_crd.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/setup_kubernetes_internal_crd.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/shared_ip_check.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/synapse_srv_namespaces_fact.py +0 -0
- {paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/timeouts_metrics_prom.py +0 -0
- {paasta_tools-1.27.0.dist-info → paasta_tools-1.35.8.dist-info}/entry_points.txt +0 -0
- {paasta_tools-1.27.0.dist-info → paasta_tools-1.35.8.dist-info/licenses}/LICENSE +0 -0
- {paasta_tools-1.27.0.dist-info → paasta_tools-1.35.8.dist-info}/top_level.txt +0 -0
|
@@ -52,6 +52,7 @@ from paasta_tools.kubernetes_tools import load_kubernetes_service_config_no_cach
|
|
|
52
52
|
from paasta_tools.metrics import metrics_lib
|
|
53
53
|
from paasta_tools.utils import decompose_job_id
|
|
54
54
|
from paasta_tools.utils import DEFAULT_SOA_DIR
|
|
55
|
+
from paasta_tools.utils import DeploymentVersion
|
|
55
56
|
from paasta_tools.utils import InvalidJobNameError
|
|
56
57
|
from paasta_tools.utils import load_system_paasta_config
|
|
57
58
|
from paasta_tools.utils import NoConfigurationForServiceError
|
|
@@ -241,7 +242,7 @@ def get_kubernetes_deployment_config(
|
|
|
241
242
|
service_instance_configs_list.append((True, None))
|
|
242
243
|
except NoConfigurationForServiceError:
|
|
243
244
|
error_msg = (
|
|
244
|
-
|
|
245
|
+
"Could not read kubernetes configuration file for %s.%s in cluster %s"
|
|
245
246
|
% (service_instance[0], service_instance[1], cluster)
|
|
246
247
|
)
|
|
247
248
|
log.error(error_msg)
|
|
@@ -363,6 +364,14 @@ def setup_kube_deployments(
|
|
|
363
364
|
for deployment in existing_kube_deployments
|
|
364
365
|
}
|
|
365
366
|
|
|
367
|
+
existing_deployment_versions: Dict[
|
|
368
|
+
Tuple[str, str, str], List[DeploymentVersion]
|
|
369
|
+
] = {}
|
|
370
|
+
for deployment in existing_kube_deployments:
|
|
371
|
+
existing_deployment_versions.setdefault(
|
|
372
|
+
(deployment.service, deployment.instance, deployment.namespace), []
|
|
373
|
+
).append(deployment.deployment_version)
|
|
374
|
+
|
|
366
375
|
hpa_overrides = hpa_overrides or {}
|
|
367
376
|
|
|
368
377
|
applications = [
|
|
@@ -379,6 +388,39 @@ def setup_kube_deployments(
|
|
|
379
388
|
else (_, None)
|
|
380
389
|
for _, service_instance in service_instance_configs_list
|
|
381
390
|
]
|
|
391
|
+
|
|
392
|
+
def sort_key(ok_app: Tuple[bool, Optional[Application]]) -> int:
|
|
393
|
+
"""This will return 1 if the desired deployment_version matches an existing deployment_version, 2 if the deployment is unhealthy and 0
|
|
394
|
+
otherwise. This will cause applications that need a new deployment_version to be handled first.
|
|
395
|
+
This prioritizes "real" bounces (developers pushing new service versions) over things that are likely to be big
|
|
396
|
+
bounces (config-only changes).
|
|
397
|
+
Most of the time, this won't matter much, as we should get through our backlog quickly, but when there is a
|
|
398
|
+
backlog, we want to avoid blocking developers.
|
|
399
|
+
"""
|
|
400
|
+
_, app = ok_app
|
|
401
|
+
if app:
|
|
402
|
+
if (
|
|
403
|
+
app.kube_deployment.deployment_version
|
|
404
|
+
in existing_deployment_versions.get(
|
|
405
|
+
(
|
|
406
|
+
app.kube_deployment.service,
|
|
407
|
+
app.kube_deployment.instance,
|
|
408
|
+
app.kube_deployment.namespace,
|
|
409
|
+
),
|
|
410
|
+
[],
|
|
411
|
+
)
|
|
412
|
+
):
|
|
413
|
+
# Desired version exists, so this is just a configuration update; handle this second.
|
|
414
|
+
return 1
|
|
415
|
+
else:
|
|
416
|
+
# Desired version doesn't exist, handle this first.
|
|
417
|
+
return 0
|
|
418
|
+
else:
|
|
419
|
+
# Handle broken app last.
|
|
420
|
+
return 2
|
|
421
|
+
|
|
422
|
+
applications.sort(key=sort_key)
|
|
423
|
+
|
|
382
424
|
api_updates = 0
|
|
383
425
|
for _, app in applications:
|
|
384
426
|
if app:
|
{paasta_tools-1.27.0.data → paasta_tools-1.35.8.data}/scripts/setup_prometheus_adapter_config.py
RENAMED
|
@@ -53,6 +53,9 @@ from paasta_tools.long_running_service_tools import (
|
|
|
53
53
|
from paasta_tools.long_running_service_tools import (
|
|
54
54
|
DEFAULT_UWSGI_AUTOSCALING_MOVING_AVERAGE_WINDOW,
|
|
55
55
|
)
|
|
56
|
+
from paasta_tools.long_running_service_tools import (
|
|
57
|
+
DEFAULT_WORKER_LOAD_AUTOSCALING_MOVING_AVERAGE_WINDOW,
|
|
58
|
+
)
|
|
56
59
|
from paasta_tools.long_running_service_tools import METRICS_PROVIDER_ACTIVE_REQUESTS
|
|
57
60
|
from paasta_tools.long_running_service_tools import METRICS_PROVIDER_CPU
|
|
58
61
|
from paasta_tools.long_running_service_tools import METRICS_PROVIDER_GUNICORN
|
|
@@ -60,6 +63,7 @@ from paasta_tools.long_running_service_tools import METRICS_PROVIDER_PISCINA
|
|
|
60
63
|
from paasta_tools.long_running_service_tools import METRICS_PROVIDER_PROMQL
|
|
61
64
|
from paasta_tools.long_running_service_tools import METRICS_PROVIDER_UWSGI
|
|
62
65
|
from paasta_tools.long_running_service_tools import METRICS_PROVIDER_UWSGI_V2
|
|
66
|
+
from paasta_tools.long_running_service_tools import METRICS_PROVIDER_WORKER_LOAD
|
|
63
67
|
from paasta_tools.paasta_service_config_loader import PaastaServiceConfigLoader
|
|
64
68
|
from paasta_tools.utils import DEFAULT_SOA_DIR
|
|
65
69
|
from paasta_tools.utils import get_services_for_cluster
|
|
@@ -214,6 +218,10 @@ def create_instance_scaling_rule(
|
|
|
214
218
|
return create_instance_uwsgi_v2_scaling_rule(
|
|
215
219
|
service, instance_config, metrics_provider_config, paasta_cluster
|
|
216
220
|
)
|
|
221
|
+
if metrics_provider_config["type"] == METRICS_PROVIDER_WORKER_LOAD:
|
|
222
|
+
return create_instance_worker_load_scaling_rule(
|
|
223
|
+
service, instance_config, metrics_provider_config, paasta_cluster
|
|
224
|
+
)
|
|
217
225
|
if metrics_provider_config["type"] == METRICS_PROVIDER_PISCINA:
|
|
218
226
|
return create_instance_piscina_scaling_rule(
|
|
219
227
|
service, instance_config, metrics_provider_config, paasta_cluster
|
|
@@ -523,6 +531,80 @@ def create_instance_uwsgi_v2_scaling_rule(
|
|
|
523
531
|
}
|
|
524
532
|
|
|
525
533
|
|
|
534
|
+
def create_instance_worker_load_scaling_rule(
|
|
535
|
+
service: str,
|
|
536
|
+
instance_config: KubernetesDeploymentConfig,
|
|
537
|
+
metrics_provider_config: MetricsProviderDict,
|
|
538
|
+
paasta_cluster: str,
|
|
539
|
+
) -> PrometheusAdapterRule:
|
|
540
|
+
"""
|
|
541
|
+
Creates a Prometheus adapter rule config for a given service instance using generic worker_busy metric.
|
|
542
|
+
"""
|
|
543
|
+
instance = instance_config.instance
|
|
544
|
+
moving_average_window = metrics_provider_config.get(
|
|
545
|
+
"moving_average_window_seconds",
|
|
546
|
+
DEFAULT_WORKER_LOAD_AUTOSCALING_MOVING_AVERAGE_WINDOW,
|
|
547
|
+
)
|
|
548
|
+
deployment_name = get_kubernetes_app_name(service=service, instance=instance)
|
|
549
|
+
|
|
550
|
+
# In order for autoscaling to work safely while a service migrates from one namespace to another, the HPA needs to
|
|
551
|
+
# make sure that the deployment in the new namespace is scaled up enough to handle _all_ the load.
|
|
552
|
+
# This is because once the new deployment is 100% healthy, cleanup_kubernetes_job will delete the deployment out of
|
|
553
|
+
# the old namespace all at once, suddenly putting all the load onto the deployment in the new namespace.
|
|
554
|
+
# To ensure this, we must NOT filter on namespace in worker_filter_terms (which is used when calculating total_load.
|
|
555
|
+
# This makes sure that desired_instances includes load from all namespaces.
|
|
556
|
+
worker_filter_terms = f"paasta_cluster='{paasta_cluster}',paasta_service='{service}',paasta_instance='{instance}'"
|
|
557
|
+
|
|
558
|
+
# k8s:deployment:pods_status_ready is a metric created by summing kube_pod_status_ready
|
|
559
|
+
# over paasta service/instance/cluster. it counts the number of ready pods in a paasta
|
|
560
|
+
# deployment.
|
|
561
|
+
ready_pods = f"""
|
|
562
|
+
(sum(
|
|
563
|
+
k8s:deployment:pods_status_ready{{{worker_filter_terms}}} >= 0
|
|
564
|
+
or
|
|
565
|
+
max_over_time(
|
|
566
|
+
k8s:deployment:pods_status_ready{{{worker_filter_terms}}}[{DEFAULT_EXTRAPOLATION_TIME}s]
|
|
567
|
+
)
|
|
568
|
+
) by (kube_deployment))
|
|
569
|
+
"""
|
|
570
|
+
load_per_instance = f"""
|
|
571
|
+
avg(
|
|
572
|
+
worker_busy{{{worker_filter_terms}}}
|
|
573
|
+
) by (kube_pod, kube_deployment)
|
|
574
|
+
"""
|
|
575
|
+
missing_instances = f"""
|
|
576
|
+
clamp_min(
|
|
577
|
+
{ready_pods} - count({load_per_instance}) by (kube_deployment),
|
|
578
|
+
0
|
|
579
|
+
)
|
|
580
|
+
"""
|
|
581
|
+
total_load = f"""
|
|
582
|
+
(
|
|
583
|
+
sum(
|
|
584
|
+
{load_per_instance}
|
|
585
|
+
) by (kube_deployment)
|
|
586
|
+
+
|
|
587
|
+
{missing_instances}
|
|
588
|
+
)
|
|
589
|
+
"""
|
|
590
|
+
total_load_smoothed = f"""
|
|
591
|
+
avg_over_time(
|
|
592
|
+
(
|
|
593
|
+
{total_load}
|
|
594
|
+
)[{moving_average_window}s:]
|
|
595
|
+
)
|
|
596
|
+
"""
|
|
597
|
+
|
|
598
|
+
metric_name = f"{deployment_name}-worker-load-prom"
|
|
599
|
+
|
|
600
|
+
return {
|
|
601
|
+
"name": {"as": metric_name},
|
|
602
|
+
"seriesQuery": f"worker_busy{{{worker_filter_terms}}}",
|
|
603
|
+
"resources": {"template": "kube_<<.Resource>>"},
|
|
604
|
+
"metricsQuery": _minify_promql(total_load_smoothed),
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
|
|
526
608
|
def create_instance_piscina_scaling_rule(
|
|
527
609
|
service: str,
|
|
528
610
|
instance_config: KubernetesDeploymentConfig,
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: paasta-tools
|
|
3
|
+
Version: 1.35.8
|
|
4
|
+
Summary: Tools for Yelps SOA infrastructure
|
|
5
|
+
Author: Compute Infrastructure @ Yelp
|
|
6
|
+
Author-email: compute-infra@yelp.com
|
|
7
|
+
Provides: paasta_tools
|
|
8
|
+
Requires-Python: >=3.9.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: a-sync>=0.5.0
|
|
11
|
+
Requires-Dist: aiohttp>=3.5.4
|
|
12
|
+
Requires-Dist: argcomplete>=0.8.1
|
|
13
|
+
Requires-Dist: boto
|
|
14
|
+
Requires-Dist: boto3
|
|
15
|
+
Requires-Dist: boto3-type-annotations
|
|
16
|
+
Requires-Dist: botocore
|
|
17
|
+
Requires-Dist: bravado>=10.2.0
|
|
18
|
+
Requires-Dist: certifi
|
|
19
|
+
Requires-Dist: choice>=0.1
|
|
20
|
+
Requires-Dist: containerd
|
|
21
|
+
Requires-Dist: cookiecutter>=1.4.0
|
|
22
|
+
Requires-Dist: croniter
|
|
23
|
+
Requires-Dist: docker
|
|
24
|
+
Requires-Dist: dulwich>=0.17.3
|
|
25
|
+
Requires-Dist: environment-tools
|
|
26
|
+
Requires-Dist: ephemeral-port-reserve>=1.0.1
|
|
27
|
+
Requires-Dist: graphviz
|
|
28
|
+
Requires-Dist: grpcio
|
|
29
|
+
Requires-Dist: gunicorn
|
|
30
|
+
Requires-Dist: humanfriendly
|
|
31
|
+
Requires-Dist: humanize>=0.5.1
|
|
32
|
+
Requires-Dist: inotify>=0.2.8
|
|
33
|
+
Requires-Dist: ipaddress>=1.0.22
|
|
34
|
+
Requires-Dist: isodate>=0.7.2
|
|
35
|
+
Requires-Dist: jsonschema[format]
|
|
36
|
+
Requires-Dist: kazoo>=2.0.0
|
|
37
|
+
Requires-Dist: kubernetes<35.0.0,>=29.0.0
|
|
38
|
+
Requires-Dist: ldap3
|
|
39
|
+
Requires-Dist: manhole
|
|
40
|
+
Requires-Dist: mypy-extensions>=0.3.0
|
|
41
|
+
Requires-Dist: nats-py
|
|
42
|
+
Requires-Dist: nulltype
|
|
43
|
+
Requires-Dist: objgraph
|
|
44
|
+
Requires-Dist: ply
|
|
45
|
+
Requires-Dist: progressbar2>=4.3.2
|
|
46
|
+
Requires-Dist: prometheus-client
|
|
47
|
+
Requires-Dist: pymesos>=0.2.0
|
|
48
|
+
Requires-Dist: pyramid-swagger>=2.3.0
|
|
49
|
+
Requires-Dist: pyramid>=2.0.2
|
|
50
|
+
Requires-Dist: pysensu-yelp>=0.3.4
|
|
51
|
+
Requires-Dist: PyStaticConfiguration
|
|
52
|
+
Requires-Dist: python-crontab>=2.1.1
|
|
53
|
+
Requires-Dist: python-dateutil>=2.4.0
|
|
54
|
+
Requires-Dist: python-iptables
|
|
55
|
+
Requires-Dist: pytimeparse>=1.1.0
|
|
56
|
+
Requires-Dist: pytz>=2014.10
|
|
57
|
+
Requires-Dist: requests>=2.18.4
|
|
58
|
+
Requires-Dist: requests-cache>=0.4.10
|
|
59
|
+
Requires-Dist: retry
|
|
60
|
+
Requires-Dist: ruamel.yaml
|
|
61
|
+
Requires-Dist: sensu-plugin
|
|
62
|
+
Requires-Dist: service-configuration-lib>=3.3.7
|
|
63
|
+
Requires-Dist: signalfx
|
|
64
|
+
Requires-Dist: slackclient>=1.2.1
|
|
65
|
+
Requires-Dist: sticht>=1.1.0
|
|
66
|
+
Requires-Dist: syslogmp
|
|
67
|
+
Requires-Dist: transitions
|
|
68
|
+
Requires-Dist: typing-extensions
|
|
69
|
+
Requires-Dist: tzlocal
|
|
70
|
+
Requires-Dist: urllib3
|
|
71
|
+
Requires-Dist: utaw>=0.2.0
|
|
72
|
+
Requires-Dist: wsgicors
|
|
73
|
+
Dynamic: author
|
|
74
|
+
Dynamic: author-email
|
|
75
|
+
Dynamic: license-file
|
|
76
|
+
Dynamic: provides
|
|
77
|
+
Dynamic: requires-dist
|
|
78
|
+
Dynamic: requires-python
|
|
79
|
+
Dynamic: summary
|