Skip to content

Commit

Permalink
Fix bug#34624864 - Adding comptibilit to K8s 1.25, dropping <=1.20
Browse files Browse the repository at this point in the history
Change-Id: I603c3c64d22b10ffa28cad558774cf8450ac7960
  • Loading branch information
johannes committed Sep 25, 2022
1 parent 4930323 commit 5082bf1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mysqloperator/controller/backup/backup_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def patch_cron_template_for_backup_schedule(base: dict, cluster_name: str, sched

def get_cron_job_template(spec: InnoDBClusterSpec) -> dict:
tmpl = f"""
apiVersion: batch/v1beta1
apiVersion: batch/v1
kind: CronJob
metadata:
labels:
Expand Down
8 changes: 4 additions & 4 deletions mysqloperator/controller/innodbcluster/cluster_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,9 @@ def get_service(self) -> typing.Optional[api_client.V1Service]:

# As of K8s 1.21 this is no more beta.
# Thus, eventually this needs to be upgraded to V1PodDisruptionBudget and api_policy to PolicyV1Api
def get_disruption_budget(self) -> typing.Optional[api_client.V1beta1PodDisruptionBudget]:
def get_disruption_budget(self) -> typing.Optional[api_client.V1PodDisruptionBudget]:
try:
return cast(api_client.V1beta1PodDisruptionBudget,
return cast(api_client.V1PodDisruptionBudget,
api_policy.read_namespaced_pod_disruption_budget(self.name + "-pdb", self.namespace))
except ApiException as e:
if e.status == 404:
Expand Down Expand Up @@ -700,9 +700,9 @@ def get_router_deployment(self) -> typing.Optional[api_client.V1Deployment]:
raise

def get_cron_job(self, schedule_name: str) -> typing.Callable:
def get_cron_job_inner() -> typing.Optional[api_client.V1beta1CronJob]:
def get_cron_job_inner() -> typing.Optional[api_client.V1CronJob]:
try:
return cast(api_client.V1beta1CronJob,
return cast(api_client.V1CronJob,
api_cron_job.read_namespaced_cron_job(schedule_name, self.namespace))
except ApiException as e:
if e.status == 404:
Expand Down
2 changes: 1 addition & 1 deletion mysqloperator/controller/innodbcluster/cluster_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def encode(s):

def prepare_cluster_pod_disruption_budget(spec: InnoDBClusterSpec) -> dict:
tmpl = f"""
apiVersion: policy/v1beta1
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {spec.name}-pdb
Expand Down
4 changes: 2 additions & 2 deletions mysqloperator/controller/kubeutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
api_customobj: client.CustomObjectsApi = client.CustomObjectsApi()
api_apps: client.AppsV1Api = client.AppsV1Api()
api_batch: client.BatchV1Api = client.BatchV1Api()
api_cron_job: client.BatchV1beta1Api = client.BatchV1beta1Api()
api_policy: client.PolicyV1beta1Api = client.PolicyV1beta1Api()
api_cron_job: client.BatchV1Api = client.BatchV1Api()
api_policy: client.PolicyV1Api = client.PolicyV1Api()
api_rbac: client.RbacAuthorizationV1Api = client.RbacAuthorizationV1Api()

T = TypeVar("T")
Expand Down

0 comments on commit 5082bf1

Please # to comment.