Skip to content

Commit c713dfe

Browse files
Add an annotation that skips creating deployer pods
Useful for iterative testing of deployment logic, or running an external deployer.
1 parent 552030f commit c713dfe

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

pkg/deploy/api/types.go

+4
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ const (
199199
// annotation value is the name of the deployer Pod which will act upon the ReplicationController
200200
// to implement the deployment behavior.
201201
DeploymentPodAnnotation = "openshift.io/deployer-pod.name"
202+
// DeploymentIgnorePodAnnotation is an annotation on a deployment config that will bypass creating
203+
// a deployment pod with the deployment. The caller is responsible for setting the deployment
204+
// status and running the deployment process.
205+
DeploymentIgnorePodAnnotation = "deploy.openshift.io/deployer-pod.ignore"
202206
// DeploymentPodTypeLabel is a label with which contains a type of deployment pod.
203207
DeploymentPodTypeLabel = "openshift.io/deployer-pod.type"
204208
// DeployerPodForDeploymentLabel is a label which groups pods related to a

pkg/deploy/controller/deployment/controller.go

+5
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ func (c *DeploymentController) Handle(deployment *kapi.ReplicationController) er
107107
// Don't try and re-create the deployer pod.
108108
break
109109
}
110+
111+
if _, ok := deployment.Annotations[deployapi.DeploymentIgnorePod]; ok {
112+
return nil
113+
}
114+
110115
// Generate a deployer pod spec.
111116
podTemplate, err := c.makeDeployerPod(deployment)
112117
if err != nil {

pkg/deploy/util/util.go

+3
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ func MakeDeployment(config *deployapi.DeploymentConfig, codec runtime.Codec) (*a
223223
},
224224
},
225225
}
226+
if value, ok := config.Annotations[deployapi.DeploymentIgnorePodAnnotation]; ok {
227+
deployment.Annotations[deployapi.DeploymentIgnorePodAnnotation] = value
228+
}
226229

227230
return deployment, nil
228231
}

0 commit comments

Comments
 (0)