k8s-helper-cli 0.4.0__py3-none-any.whl → 0.4.2__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 CHANGED
@@ -20,7 +20,7 @@ from .utils import (
20
20
  create_service_manifest
21
21
  )
22
22
 
23
- __version__ = "0.4.0"
23
+ __version__ = "0.4.2"
24
24
  __author__ = "Harshit Chatterjee"
25
25
  __email__ = "harshitchatterjee50@gmail.com"
26
26
 
k8s_helper/core.py CHANGED
@@ -1937,14 +1937,26 @@ scrape_configs:
1937
1937
  api_groups=["extensions"],
1938
1938
  resources=["ingresses"],
1939
1939
  verbs=["get", "list", "watch"]
1940
- ),
1941
- client.V1PolicyRule(
1942
- non_resource_urls=["/metrics"],
1943
- verbs=["get"]
1944
1940
  )
1945
1941
  ]
1946
1942
  )
1947
1943
 
1944
+ # Add non-resource URL rule with version compatibility
1945
+ try:
1946
+ # Try the newer parameter name first
1947
+ non_resource_rule = client.V1PolicyRule(
1948
+ non_resource_ur_ls=["/metrics"],
1949
+ verbs=["get"]
1950
+ )
1951
+ except TypeError:
1952
+ # Fall back to older parameter name
1953
+ non_resource_rule = client.V1PolicyRule(
1954
+ non_resource_urls=["/metrics"],
1955
+ verbs=["get"]
1956
+ )
1957
+
1958
+ cluster_role.rules.append(non_resource_rule)
1959
+
1948
1960
  try:
1949
1961
  rbac_v1.create_cluster_role(body=cluster_role)
1950
1962
  except ApiException as e:
@@ -1952,15 +1964,33 @@ scrape_configs:
1952
1964
  raise e
1953
1965
 
1954
1966
  # ClusterRoleBinding
1955
- cluster_role_binding = client.V1ClusterRoleBinding(
1956
- metadata=client.V1ObjectMeta(name="prometheus"),
1957
- subjects=[
1958
- client.V1Subject(
1967
+ # Create subject with version compatibility
1968
+ try:
1969
+ # Try V1Subject first (older versions)
1970
+ subject = client.V1Subject(
1971
+ kind="ServiceAccount",
1972
+ name="prometheus",
1973
+ namespace=namespace
1974
+ )
1975
+ except AttributeError:
1976
+ # Try RbacV1Subject (newer versions)
1977
+ try:
1978
+ subject = client.RbacV1Subject(
1959
1979
  kind="ServiceAccount",
1960
1980
  name="prometheus",
1961
1981
  namespace=namespace
1962
1982
  )
1963
- ],
1983
+ except AttributeError:
1984
+ # Manual construction as fallback
1985
+ subject = {
1986
+ 'kind': 'ServiceAccount',
1987
+ 'name': 'prometheus',
1988
+ 'namespace': namespace
1989
+ }
1990
+
1991
+ cluster_role_binding = client.V1ClusterRoleBinding(
1992
+ metadata=client.V1ObjectMeta(name="prometheus"),
1993
+ subjects=[subject],
1964
1994
  role_ref=client.V1RoleRef(
1965
1995
  kind="ClusterRole",
1966
1996
  name="prometheus",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k8s-helper-cli
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: A simplified Python wrapper for common Kubernetes operations
5
5
  Author-email: Harshit Chatterjee <harshitchatterjee50@gmail.com>
6
6
  License-Expression: MIT
@@ -0,0 +1,11 @@
1
+ k8s_helper/__init__.py,sha256=YuM-ES4NKCK-M1VusIhUSIsO8vigHDWGPyAS6bvShgw,2666
2
+ k8s_helper/cli.py,sha256=ngXnZ-6EaTm9hCViLPOLZya4HtFDsqpPbLYnOBEfQmA,79400
3
+ k8s_helper/config.py,sha256=P7YdfyvCHprrNs2J9DRb3RrClylfTTh5hfTtDzLug0A,6867
4
+ k8s_helper/core.py,sha256=HCsDx8xApBvgDooR3XqaW2ZeIzQU35oGm6rfjTBzYVc,110654
5
+ k8s_helper/utils.py,sha256=wYgTd5ktyuI-EiVcfW7FrxA7MzXY5odrEKQgmMVdueY,9496
6
+ k8s_helper_cli-0.4.2.dist-info/licenses/LICENSE,sha256=tXPvVl3gLVc6e0qCEoLH9KjeA7z4JVL78UybpvGtBCw,1096
7
+ k8s_helper_cli-0.4.2.dist-info/METADATA,sha256=p6tE1EFVcCIGx5vwv-L-EDB-K5VRbOtAXcc5z2K5dXM,30789
8
+ k8s_helper_cli-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ k8s_helper_cli-0.4.2.dist-info/entry_points.txt,sha256=IoCMWUZ6mn90LwzQzEy5YkWOwvogDdZ6ycqUWAzCFTQ,50
10
+ k8s_helper_cli-0.4.2.dist-info/top_level.txt,sha256=x9A1jflyer-z2cFnkqk5B42juoH2q0fy5hkT9upsTG8,11
11
+ k8s_helper_cli-0.4.2.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- k8s_helper/__init__.py,sha256=XDUF1icyJlQZbTC8B1N4sI8nxUs9X9nJO2EOHzVVq4E,2666
2
- k8s_helper/cli.py,sha256=ngXnZ-6EaTm9hCViLPOLZya4HtFDsqpPbLYnOBEfQmA,79400
3
- k8s_helper/config.py,sha256=P7YdfyvCHprrNs2J9DRb3RrClylfTTh5hfTtDzLug0A,6867
4
- k8s_helper/core.py,sha256=Zhpcpo_CSzYtBAkQyaHxkRETIbZbE2Ll_E8tW2lUgZ8,109549
5
- k8s_helper/utils.py,sha256=wYgTd5ktyuI-EiVcfW7FrxA7MzXY5odrEKQgmMVdueY,9496
6
- k8s_helper_cli-0.4.0.dist-info/licenses/LICENSE,sha256=tXPvVl3gLVc6e0qCEoLH9KjeA7z4JVL78UybpvGtBCw,1096
7
- k8s_helper_cli-0.4.0.dist-info/METADATA,sha256=CwdjQe6YLKK4cTqf1MKc-69Fxwo77p6-fNq2XVWM1gM,30789
8
- k8s_helper_cli-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
- k8s_helper_cli-0.4.0.dist-info/entry_points.txt,sha256=IoCMWUZ6mn90LwzQzEy5YkWOwvogDdZ6ycqUWAzCFTQ,50
10
- k8s_helper_cli-0.4.0.dist-info/top_level.txt,sha256=x9A1jflyer-z2cFnkqk5B42juoH2q0fy5hkT9upsTG8,11
11
- k8s_helper_cli-0.4.0.dist-info/RECORD,,