Skip to content

Commit ac62461

Browse files
pkalsi97squakez
authored andcommitted
use constant for default container annotation
1 parent 4eafd3e commit ac62461

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

pkg/trait/container.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ const (
4545
containerTraitID = "container"
4646
containerTraitOrder = 1600
4747

48-
defaultContainerName = "integration"
49-
defaultContainerPort = 8080
50-
defaultServicePort = 80
48+
defaultContainerName = "integration"
49+
defaultContainerAnnotation = "kubectl.kubernetes.io/default-container"
50+
defaultContainerPort = 8080
51+
defaultServicePort = 80
5152

5253
defaultContainerRunAsNonRoot = false
5354
defaultContainerSeccompProfileType = corev1.SeccompProfileTypeRuntimeDefault

pkg/trait/cron.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func (t *cronTrait) getCronJobFor(e *Environment) *batchv1.CronJob {
241241
}
242242

243243
// Set the default container annotation for kubectl commands
244-
annotations["kubectl.kubernetes.io/default-container"] = defaultContainerName
244+
annotations[defaultContainerAnnotation] = defaultContainerName
245245

246246
activeDeadline := defaultCronActiveDeadlineSeconds
247247
if t.ActiveDeadlineSeconds != nil {

pkg/trait/deployment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (t *deploymentTrait) getDeploymentFor(e *Environment) *appsv1.Deployment {
119119
}
120120

121121
// Set the default container annotation for kubectl commands
122-
annotations["kubectl.kubernetes.io/default-container"] = defaultContainerName
122+
annotations[defaultContainerAnnotation] = defaultContainerName
123123

124124
deadline := defaultProgressDeadline
125125
if t.ProgressDeadlineSeconds != nil {

pkg/trait/knative_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func (t *knativeServiceTrait) getServiceFor(e *Environment) (*serving.Service, e
195195
}
196196

197197
// Set the default container annotation for kubectl
198-
revisionAnnotations["kubectl.kubernetes.io/default-container"] = defaultContainerName
198+
revisionAnnotations[defaultContainerAnnotation] = defaultContainerName
199199

200200
// Set Knative auto-scaling
201201
if t.Class != "" {

0 commit comments

Comments
 (0)