k8s-helper-cli 0.5.4__py3-none-any.whl → 0.5.5__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.
- k8s_helper/__init__.py +1 -1
- k8s_helper/core.py +129 -7
- {k8s_helper_cli-0.5.4.dist-info → k8s_helper_cli-0.5.5.dist-info}/METADATA +1 -1
- k8s_helper_cli-0.5.5.dist-info/RECORD +11 -0
- k8s_helper_cli-0.5.4.dist-info/RECORD +0 -11
- {k8s_helper_cli-0.5.4.dist-info → k8s_helper_cli-0.5.5.dist-info}/WHEEL +0 -0
- {k8s_helper_cli-0.5.4.dist-info → k8s_helper_cli-0.5.5.dist-info}/entry_points.txt +0 -0
- {k8s_helper_cli-0.5.4.dist-info → k8s_helper_cli-0.5.5.dist-info}/licenses/LICENSE +0 -0
- {k8s_helper_cli-0.5.4.dist-info → k8s_helper_cli-0.5.5.dist-info}/top_level.txt +0 -0
k8s_helper/__init__.py
CHANGED
k8s_helper/core.py
CHANGED
@@ -3490,6 +3490,16 @@ scrape_configs:
|
|
3490
3490
|
'enabled': True,
|
3491
3491
|
'prometheusSpec': {
|
3492
3492
|
'retention': '30d',
|
3493
|
+
'resources': {
|
3494
|
+
'requests': {
|
3495
|
+
'memory': '512Mi',
|
3496
|
+
'cpu': '200m'
|
3497
|
+
},
|
3498
|
+
'limits': {
|
3499
|
+
'memory': '2Gi',
|
3500
|
+
'cpu': '1000m'
|
3501
|
+
}
|
3502
|
+
},
|
3493
3503
|
'storageSpec': {
|
3494
3504
|
'volumeClaimTemplate': {
|
3495
3505
|
'spec': {
|
@@ -3506,13 +3516,57 @@ scrape_configs:
|
|
3506
3516
|
}
|
3507
3517
|
},
|
3508
3518
|
'alertmanager': {
|
3509
|
-
'enabled': True
|
3519
|
+
'enabled': True,
|
3520
|
+
'alertmanagerSpec': {
|
3521
|
+
'resources': {
|
3522
|
+
'requests': {
|
3523
|
+
'memory': '128Mi',
|
3524
|
+
'cpu': '100m'
|
3525
|
+
},
|
3526
|
+
'limits': {
|
3527
|
+
'memory': '512Mi',
|
3528
|
+
'cpu': '500m'
|
3529
|
+
}
|
3530
|
+
}
|
3531
|
+
}
|
3510
3532
|
},
|
3511
3533
|
'nodeExporter': {
|
3512
|
-
'enabled': True
|
3534
|
+
'enabled': True,
|
3535
|
+
'resources': {
|
3536
|
+
'requests': {
|
3537
|
+
'memory': '30Mi',
|
3538
|
+
'cpu': '100m'
|
3539
|
+
},
|
3540
|
+
'limits': {
|
3541
|
+
'memory': '100Mi',
|
3542
|
+
'cpu': '200m'
|
3543
|
+
}
|
3544
|
+
}
|
3513
3545
|
},
|
3514
3546
|
'kubeStateMetrics': {
|
3515
|
-
'enabled': True
|
3547
|
+
'enabled': True,
|
3548
|
+
'resources': {
|
3549
|
+
'requests': {
|
3550
|
+
'memory': '64Mi',
|
3551
|
+
'cpu': '50m'
|
3552
|
+
},
|
3553
|
+
'limits': {
|
3554
|
+
'memory': '256Mi',
|
3555
|
+
'cpu': '200m'
|
3556
|
+
}
|
3557
|
+
}
|
3558
|
+
},
|
3559
|
+
'prometheusOperator': {
|
3560
|
+
'resources': {
|
3561
|
+
'requests': {
|
3562
|
+
'memory': '128Mi',
|
3563
|
+
'cpu': '100m'
|
3564
|
+
},
|
3565
|
+
'limits': {
|
3566
|
+
'memory': '512Mi',
|
3567
|
+
'cpu': '500m'
|
3568
|
+
}
|
3569
|
+
}
|
3516
3570
|
},
|
3517
3571
|
'defaultRules': {
|
3518
3572
|
'create': True,
|
@@ -3555,14 +3609,19 @@ scrape_configs:
|
|
3555
3609
|
'helm', 'install', 'kube-prometheus-stack',
|
3556
3610
|
'prometheus-community/kube-prometheus-stack',
|
3557
3611
|
'--namespace', namespace,
|
3558
|
-
'--values', values_file
|
3612
|
+
'--values', values_file,
|
3613
|
+
'--create-namespace'
|
3559
3614
|
]
|
3560
3615
|
|
3561
3616
|
if wait_for_ready:
|
3562
3617
|
helm_cmd.append('--wait')
|
3563
|
-
helm_cmd.extend(['--timeout', '
|
3618
|
+
helm_cmd.extend(['--timeout', '20m']) # Increased timeout
|
3619
|
+
print("⏳ This may take up to 20 minutes for first-time installation...")
|
3620
|
+
else:
|
3621
|
+
# Even without wait, add a reasonable timeout
|
3622
|
+
helm_cmd.extend(['--timeout', '5m'])
|
3564
3623
|
|
3565
|
-
result = subprocess.run(helm_cmd, capture_output=True, text=True, check=True)
|
3624
|
+
result = subprocess.run(helm_cmd, capture_output=True, text=True, check=True, timeout=1200) # 20 min subprocess timeout
|
3566
3625
|
print("✅ Helm chart installed successfully")
|
3567
3626
|
|
3568
3627
|
# Wait a bit for pods to start
|
@@ -3593,9 +3652,72 @@ scrape_configs:
|
|
3593
3652
|
|
3594
3653
|
except subprocess.CalledProcessError as e:
|
3595
3654
|
error_msg = e.stderr if e.stderr else str(e)
|
3655
|
+
|
3656
|
+
# Check if it's a timeout error and offer fallback
|
3657
|
+
if 'context deadline exceeded' in error_msg or 'timeout' in error_msg.lower():
|
3658
|
+
print("⚠️ Installation timed out, but this doesn't necessarily mean failure.")
|
3659
|
+
print("🔍 Checking if components were actually deployed...")
|
3660
|
+
|
3661
|
+
# Check if the release was created even if it timed out
|
3662
|
+
try:
|
3663
|
+
check_result = subprocess.run([
|
3664
|
+
'helm', 'status', 'kube-prometheus-stack', '--namespace', namespace
|
3665
|
+
], capture_output=True, text=True, timeout=30)
|
3666
|
+
|
3667
|
+
if check_result.returncode == 0:
|
3668
|
+
print("✅ Helm release was created successfully despite timeout!")
|
3669
|
+
print("⏳ Components may still be starting up. Use 'k8s-helper monitoring-stack-status' to check progress.")
|
3670
|
+
|
3671
|
+
return {
|
3672
|
+
'success': True,
|
3673
|
+
'namespace': namespace,
|
3674
|
+
'release_name': 'kube-prometheus-stack',
|
3675
|
+
'prometheus': {'deployed': True},
|
3676
|
+
'grafana': {
|
3677
|
+
'deployed': True,
|
3678
|
+
'admin_password': 'admin'
|
3679
|
+
},
|
3680
|
+
'warning': 'Installation completed but timed out waiting for all pods to be ready. Components may still be starting.',
|
3681
|
+
'suggestion': 'Use "k8s-helper monitoring-stack-status" to check current status.'
|
3682
|
+
}
|
3683
|
+
except:
|
3684
|
+
pass
|
3685
|
+
|
3686
|
+
return {
|
3687
|
+
'success': False,
|
3688
|
+
'error': f'Helm installation failed: {error_msg}',
|
3689
|
+
'suggestion': 'Try running without --wait flag, or increase cluster resources.'
|
3690
|
+
}
|
3691
|
+
except subprocess.TimeoutExpired:
|
3692
|
+
print("⚠️ Installation timed out after 20 minutes.")
|
3693
|
+
print("🔍 Checking if components were deployed...")
|
3694
|
+
|
3695
|
+
# Check if anything was installed
|
3696
|
+
try:
|
3697
|
+
check_result = subprocess.run([
|
3698
|
+
'helm', 'list', '--namespace', namespace
|
3699
|
+
], capture_output=True, text=True, timeout=30)
|
3700
|
+
|
3701
|
+
if 'kube-prometheus-stack' in check_result.stdout:
|
3702
|
+
return {
|
3703
|
+
'success': True,
|
3704
|
+
'namespace': namespace,
|
3705
|
+
'release_name': 'kube-prometheus-stack',
|
3706
|
+
'prometheus': {'deployed': True},
|
3707
|
+
'grafana': {
|
3708
|
+
'deployed': True,
|
3709
|
+
'admin_password': 'admin'
|
3710
|
+
},
|
3711
|
+
'warning': 'Installation timed out but components may be deployed. Check status manually.',
|
3712
|
+
'suggestion': 'Use "k8s-helper monitoring-stack-status" to verify deployment status.'
|
3713
|
+
}
|
3714
|
+
except:
|
3715
|
+
pass
|
3716
|
+
|
3596
3717
|
return {
|
3597
3718
|
'success': False,
|
3598
|
-
'error':
|
3719
|
+
'error': 'Installation timed out after 20 minutes',
|
3720
|
+
'suggestion': 'Try running "k8s-helper setup-monitoring-stack" without --wait flag, or increase cluster resources.'
|
3599
3721
|
}
|
3600
3722
|
except Exception as e:
|
3601
3723
|
return {
|
@@ -0,0 +1,11 @@
|
|
1
|
+
k8s_helper/__init__.py,sha256=m2qQQFAXIhvJzVvMCKQo-oh6LfaB2OEL8xXBMPsVn9o,2666
|
2
|
+
k8s_helper/cli.py,sha256=3eP3J7srPIM0bm_G5RxdU_RvtDwJHLX2xBguF2EmXtk,95115
|
3
|
+
k8s_helper/config.py,sha256=P7YdfyvCHprrNs2J9DRb3RrClylfTTh5hfTtDzLug0A,6867
|
4
|
+
k8s_helper/core.py,sha256=l3QDHZBHN8IKdua8Ke65Djjw4MitdjSKypqsF5tJ4vA,167222
|
5
|
+
k8s_helper/utils.py,sha256=wYgTd5ktyuI-EiVcfW7FrxA7MzXY5odrEKQgmMVdueY,9496
|
6
|
+
k8s_helper_cli-0.5.5.dist-info/licenses/LICENSE,sha256=tXPvVl3gLVc6e0qCEoLH9KjeA7z4JVL78UybpvGtBCw,1096
|
7
|
+
k8s_helper_cli-0.5.5.dist-info/METADATA,sha256=6n1cmKDTgT6rbeglC-iPbEGLcDSZx4RUqiqqxBU3N9c,30789
|
8
|
+
k8s_helper_cli-0.5.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
9
|
+
k8s_helper_cli-0.5.5.dist-info/entry_points.txt,sha256=IoCMWUZ6mn90LwzQzEy5YkWOwvogDdZ6ycqUWAzCFTQ,50
|
10
|
+
k8s_helper_cli-0.5.5.dist-info/top_level.txt,sha256=x9A1jflyer-z2cFnkqk5B42juoH2q0fy5hkT9upsTG8,11
|
11
|
+
k8s_helper_cli-0.5.5.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
k8s_helper/__init__.py,sha256=gUWB4xYXMEreqzLysQl_uJNpM69McyFg5pWnoiPSus8,2666
|
2
|
-
k8s_helper/cli.py,sha256=3eP3J7srPIM0bm_G5RxdU_RvtDwJHLX2xBguF2EmXtk,95115
|
3
|
-
k8s_helper/config.py,sha256=P7YdfyvCHprrNs2J9DRb3RrClylfTTh5hfTtDzLug0A,6867
|
4
|
-
k8s_helper/core.py,sha256=Jljg5GopWsIeObkEQQOU7jnojMJVBuciDR-VFejliUE,161376
|
5
|
-
k8s_helper/utils.py,sha256=wYgTd5ktyuI-EiVcfW7FrxA7MzXY5odrEKQgmMVdueY,9496
|
6
|
-
k8s_helper_cli-0.5.4.dist-info/licenses/LICENSE,sha256=tXPvVl3gLVc6e0qCEoLH9KjeA7z4JVL78UybpvGtBCw,1096
|
7
|
-
k8s_helper_cli-0.5.4.dist-info/METADATA,sha256=q5XC7y15-XCng9ZaedB0voXNzI2JYAX4yx_8d8p5D5g,30789
|
8
|
-
k8s_helper_cli-0.5.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
9
|
-
k8s_helper_cli-0.5.4.dist-info/entry_points.txt,sha256=IoCMWUZ6mn90LwzQzEy5YkWOwvogDdZ6ycqUWAzCFTQ,50
|
10
|
-
k8s_helper_cli-0.5.4.dist-info/top_level.txt,sha256=x9A1jflyer-z2cFnkqk5B42juoH2q0fy5hkT9upsTG8,11
|
11
|
-
k8s_helper_cli-0.5.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|