99 postgresv1 "github.com/amazeeio/dbaas-operator/apis/postgres/v1"
1010 "github.com/uselagoon/build-deploy-tool/internal/collector"
1111 "github.com/uselagoon/build-deploy-tool/internal/generator"
12- "github.com/uselagoon/machinery/api/schema"
1312 appsv1 "k8s.io/api/apps/v1"
1413 corev1 "k8s.io/api/core/v1"
1514)
@@ -26,8 +25,8 @@ func GetCurrentState(c *collector.Collector, gen generator.GeneratorInput) (
2625 error ,
2726) {
2827 lagoonServices := LagoonServices {
29- Services : []schema. EnvironmentService {},
30- Volumes : []schema. EnvironmentVolume {},
28+ Services : []EnvironmentService {},
29+ Volumes : []EnvironmentVolume {},
3130 }
3231 out , currentServices , err := LagoonServiceTemplateIdentification (gen )
3332 if err != nil {
@@ -47,7 +46,7 @@ func GetCurrentState(c *collector.Collector, gen generator.GeneratorInput) (
4746 // add any dbaas that should exist to the current services
4847 for _ , prov := range dbaas {
4948 sp := strings .Split (prov , ":" )
50- currentServices .Services = append (currentServices .Services , schema. EnvironmentService {
49+ currentServices .Services = append (currentServices .Services , EnvironmentService {
5150 Name : sp [0 ],
5251 Type : sp [1 ],
5352 })
@@ -56,7 +55,7 @@ func GetCurrentState(c *collector.Collector, gen generator.GeneratorInput) (
5655 mariadbMatch := false
5756 var mariadbDelete []mariadbv1.MariaDBConsumer
5857 for _ , exist := range state .MariaDBConsumers .Items {
59- service := schema. EnvironmentService {
58+ service := EnvironmentService {
6059 Name : exist .Name ,
6160 Type : "mariadb-dbaas" ,
6261 }
@@ -80,7 +79,7 @@ func GetCurrentState(c *collector.Collector, gen generator.GeneratorInput) (
8079 mongodbMatch := false
8180 var mongodbDelete []mongodbv1.MongoDBConsumer
8281 for _ , exist := range state .MongoDBConsumers .Items {
83- service := schema. EnvironmentService {
82+ service := EnvironmentService {
8483 Name : exist .Name ,
8584 Type : "mongodb-dbaas" ,
8685 }
@@ -104,7 +103,7 @@ func GetCurrentState(c *collector.Collector, gen generator.GeneratorInput) (
104103 postgresqlMatch := false
105104 var postgresqlDelete []postgresv1.PostgreSQLConsumer
106105 for _ , exist := range state .PostgreSQLConsumers .Items {
107- service := schema. EnvironmentService {
106+ service := EnvironmentService {
108107 Name : exist .Name ,
109108 Type : "postgres-dbaas" ,
110109 }
@@ -136,7 +135,7 @@ func GetCurrentState(c *collector.Collector, gen generator.GeneratorInput) (
136135 storeType = "bulk"
137136 }
138137 }
139- kubevol := schema. EnvironmentVolume {
138+ kubevol := EnvironmentVolume {
140139 Name : exist .Name ,
141140 StorageType : storeType ,
142141 Type : exist .Labels ["lagoon.sh/service-type" ],
@@ -174,33 +173,33 @@ func GetCurrentState(c *collector.Collector, gen generator.GeneratorInput) (
174173 depMatch := false
175174 var depDelete []appsv1.Deployment
176175 for _ , exist := range state .Deployments .Items {
177- containers := []schema. ServiceContainer {}
176+ containers := []ServiceContainer {}
178177 for _ , c := range exist .Spec .Template .Spec .Containers {
179- volumes := []schema. VolumeMount {}
178+ volumes := []VolumeMount {}
180179 for _ , v := range c .VolumeMounts {
181180 for _ , vo := range lagoonServices .Volumes {
182181 if vo .Name == v .Name {
183- volumes = append (volumes , schema. VolumeMount {
182+ volumes = append (volumes , VolumeMount {
184183 Name : v .Name ,
185184 Path : v .MountPath ,
186185 })
187186 }
188187 }
189188 }
190- ports := []schema. ContainerPort {}
189+ ports := []ContainerPort {}
191190 for _ , p := range c .Ports {
192- ports = append (ports , schema. ContainerPort {
191+ ports = append (ports , ContainerPort {
193192 Name : p .Name ,
194193 Port : int (p .ContainerPort ),
195194 })
196195 }
197- containers = append (containers , schema. ServiceContainer {
196+ containers = append (containers , ServiceContainer {
198197 Name : c .Name ,
199198 Volumes : volumes ,
200199 Ports : ports ,
201200 })
202201 }
203- service := schema. EnvironmentService {
202+ service := EnvironmentService {
204203 Name : exist .Name ,
205204 Type : exist .Labels ["lagoon.sh/service-type" ],
206205 Containers : containers ,
@@ -234,7 +233,7 @@ func GetCurrentState(c *collector.Collector, gen generator.GeneratorInput) (
234233 return lagoonServices , mariadbDelete , mongodbDelete , postgresqlDelete , depDelete , volDelete , servDelete , state , nil
235234}
236235
237- func serviceExists (services []schema. EnvironmentService , serviceName string ) bool {
236+ func serviceExists (services []EnvironmentService , serviceName string ) bool {
238237 for _ , svc := range services {
239238 if svc .Name == serviceName {
240239 return true
@@ -243,7 +242,7 @@ func serviceExists(services []schema.EnvironmentService, serviceName string) boo
243242 return false
244243}
245244
246- func volumeExists (volumes []schema. EnvironmentVolume , volumeName string ) bool {
245+ func volumeExists (volumes []EnvironmentVolume , volumeName string ) bool {
247246 for _ , vol := range volumes {
248247 if vol .Name == volumeName {
249248 return true
0 commit comments