@@ -29,14 +29,6 @@ const (
29
29
ListenPortHealthName = "health"
30
30
)
31
31
32
- type Integration interface {
33
- Name () []string
34
- Envs () ([]core.EnvVar , error )
35
- GlobalEnvs () ([]core.EnvVar , error )
36
- Volumes () ([]core.Volume , []core.VolumeMount , error )
37
- Validate () error
38
- }
39
-
40
32
func NewShutdownAnnotations (coreContainers []string ) * schedulerApi.ProfileTemplate {
41
33
pt := schedulerApi.ProfileTemplate {
42
34
Pod : & schedulerPodApi.Pod {
@@ -57,6 +49,7 @@ func NewIntegrationEnablement(integrations ...Integration) (*schedulerApi.Profil
57
49
var envs , gEnvs []core.EnvVar
58
50
var volumes []core.Volume
59
51
var volumeMounts []core.VolumeMount
52
+ var annotations = map [string ]string {}
60
53
61
54
for _ , integration := range integrations {
62
55
name := strings .Join (integration .Name (), "/" )
@@ -72,6 +65,14 @@ func NewIntegrationEnablement(integrations ...Integration) (*schedulerApi.Profil
72
65
volumeMounts = append (volumeMounts , lvolumeMounts ... )
73
66
}
74
67
68
+ if anns , err := getIntegrationAnnotations (integration ); err != nil {
69
+ return nil , errors .Wrapf (err , "Failure in annotations %s" , name )
70
+ } else {
71
+ for k , v := range anns {
72
+ annotations [k ] = v
73
+ }
74
+ }
75
+
75
76
if lenvs , err := integration .Envs (); err != nil {
76
77
return nil , errors .Wrapf (err , "Failure in envs %s" , name )
77
78
} else if len (lenvs ) > 0 {
@@ -92,6 +93,9 @@ func NewIntegrationEnablement(integrations ...Integration) (*schedulerApi.Profil
92
93
return & schedulerApi.ProfileTemplate {
93
94
Priority : util .NewType (127 ),
94
95
Pod : & schedulerPodApi.Pod {
96
+ Metadata : & schedulerPodResourcesApi.Metadata {
97
+ Annotations : annotations ,
98
+ },
95
99
Volumes : & schedulerPodResourcesApi.Volumes {
96
100
Volumes : volumes ,
97
101
},
@@ -205,9 +209,6 @@ func NewIntegration(image *schedulerContainerResourcesApi.Image, integration *sc
205
209
},
206
210
}
207
211
208
- pt .Pod .Metadata .Annotations [fmt .Sprintf ("%s/%s" , constants .AnnotationShutdownContainer , ContainerName )] = ListenPortHealthName
209
- pt .Pod .Metadata .Annotations [constants .AnnotationShutdownManagedContainer ] = "true"
210
-
211
212
pt .Container .All .Environments = & schedulerContainerResourcesApi.Environments {
212
213
Env : envs ,
213
214
}
0 commit comments