tchughesiv commented on code in PR #345:
URL:
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/345#discussion_r1457747459
##########
controllers/platform/k8s.go:
##########
@@ -62,15 +61,19 @@ func (action *serviceAction) Handle(ctx context.Context,
platform *operatorapi.S
return nil, err
}
- if platform.Spec.Services.DataIndex != nil {
- if err := createServiceComponents(ctx, action.client, platform,
services.NewDataIndexService(platform)); err != nil {
- return nil, err
+ if platform.Spec.Services != nil {
+ psDI := services.NewDataIndexService(platform)
+ if psDI.IsServiceSetInSpec() {
+ if err := createServiceComponents(ctx, action.client,
platform, psDI); err != nil {
+ return nil, err
+ }
}
- }
- if platform.Spec.Services.JobService != nil {
- if err := createServiceComponents(ctx, action.client, platform,
services.NewJobService(platform)); err != nil {
- return nil, err
+ psJS := services.NewJobService(platform)
+ if psJS.IsServiceSetInSpec() {
+ if err := createServiceComponents(ctx, action.client,
platform, psJS); err != nil {
Review Comment:
i'm not changing anything wrt service creation/updates. The same logic
applies here. if a deployment already exists, yes, it will update the existing
one. this is done using the `controllerutil.CreateOrUpdate` function, as seen
here -
https://github.com/apache/incubator-kie-kogito-serverless-operator/blob/add4de1acd82875206bb4de88fb2055122645d99/controllers/platform/k8s.go#L184-L185
the same is done for k8s services and configmaps. that said, maybe it would
be clearer if we renamed the `createServiceComponents` function to
`createOrUpdateServiceComponents`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]