OpenShift DeploymentConfig Definition: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 137: Line 137:


"Always"
"Always"
Also see: {{OpenShift_Image_and_ImageStream_Operations#Create_an_Individual_Image_Stream_with_import-image|Create an Individual Image Stream with import-image}}

Revision as of 23:26, 25 January 2018

External

Internal

Definition

apiVersion: v1

kind:       DeploymentConfig

metadata: 
            name: blue

            labels: {...}
  
spec: 
            replicas: 1

            selector: 

                      pod_selector_label_name_1:  pod_selector_value_1
                      pod_selector_label_name_2:  pod_selector_value_2

            strategy: 
                      type: Recreate

            template: 

                      metadata: 

                              annotations: 

                                  arbitrary-key-1: arbitrary-value-1
 
                              labels: 

                                  pod_selector_label_name_1:  pod_selector_value_1
                                  pod_selector_label_name_2:  pod_selector_value_2

                      spec: 
                           containers:  

                                        - name: blue

                                          image: 

                                          imagePullPolicy: Always

                                          env:
                                          - name: TEST_ENV1
                                            value: TEST_VALUE1

                                          ports:
                                                 - containerPort: 1234
                                                   protocol: TCP
                                          volumeMounts:
                                                 - name: data
                                                   mountPath: /opt/blue/data
                                                 - name: config
                                                   mountPath: /etc/blue/conf
                                          livenessProbe: {...}
                                          readinessProbe: {...}
                                          terminationMessagePath: /dev/termination-log
                                          resources: {...}

                           dnsPolicy: ClusterFirst
                           restartPolicy: Always
                           securityContext: {...}
                           terminationGracePeriodSeconds: 30
                           volumes:  
                                   - name: data
                                     persistentVolumeClaim:
                                       claimName: data-pvc
                                   - name: config
                                     configMap:
                                       name: config-cm
                                       items:
                                         - key: app.ini
                                           path: app.ini
            triggers: 
                     - type: ConfigChange
                     - type: ImageChange
                       imageChangeParams:
                         from:
                           kind: ImageStreamTag
                           name: gogs:0.11.29

status: {...}

Elements

spec

selector

Represents a query that applied over pods, returns the number of pods which should match the "replica" count. This is the query used by the replication controller to figure out whether it has to spin up or shut down pods. The labels specified in the "spec.selector" map must match the labels applied to the pods created by this deployment configuration, which are the "spec.template.metadata.labels". More details: https://docs.openshift.com/container-platform/latest/rest_api/openshift_v1.html#v1-deploymentconfigspec

template

metadata

annotations

An unstructured key-value map stored with the resource that may be set by external tools to store and retrieve arbitrary metadata.

Also see

Custom Metadata Annotations
labels

Labels applied to pods created by this deployment configuration. They must match 'spec.selector' values.

spec

containers
env

The list of the environment variables to set in the container.

spec:
 template:
   spec:
     containers:
     - env:
       - name: TEST_ENV_1
         value: TEST_VALUE_1

More about:

Environment Variables
imagePullPolicy

"Always"

Also see: Template:OpenShift Image and ImageStream Operations