-
Notifications
You must be signed in to change notification settings - Fork 352
/
Copy pathtrait_types.go
716 lines (608 loc) · 20.9 KB
/
trait_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package trait
import (
"context"
"fmt"
"path"
"sort"
"strings"
"github.com/pkg/errors"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/api/batch/v1beta1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
serving "knative.dev/serving/pkg/apis/serving/v1"
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/client"
"github.com/apache/camel-k/pkg/platform"
"github.com/apache/camel-k/pkg/util"
"github.com/apache/camel-k/pkg/util/camel"
"github.com/apache/camel-k/pkg/util/kubernetes"
"github.com/apache/camel-k/pkg/util/log"
"github.com/apache/camel-k/pkg/util/property"
)
const (
True = "true"
False = "false"
)
// Identifiable represent an identifiable type.
type Identifiable interface {
ID() ID
}
// ID uniquely identifies a trait.
type ID string
// Trait is the interface of all traits.
type Trait interface {
Identifiable
client.Injectable
// Configure the trait
Configure(environment *Environment) (bool, error)
// Apply executes a customization of the Environment
Apply(environment *Environment) error
// InfluencesKit determines if the trait has any influence on Integration Kits
InfluencesKit() bool
// IsPlatformTrait marks all fundamental traits that allow the platform to work
IsPlatformTrait() bool
// RequiresIntegrationPlatform indicates that the trait cannot work without an integration platform set
RequiresIntegrationPlatform() bool
// IsAllowedInProfile tels if the trait supports the given profile
IsAllowedInProfile(v1.TraitProfile) bool
// Order is the order in which the trait should be executed in the normal flow
Order() int
}
type Comparable interface {
Matches(Trait) bool
}
type ComparableTrait interface {
Trait
Comparable
}
// A list of named orders, useful for correctly binding addons.
const (
// TraitOrderBeforeControllerCreation can be used to inject configuration such as properties and environment variables
// into the running integration, before the actual controller is created.
TraitOrderBeforeControllerCreation = 850
// TraitOrderControllerSelection can be used if you intend to provide an alternative controller for the integration
// (e.g. Deployment, CronJob, ...).
TraitOrderControllerSelection = 950
// TraitOrderPostProcessResources is executed after all other traits are executed (except for important core traits such as
// the "owner" trait), so it can be used to post-process generated resources before their actual creation.
TraitOrderPostProcessResources = 2450
)
func NewBaseTrait(id string, order int) BaseTrait {
return BaseTrait{
TraitID: ID(id),
ExecutionOrder: order,
L: log.Log.WithName("traits").WithValues("trait", id),
}
}
// BaseTrait is the root trait with noop implementations for hooks.
type BaseTrait struct {
TraitID ID `json:"-"`
// Can be used to enable or disable a trait. All traits share this common property.
Enabled *bool `property:"enabled" json:"enabled,omitempty"`
Client client.Client `json:"-"`
ExecutionOrder int `json:"-"`
L log.Logger `json:"-"`
}
// ID returns the identifier of the trait.
func (trait *BaseTrait) ID() ID {
return trait.TraitID
}
// InjectClient implements client.ClientInject and allows to inject a client into the trait.
func (trait *BaseTrait) InjectClient(c client.Client) {
trait.Client = c
}
// InfluencesKit determines if the trait has any influence on Integration Kits.
func (trait *BaseTrait) InfluencesKit() bool {
return false
}
// IsPlatformTrait marks all fundamental traits that allow the platform to work.
func (trait *BaseTrait) IsPlatformTrait() bool {
return false
}
// RequiresIntegrationPlatform indicates that the trait cannot work without an integration platform set.
func (trait *BaseTrait) RequiresIntegrationPlatform() bool {
// All traits require a platform by default
return true
}
// IsAllowedInProfile returns true for any profile by default.
func (trait *BaseTrait) IsAllowedInProfile(v1.TraitProfile) bool {
return true
}
// Order contains the order value provided during initialization.
func (trait *BaseTrait) Order() int {
return trait.ExecutionOrder
}
// ControllerStrategySelector is the interface for traits that can determine the kind of controller that will run the integration.
type ControllerStrategySelector interface {
// SelectControllerStrategy tells if the trait with current configuration can select a specific controller to use
SelectControllerStrategy(*Environment) (*ControllerStrategy, error)
// ControllerStrategySelectorOrder returns the order (priority) of the controller strategy selector
ControllerStrategySelectorOrder() int
}
// An Environment provides the context for the execution of the traits.
type Environment struct {
CamelCatalog *camel.RuntimeCatalog
RuntimeVersion string
Catalog *Catalog
// The Go standard context for the traits execution
Ctx context.Context
// The client to the API server
Client client.Client
// The active Platform
Platform *v1.IntegrationPlatform
// The current Integration
Integration *v1.Integration
// The IntegrationKit associated to the Integration
IntegrationKit *v1.IntegrationKit
// The IntegrationKits to be created for the Integration
IntegrationKits []v1.IntegrationKit
// The resources owned by the Integration that are applied to the API server
Resources *kubernetes.Collection
PostActions []func(*Environment) error
PostStepProcessors []func(*Environment) error
PostProcessors []func(*Environment) error
BuildTasks []v1.Task
ConfiguredTraits []Trait
ExecutedTraits []Trait
EnvVars []corev1.EnvVar
ApplicationProperties map[string]string
Interceptors []string
ServiceBindingSecret string
}
// ControllerStrategy is used to determine the kind of controller that needs to be created for the integration.
type ControllerStrategy string
// List of controller strategies.
const (
ControllerStrategyDeployment ControllerStrategy = "deployment"
ControllerStrategyKnativeService ControllerStrategy = "knative-service"
ControllerStrategyCronJob ControllerStrategy = "cron-job"
DefaultControllerStrategy = ControllerStrategyDeployment
)
func (e *Environment) GetTrait(id ID) Trait {
for _, t := range e.ExecutedTraits {
if t.ID() == id {
return t
}
}
return nil
}
func (e *Environment) IntegrationInPhase(phases ...v1.IntegrationPhase) bool {
if e.Integration == nil {
return false
}
for _, phase := range phases {
if e.Integration.Status.Phase == phase {
return true
}
}
return false
}
func (e *Environment) IntegrationInRunningPhases() bool {
return e.IntegrationInPhase(v1.IntegrationPhaseDeploying, v1.IntegrationPhaseRunning, v1.IntegrationPhaseError)
}
func (e *Environment) IntegrationKitInPhase(phases ...v1.IntegrationKitPhase) bool {
if e.IntegrationKit == nil {
return false
}
for _, phase := range phases {
if e.IntegrationKit.Status.Phase == phase {
return true
}
}
return false
}
func (e *Environment) InPhase(c v1.IntegrationKitPhase, i v1.IntegrationPhase) bool {
return e.IntegrationKitInPhase(c) && e.IntegrationInPhase(i)
}
// DetermineProfile determines the TraitProfile of the environment.
// First looking at the Integration.Spec for a Profile,
// next looking at the IntegrationKit.Spec
// and lastly the Platform Profile.
func (e *Environment) DetermineProfile() v1.TraitProfile {
if e.Integration != nil {
if e.Integration.Status.Profile != "" {
return e.Integration.Status.Profile
}
if e.Integration.Spec.Profile != "" {
return e.Integration.Spec.Profile
}
}
if e.IntegrationKit != nil && e.IntegrationKit.Spec.Profile != "" {
return e.IntegrationKit.Spec.Profile
}
if e.Platform != nil {
return platform.GetProfile(e.Platform)
}
return v1.DefaultTraitProfile
}
// DetermineControllerStrategy determines the type of controller that should be used for the integration.
func (e *Environment) DetermineControllerStrategy() (ControllerStrategy, error) {
defaultStrategy := DefaultControllerStrategy
for _, creator := range e.getControllerStrategyChoosers() {
if strategy, err := creator.SelectControllerStrategy(e); err != nil {
return defaultStrategy, err
} else if strategy != nil {
return *strategy, nil
}
}
return defaultStrategy, nil
}
func (e *Environment) getControllerStrategyChoosers() (res []ControllerStrategySelector) {
for _, t := range e.ConfiguredTraits {
if cc, ok := t.(ControllerStrategySelector); ok {
res = append(res, cc)
}
}
sort.Slice(res, func(i, j int) bool {
return res[i].ControllerStrategySelectorOrder() < res[j].ControllerStrategySelectorOrder()
})
return res
}
// GetIntegrationPodSpec return the Integration Template Pod Specification, regardless of the deployment strategy.
func (e *Environment) GetIntegrationPodSpec() *corev1.PodSpec {
// Deployment
deployment := e.Resources.GetDeployment(func(d *appsv1.Deployment) bool {
return d.Name == e.Integration.Name
})
if deployment != nil {
return &deployment.Spec.Template.Spec
}
// Knative service
knativeService := e.Resources.GetKnativeService(func(s *serving.Service) bool {
return s.Name == e.Integration.Name
})
if knativeService != nil {
return &knativeService.Spec.Template.Spec.PodSpec
}
// Cronjob
cronJob := e.Resources.GetCronJob(func(c *v1beta1.CronJob) bool {
return c.Name == e.Integration.Name
})
if cronJob != nil {
return &cronJob.Spec.JobTemplate.Spec.Template.Spec
}
return nil
}
func (e *Environment) DetermineCatalogNamespace() string {
// Catalog is expected to be together with the platform
if e.Platform != nil && e.Platform.Namespace != "" {
return e.Platform.Namespace
}
if e.Integration != nil && e.Integration.Status.IntegrationKit != nil && e.Integration.Status.IntegrationKit.Namespace != "" {
return e.Integration.Status.IntegrationKit.Namespace
}
if e.Integration != nil && e.Integration.Spec.IntegrationKit != nil && e.Integration.Spec.IntegrationKit.Namespace != "" {
return e.Integration.Spec.IntegrationKit.Namespace
}
if e.IntegrationKit != nil && e.IntegrationKit.Namespace != "" {
return e.IntegrationKit.Namespace
}
if e.Integration != nil && e.Integration.Namespace != "" {
return e.Integration.Namespace
}
return ""
}
func (e *Environment) computeApplicationProperties() (*corev1.ConfigMap, error) {
// application properties
applicationProperties, err := property.EncodePropertyFile(e.ApplicationProperties)
if err != nil {
return nil, errors.Wrapf(err, "could not compute application properties")
}
if applicationProperties != "" {
return &corev1.ConfigMap{
TypeMeta: metav1.TypeMeta{
Kind: "ConfigMap",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: e.Integration.Name + "-application-properties",
Namespace: e.Integration.Namespace,
Labels: map[string]string{
v1.IntegrationLabel: e.Integration.Name,
"camel.apache.org/properties.type": "application",
},
},
Data: map[string]string{
"application.properties": applicationProperties,
},
}, nil
}
return nil, nil
}
func (e *Environment) addSourcesProperties() {
if e.ApplicationProperties == nil {
e.ApplicationProperties = make(map[string]string)
}
for i, s := range e.Integration.Sources() {
srcName := strings.TrimPrefix(s.Name, "/")
src := "file:" + path.Join(camel.SourcesMountPath, srcName)
e.ApplicationProperties[fmt.Sprintf("camel.k.sources[%d].location", i)] = src
simpleName := srcName
if strings.Contains(srcName, ".") {
simpleName = srcName[0:strings.Index(srcName, ".")]
}
e.ApplicationProperties[fmt.Sprintf("camel.k.sources[%d].name", i)] = simpleName
for pid, p := range s.PropertyNames {
e.ApplicationProperties[fmt.Sprintf("camel.k.sources[%d].property-names[%d]", i, pid)] = p
}
if s.Type != "" {
e.ApplicationProperties[fmt.Sprintf("camel.k.sources[%d].type", i)] = string(s.Type)
}
if s.InferLanguage() != "" {
e.ApplicationProperties[fmt.Sprintf("camel.k.sources[%d].language", i)] = string(s.InferLanguage())
}
if s.Loader != "" {
e.ApplicationProperties[fmt.Sprintf("camel.k.sources[%d].loader", i)] = s.Loader
}
if s.Compression {
e.ApplicationProperties[fmt.Sprintf("camel.k.sources[%d].compressed", i)] = "true"
}
interceptors := make([]string, 0, len(s.Interceptors))
if s.Interceptors != nil {
interceptors = append(interceptors, s.Interceptors...)
}
if e.Interceptors != nil {
interceptors = append(interceptors, e.Interceptors...)
}
for intID, interceptor := range interceptors {
e.ApplicationProperties[fmt.Sprintf("camel.k.sources[%d].interceptors[%d]", i, intID)] = interceptor
}
}
}
func (e *Environment) configureVolumesAndMounts(vols *[]corev1.Volume, mnts *[]corev1.VolumeMount) {
//
// Volumes :: Sources
//
for i, s := range e.Integration.Sources() {
cmName := fmt.Sprintf("%s-source-%03d", e.Integration.Name, i)
if s.ContentRef != "" {
cmName = s.ContentRef
}
cmKey := "content"
if s.ContentKey != "" {
cmKey = s.ContentKey
}
resName := strings.TrimPrefix(s.Name, "/")
refName := fmt.Sprintf("i-source-%03d", i)
resPath := path.Join(camel.SourcesMountPath, resName)
vol := getVolume(refName, "configmap", cmName, cmKey, resName)
mnt := getMount(refName, resPath, resName, true)
*vols = append(*vols, *vol)
*mnts = append(*mnts, *mnt)
}
for i, r := range e.Integration.Resources() {
if r.Type == v1.ResourceTypeOpenAPI {
continue
}
cmName := fmt.Sprintf("%s-resource-%03d", e.Integration.Name, i)
refName := fmt.Sprintf("i-resource-%03d", i)
resName := strings.TrimPrefix(r.Name, "/")
cmKey := "content"
resPath := getResourcePath(resName, r.Path, r.Type)
if r.ContentRef != "" {
cmName = r.ContentRef
}
if r.ContentKey != "" {
cmKey = r.ContentKey
}
if r.MountPath != "" {
resPath = r.MountPath
}
vol := getVolume(refName, "configmap", cmName, cmKey, resName)
mnt := getMount(refName, resPath, resName, true)
*vols = append(*vols, *vol)
*mnts = append(*mnts, *mnt)
}
if e.Resources != nil {
e.Resources.VisitConfigMap(func(configMap *corev1.ConfigMap) {
propertiesType := configMap.Labels["camel.apache.org/properties.type"]
resName := propertiesType + ".properties"
var mountPath string
switch propertiesType {
case "application":
mountPath = path.Join(camel.BasePath, resName)
case "user":
mountPath = path.Join(camel.ConfDPath, resName)
}
if propertiesType != "" {
refName := propertiesType + "-properties"
vol := getVolume(refName, "configmap", configMap.Name, "application.properties", resName)
mnt := getMount(refName, mountPath, resName, true)
*vols = append(*vols, *vol)
*mnts = append(*mnts, *mnt)
}
})
}
//
// Volumes :: Additional ConfigMaps
//
for _, configmaps := range e.collectConfigurations("configmap") {
refName := kubernetes.SanitizeLabel(configmaps["value"])
mountPath := getMountPoint(configmaps["value"], configmaps["resourceMountPoint"], "configmap", configmaps["resourceType"])
vol := getVolume(refName, "configmap", configmaps["value"], configmaps["resourceKey"], configmaps["resourceKey"])
mnt := getMount(refName, mountPath, "", true)
*vols = append(*vols, *vol)
*mnts = append(*mnts, *mnt)
}
//
// Volumes :: Additional Secrets
//
for _, secret := range e.collectConfigurations("secret") {
refName := kubernetes.SanitizeLabel(secret["value"])
mountPath := getMountPoint(secret["value"], secret["resourceMountPoint"], "secret", secret["resourceType"])
vol := getVolume(refName, "secret", secret["value"], secret["resourceKey"], secret["resourceKey"])
mnt := getMount(refName, mountPath, "", true)
*vols = append(*vols, *vol)
*mnts = append(*mnts, *mnt)
}
// append Service Binding secrets
if len(e.ServiceBindingSecret) > 0 {
secret := e.ServiceBindingSecret
refName := kubernetes.SanitizeLabel(secret)
mountPath := path.Join(camel.ServiceBindingsMountPath, strings.ToLower(secret))
vol := getVolume(refName, "secret", secret, "", "")
mnt := getMount(refName, mountPath, "", true)
*vols = append(*vols, *vol)
*mnts = append(*mnts, *mnt)
}
//
// Volumes :: Additional user provided volumes
//
for _, volumeConfig := range e.collectConfigurationValues("volume") {
configParts := strings.Split(volumeConfig, ":")
if len(configParts) != 2 {
continue
}
pvcName := configParts[0]
mountPath := configParts[1]
volumeName := pvcName + "-data"
vol := getVolume(volumeName, "pvc", pvcName, "", "")
mnt := getMount(volumeName, mountPath, "", false)
*vols = append(*vols, *vol)
*mnts = append(*mnts, *mnt)
}
}
func getVolume(volName, storageType, storageName, filterKey, filterValue string) *corev1.Volume {
items := convertToKeyToPath(filterKey, filterValue)
volume := corev1.Volume{
Name: volName,
VolumeSource: corev1.VolumeSource{},
}
switch storageType {
case "configmap":
volume.VolumeSource.ConfigMap = &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: storageName,
},
Items: items,
}
case "secret":
volume.VolumeSource.Secret = &corev1.SecretVolumeSource{
SecretName: storageName,
Items: items,
}
case "pvc":
volume.VolumeSource.PersistentVolumeClaim = &corev1.PersistentVolumeClaimVolumeSource{
ClaimName: storageName,
}
}
return &volume
}
func getMount(volName, mountPath, subPath string, readOnly bool) *corev1.VolumeMount {
mount := corev1.VolumeMount{
Name: volName,
MountPath: mountPath,
ReadOnly: readOnly,
}
if subPath != "" {
mount.SubPath = subPath
}
return &mount
}
func convertToKeyToPath(k, v string) []corev1.KeyToPath {
if k == "" {
return nil
}
kp := []corev1.KeyToPath{
{
Key: k,
Path: v,
},
}
return kp
}
func getResourcePath(resourceName string, maybePath string, resourceType v1.ResourceType) string {
// If the path is specified, we'll return it
if maybePath != "" {
return maybePath
}
// otherwise return a default path, according to the resource type
if resourceType == v1.ResourceTypeData {
return path.Join(camel.ResourcesDefaultMountPath, resourceName)
}
// Default, config type
return path.Join(camel.ConfigResourcesMountPath, resourceName)
}
func getMountPoint(resourceName string, mountPoint string, storagetype, resourceType string) string {
if mountPoint != "" {
return mountPoint
}
if resourceType == "data" {
return path.Join(camel.ResourcesDefaultMountPath, resourceName)
}
defaultMountPoint := camel.ConfigConfigmapsMountPath
if storagetype == "secret" {
defaultMountPoint = camel.ConfigSecretsMountPath
}
return path.Join(defaultMountPoint, resourceName)
}
func (e *Environment) collectConfigurationValues(configurationType string) []string {
return collectConfigurationValues(configurationType, e.Platform, e.IntegrationKit, e.Integration)
}
type variable struct {
Name, Value string
}
func (e *Environment) collectConfigurationPairs(configurationType string) []variable {
return collectConfigurationPairs(configurationType, e.Platform, e.IntegrationKit, e.Integration)
}
func (e *Environment) collectConfigurations(configurationType string) []map[string]string {
return collectConfigurations(configurationType, e.Platform, e.IntegrationKit, e.Integration)
}
func (e *Environment) GetIntegrationContainerName() string {
containerName := defaultContainerName
dt := e.Catalog.GetTrait(containerTraitID)
if dt != nil {
containerName = dt.(*containerTrait).Name
}
return containerName
}
func (e *Environment) GetIntegrationContainer() *corev1.Container {
containerName := e.GetIntegrationContainerName()
return e.Resources.GetContainerByName(containerName)
}
func (e *Environment) getIntegrationContainerPort() *corev1.ContainerPort {
container := e.GetIntegrationContainer()
if container == nil {
return nil
}
portName := ""
t := e.Catalog.GetTrait(containerTraitID)
if t != nil {
portName = t.(*containerTrait).PortName
}
if portName == "" {
portName = defaultContainerPortName
}
for i, port := range container.Ports {
if port.Name == portName {
return &container.Ports[i]
}
}
return nil
}
// nolint: unused
func (e *Environment) getAllInterceptors() []string {
res := make([]string, 0)
util.StringSliceUniqueConcat(&res, e.Interceptors)
if e.Integration != nil {
for _, s := range e.Integration.Sources() {
util.StringSliceUniqueConcat(&res, s.Interceptors)
}
}
return res
}