Skip to content

Commit

Permalink
Disable Istio Injection on build pods
Browse files Browse the repository at this point in the history
 - This will prevent istio from injecting in and build pods allowing the builds to succeed on clusters that don't require istio
  • Loading branch information
matthewmcnew committed Jun 9, 2022
1 parent 115a386 commit 3adf127
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions pkg/apis/build/v1alpha2/build_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
cosignRespositoryAnnotationPrefix = "kpack.io/cosign.repository"
DOCKERSecretAnnotationPrefix = "kpack.io/docker"
GITSecretAnnotationPrefix = "kpack.io/git"
IstioInject = "sidecar.istio.io/inject"

cosignSecretDataCosignKey = "cosign.key"

Expand Down Expand Up @@ -332,7 +333,9 @@ func (b *Build) BuildPod(images BuildPodImages, buildContext BuildContext) (*cor
Labels: combine(b.Labels, map[string]string{
BuildLabel: b.Name,
}),
Annotations: b.Annotations,
Annotations: combine(b.Annotations, map[string]string{
IstioInject: "false",
}),
OwnerReferences: []metav1.OwnerReference{
*kmeta.NewControllerRef(b),
},
Expand Down Expand Up @@ -740,7 +743,9 @@ func (b *Build) rebasePod(buildContext BuildContext, images BuildPodImages) (*co
Labels: combine(b.Labels, map[string]string{
BuildLabel: b.Name,
}),
Annotations: b.Annotations,
Annotations: combine(b.Annotations, map[string]string{
IstioInject: "false",
}),
OwnerReferences: []metav1.OwnerReference{
*kmeta.NewControllerRef(b),
},
Expand Down
4 changes: 3 additions & 1 deletion pkg/apis/build/v1alpha2/build_pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ func testBuildPod(t *testing.T, when spec.G, it spec.S) {
"image.kpack.io/buildNumber": "12",
},
Annotations: map[string]string{
"some/annotation": "to-pass-through",
"some/annotation": "to-pass-through",
"sidecar.istio.io/inject": "false",
},
OwnerReferences: []metav1.OwnerReference{
*kmeta.NewControllerRef(build),
Expand Down Expand Up @@ -1369,6 +1370,7 @@ func testBuildPod(t *testing.T, when spec.G, it spec.S) {
},
Annotations: map[string]string{
"some/annotation": "to-pass-through",
"sidecar.istio.io/inject": "false",
buildapi.BuildReasonAnnotation: buildapi.BuildReasonStack,
buildapi.BuildChangesAnnotation: "some-stack-change",
},
Expand Down

0 comments on commit 3adf127

Please sign in to comment.