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

[Feature]: Add Container Lifecycle Hooks (PostStart,PreStop) for containers in the Cluster CRD #4405

Open
2 tasks done
RatonII opened this issue Apr 29, 2024 · 0 comments · May be fixed by #4406
Open
2 tasks done

[Feature]: Add Container Lifecycle Hooks (PostStart,PreStop) for containers in the Cluster CRD #4405

RatonII opened this issue Apr 29, 2024 · 0 comments · May be fixed by #4406
Assignees
Labels
triage Pending triage

Comments

@RatonII
Copy link

RatonII commented Apr 29, 2024

Is there an existing issue already for this feature request/idea?

  • I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.

What problem is this feature going to solve? Why should it be added?

I need Container Lifecycle Hooks for the containers running in the Cluster. This will help me delay the pod termination in case of Kubernetes node upgrade on AWS EKS by creating a custom container image and adding a draining script for connections.

Describe the solution you'd like

The containerLifecycleoption of a Kubernetes container inside of pod could be implemented. See https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/#define-poststart-and-prestop-handlers

It could be configured in the YAML file in the spec section:

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
  metadata:
    name: postgres-cluster-test-service
  spec:
    instances: 2
    imageName: ghcr.io/cloudnative-pg/postgresql:14.11
    containerLifecycle:
      preStop:
        exec:
          command: ["sleep", "300"]

By default, this field should no be set.

Describe alternatives you've considered

No alternative.

Additional context

No response

Backport?

No

Are you willing to actively contribute to this feature?

Yes

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Pending triage
Projects
None yet
2 participants