File tree Expand file tree Collapse file tree 2 files changed +9
-22
lines changed
components/buildless-serverless/internal/controller/resources Expand file tree Collapse file tree 2 files changed +9
-22
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ const (
2121 istioConfigLabelKey = "proxy.istio.io/config"
2222 istioEnableHoldUntilProxyStartLabelValue = "{ \" holdApplicationUntilProxyStarts\" : true }"
2323 istioNativeSidecarLabelKey = "sidecar.istio.io/nativeSidecar"
24- istioInjectSidecarLabelKey = "sidecar.istio.io/inject"
2524)
2625
2726type Deployment struct {
@@ -110,13 +109,11 @@ func (d *Deployment) currentAnnotationsWithoutPreviousFunctionAnnotations() map[
110109 return result
111110}
112111
112+ // allow istio to inject native sidecar (istio-proxy as init container)
113+ // this is required for init container of git sourced functions to fetch source from git repository
113114func (d * Deployment ) annotationsRequiredByIstio () map [string ]string {
114115 result := make (map [string ]string )
115-
116- if d .function .HasGitSources () && d .function .HasLabel (istioInjectSidecarLabelKey , "true" ) {
117- result [istioNativeSidecarLabelKey ] = "true"
118- }
119-
116+ result [istioNativeSidecarLabelKey ] = "true"
120117 return result
121118}
122119
Original file line number Diff line number Diff line change @@ -137,26 +137,16 @@ func TestDeployment_construct(t *testing.T) {
137137
138138 require .NotNil (t , r )
139139 require .Equal (t , map [string ]string {
140- "proxy.istio.io/config" : "{ \" holdApplicationUntilProxyStarts\" : true }" ,
141- "leavitt" : "hopeful" ,
142- "pike" : "tender" ,
143- "thompson" : "exciting" ,
140+ "proxy.istio.io/config" : "{ \" holdApplicationUntilProxyStarts\" : true }" ,
141+ "leavitt" : "hopeful" ,
142+ "pike" : "tender" ,
143+ "thompson" : "exciting" ,
144+ "sidecar.istio.io/nativeSidecar" : "true" ,
144145 }, r .Spec .Template .ObjectMeta .Annotations )
145146 })
146- t .Run ("enable native sidecar when istio is enabled and function has git repo " , func (t * testing.T ) {
147+ t .Run ("enable native sidecar" , func (t * testing.T ) {
147148 d := minimalDeployment ()
148149
149- d .function .Spec .Source = serverlessv1alpha2.Source {
150- GitRepository : & serverlessv1alpha2.GitRepositorySource {
151- URL : "wonderful-germain" ,
152- Repository : serverlessv1alpha2.Repository {
153- BaseDir : "recursing-mcnulty" ,
154- Reference : "epic-mendel" }}}
155-
156- d .function .Spec .Labels = map [string ]string {
157- "sidecar.istio.io/inject" : "true" ,
158- }
159-
160150 r := d .construct ()
161151
162152 require .NotNil (t , r )
You can’t perform that action at this time.
0 commit comments