@@ -123,11 +123,13 @@ func packageInstallRunInstallRelease(cmd *cobra.Command, h executor.Handler, cli
123123 return errors .Errorf ("Chart %s is not ready" , name )
124124 }
125125
126- if _ , err := client .Arango ().PlatformV1alpha1 ().ArangoPlatformServices (deployment .GetNamespace ()).Get (ctx , name , meta.GetOptions {}); err != nil {
126+ if svc , err := client .Arango ().PlatformV1alpha1 ().ArangoPlatformServices (deployment .GetNamespace ()).Get (ctx , name , meta.GetOptions {}); err != nil {
127127 if ! kerrors .IsNotFound (err ) {
128128 return err
129129 }
130130
131+ logger .Debug ("Installing Service: %s" , name )
132+
131133 // Prepare Object
132134 if _ , err := client .Arango ().PlatformV1alpha1 ().ArangoPlatformServices (deployment .GetNamespace ()).Create (ctx , & platformApi.ArangoPlatformService {
133135 ObjectMeta : meta.ObjectMeta {
@@ -147,31 +149,32 @@ func packageInstallRunInstallRelease(cmd *cobra.Command, h executor.Handler, cli
147149 }, meta.CreateOptions {}); err != nil {
148150 return err
149151 }
150- }
151152
152- // Prepare for update
153- svc , err := client . Arango (). PlatformV1alpha1 (). ArangoPlatformServices ( deployment . GetNamespace ()). Get ( ctx , name , meta. GetOptions {})
154- if err != nil {
155- return err
156- }
153+ logger . Info ( "Installed Service: %s" , name )
154+ } else {
155+ if svc . Spec . Deployment . GetName () != deployment . GetName () {
156+ return errors . Errorf ( "Unable to change Deployment name for %s" , name )
157+ }
157158
158- if svc .Spec .Deployment .GetName () != deployment .GetName () {
159- return errors .Errorf ("Unable to change Deployment name for %s" , name )
160- }
159+ if svc .Spec .Chart .GetName () != chart .GetName () {
160+ return errors .Errorf ("Unable to change Chart name for %s" , name )
161+ }
161162
162- if ! svc .Spec .Values .Equals (sharedApi .Any (packageSpec .Overrides )) {
163- svc .Spec .Values = sharedApi .Any (packageSpec .Overrides )
164- _ , err := client .Arango ().PlatformV1alpha1 ().ArangoPlatformServices (deployment .GetNamespace ()).Update (ctx , svc , meta.UpdateOptions {})
165- if err != nil {
166- return err
163+ if ! svc .Spec .Values .Equals (sharedApi .Any (packageSpec .Overrides )) {
164+ svc .Spec .Values = sharedApi .Any (packageSpec .Overrides )
165+ _ , err := client .Arango ().PlatformV1alpha1 ().ArangoPlatformServices (deployment .GetNamespace ()).Update (ctx , svc , meta.UpdateOptions {})
166+ if err != nil {
167+ return err
168+ }
169+ logger .Info ("Updated Service: %s" , name )
167170 }
168171 }
169172
170173 // Ensure we wait for reconcile
171174 time .Sleep (time .Second )
172175
173- return h .Timeout (ctx , t , func (ctx context.Context , log logging.Logger , t executor.Thread , h executor.Handler ) error {
174- svc , err := client .Arango ().PlatformV1alpha1 ().ArangoPlatformServices (svc .GetNamespace ()).Get (ctx , svc . GetName () , meta.GetOptions {})
176+ if err := h .Timeout (ctx , t , func (ctx context.Context , log logging.Logger , t executor.Thread , h executor.Handler ) error {
177+ svc , err := client .Arango ().PlatformV1alpha1 ().ArangoPlatformServices (deployment .GetNamespace ()).Get (ctx , name , meta.GetOptions {})
175178 if err != nil {
176179 return err
177180 }
@@ -189,7 +192,15 @@ func packageInstallRunInstallRelease(cmd *cobra.Command, h executor.Handler, cli
189192 }
190193
191194 return io .EOF
192- }, 5 * time .Minute , time .Second )
195+ }, 5 * time .Minute , time .Second ); err != nil {
196+ if errors .Is (err , io .EOF ) {
197+ return errors .Errorf ("Service %s is not ready" , name )
198+ }
199+
200+ return err
201+ }
202+
203+ return nil
193204 })
194205}
195206
@@ -247,7 +258,7 @@ func packageInstallRunInstallChart(cmd *cobra.Command, h executor.Handler, clien
247258 }
248259 }
249260
250- return h .Timeout (ctx , t , func (ctx context.Context , log logging.Logger , t executor.Thread , h executor.Handler ) error {
261+ if err := h .Timeout (ctx , t , func (ctx context.Context , log logging.Logger , t executor.Thread , h executor.Handler ) error {
251262 c , err := client .Arango ().PlatformV1alpha1 ().ArangoPlatformCharts (ns ).Get (ctx , name , meta.GetOptions {})
252263 if err != nil {
253264 return err
@@ -262,7 +273,15 @@ func packageInstallRunInstallChart(cmd *cobra.Command, h executor.Handler, clien
262273 }
263274
264275 return io .EOF
265- }, 5 * time .Minute , time .Second )
276+ }, 5 * time .Minute , time .Second ); err != nil {
277+ if errors .Is (err , io .EOF ) {
278+ return errors .Errorf ("Chart %s is not ready" , name )
279+ }
280+
281+ return err
282+ }
283+
284+ return nil
266285 })
267286}
268287
0 commit comments