Skip to content

Commit e88c119

Browse files
authored
Adds sds-grpc to static Envoy config (#58)
1 parent b896c91 commit e88c119

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

internal/proxy/config.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"path/filepath"
88
"text/template"
99

10+
constants "github.com/cofide/spiffe-enable/internal/const"
1011
"github.com/cofide/spiffe-enable/internal/helper"
1112
"github.com/cofide/spiffe-enable/internal/workload"
1213
corev1 "k8s.io/api/core/v1"
@@ -172,6 +173,7 @@ func NewEnvoy(params EnvoyConfigParams) (*Envoy, error) {
172173
},
173174
},
174175
},
176+
getSDSCluster(),
175177
},
176178
},
177179
}
@@ -200,6 +202,33 @@ func NewEnvoy(params EnvoyConfigParams) (*Envoy, error) {
200202
return &Envoy{InitScript: renderedScript.String(), Cfg: envoyConfigJSON}, nil
201203
}
202204

205+
func getSDSCluster() map[string]interface{} {
206+
return map[string]interface{}{
207+
"name": "sds-grpc",
208+
"connect_timeout": "5s",
209+
"type": "STATIC",
210+
"http2_protocol_options": map[string]interface{}{},
211+
"load_assignment": map[string]interface{}{
212+
"cluster_name": "sds-grpc",
213+
"endpoints": []interface{}{
214+
map[string]interface{}{
215+
"lb_endpoints": []interface{}{
216+
map[string]interface{}{
217+
"endpoint": map[string]interface{}{
218+
"address": map[string]interface{}{
219+
"pipe": map[string]interface{}{
220+
"path": constants.SPIFFEWLSocketPath,
221+
},
222+
},
223+
},
224+
},
225+
},
226+
},
227+
},
228+
},
229+
}
230+
}
231+
203232
func (e *Envoy) GetConfigVolume() corev1.Volume {
204233
return corev1.Volume{
205234
Name: EnvoyConfigVolumeName,

0 commit comments

Comments
 (0)