Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probes are not updated #2320

Open
GuyAfik opened this issue Jan 13, 2025 · 4 comments
Open

Probes are not updated #2320

GuyAfik opened this issue Jan 13, 2025 · 4 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@GuyAfik
Copy link

GuyAfik commented Jan 13, 2025

What happened (please include outputs or screenshots):
I have a deployment in GCP in a k8s cluster.
I am trying to remove LivenessProbe, ReadnessProbe && StartupProbe, however the deployment does not get updated at all.

What you expected to happen:
The probes to be removed

How to reproduce it (as minimally and precisely as possible):

    @property
    def containers(self) -> List[V1Container]:
        return self.spec.template.spec.containers
        
    def __validate_prob(self):
        for container in self.containers:
            if (
                container.readiness_probe
                or container.startup_probe
                or container.liveness_probe
            ):
                container.readiness_probe = None
                container.startup_probe = None
                container.liveness_probe = None
        
     def update():
        with self.kubernetes_service as api_client:
            api_instance = kubernetes.client.AppsV1Api(api_client)
            api_instance.patch_namespaced_deployment(
                name=self.name,
                namespace=self.namespace,
                body=self.deployment,
                _request_timeout=self.kubernetes_service.timeout,
            )
                
  
  • Assume that self.deployment is the V1Deployment object.
  • This is code from a class that should remove the probes from the deployment (and does a lot of other stuff), however they are not removed from some reason.
  • If I try to update an image or anything else, it works as expected, so it could be a problem specific with probes

Environment:

  • Kubernetes version (kubectl version):
Client Version: v1.31.3
Kustomize Version: v5.4.2
Server Version: v1.30.8-gke.1051000
  • OS (e.g., MacOS 10.13.6): mac os 12
  • Python version (python --version) python 3.12
  • Python client version (pip list | grep kubernetes) 29.0.0
@GuyAfik GuyAfik added the kind/bug Categorizes issue or PR as related to a bug. label Jan 13, 2025
@roycaihw
Copy link
Member

I assume it has to do with the patch type you use (JSON patch v.s. SMP). Could you turn on DEBUG logging and share more on the patch you sent?

You may also check https://github.com/kubernetes-client/python/tree/master/examples for examples of patching resources.

@GuyAfik
Copy link
Author

GuyAfik commented Jan 17, 2025

@roycaihw Hey, thanks for response, how can I enable debug logging for the kubernetes module? Is there any config of log.level I can set?

@roycaihw
Copy link
Member

Here is an example for enabling debug logging.

@GuyAfik
Copy link
Author

GuyAfik commented Jan 23, 2025

@roycaihw Thanks, I have done that and I can see that the probes in the PATCH request do not exist if I remove them manually before sending a body request, yet it still isn't removed from GCP.

I cannot share the body request itself unfortunately.
I do however see that if I do not remove the probes in the code, they are NOT sent in the body request,
however when I do remove it I can see the body request sent is being sent without the probes.

I am doing PATCH /apis/apps/v1/namespaces/<namespace>/deployments/<deployment>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants