Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tillkahlbrock/5eab74562b498ad1280a8b15051c8e25 to your computer and use it in GitHub Desktop.
Save tillkahlbrock/5eab74562b498ad1280a8b15051c8e25 to your computer and use it in GitHub Desktop.
Convert OpenShift DeploymentConfig to Kubernetes Deployment
  1. Change apiVersion from:

    - apiVersion: v1

    (or apiVersion: apps.openshift.io/v1)

    to:

    - apiVersion: apps/v1
  2. Change kind from:

      kind: DeploymentConfig

    to:

      kind: Deployment
  3. Change spec.selectors from:

        selector:
          name: ...

    to:

        selector:
          matchLabels:
            name: ...
  4. Make sure spec.template.spec.containers.image is set, e.g.

            image: registry.access.redhat.com/rhscl/postgresql-${POSTGRESQL_VERSION}-rhel7
            imagePullPolicy: Always
    
  5. Remove spec.triggers section entirely

  6. Remove fields from spec.strategy:

  • activeDeadlineSeconds
  • resources
  • rollingParams.intervalSeconds
  • rollingParams.timeoutSeconds
  • rollingParams.updatePeriodSeconds
  1. Update spec.strategy.type from Rolling to RollingUpdate

  2. Remove spec.test entirely

@thikade
Copy link

thikade commented May 20, 2021

thanks! just one thing is missing (tested on K8s 1.20) :

  • finally spec.strategy.rollingParams need to be renamed to spec.strategy.rollingUpdate
kind: Deployment
spec:
  ...
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment