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

Example Deployment should set deployment strategy to Recreate #116

Closed
kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Closed

Example Deployment should set deployment strategy to Recreate #116

kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Labels
archive documentation Documentation improvements

Comments

@kopf-archiver
Copy link

kopf-archiver bot commented Aug 18, 2020

An issue by GrahamDumpleton at 2019-06-16 03:39:42+00:00
Original URL: zalando-incubator/kopf#116
 

Docs at:

https://kopf.readthedocs.io/en/latest/deployment/

have Deployment example of:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: kopfexample-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      application: kopfexample-operator
  template:
    metadata:
      labels:
        application: kopfexample-operator
    spec:
      serviceAccountName: kopfexample-account
      containers:
      - name: the-only-one
        image: nolar/kopf-operator

This should also set .spec.strategy.type==Recreate.

https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#recreate-deployment

This is because the default for deployment strategy is rolling update, which means that on a re-deployment triggered by a change to pod template, there can be two instances of the pod at the same time. That is, the new pod is started before the old is shutdown.

The docs say to only ever set replicas to 1 due to issue of there being more than once instance, but the rolling update can induce the same problem. You should therefore set the deployment strategy to Recreate to ensure old pod is shutdown before starting new one, thus ensuring there is truly only at most one pod for the operator running at the same time.


Commented by nolar at 2019-06-19 15:11:47+00:00
 

GrahamDumpleton Thanks. That should be changed indeed.

Also, #51 can indirectly solve this problem, as these 2 pods running at the same time will freeze each other for a short period of time, so they will not start double-handling the objects (yet there will be a short downtime, which will happen anyway due to pod recreation.)

@kopf-archiver kopf-archiver bot closed this as completed Aug 18, 2020
@kopf-archiver kopf-archiver bot changed the title [archival placeholder] Example Deployment should set deployment strategy to Recreate Aug 19, 2020
@kopf-archiver kopf-archiver bot added the documentation Documentation improvements label Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archive documentation Documentation improvements
Projects
None yet
Development

No branches or pull requests

0 participants