Skip to content

Commit d44acd2

Browse files
Merge pull request #107 from PDOK/jd/shared-status-update
Jd/shared status update
2 parents 1a27ff9 + 9ec4d38 commit d44acd2

File tree

8 files changed

+19
-117
lines changed

8 files changed

+19
-117
lines changed

api/v3/wfs_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ type WFS struct {
5959
Status smoothoperatormodel.OperatorStatus `json:"status,omitempty"`
6060
}
6161

62+
func (wfs *WFS) OperatorStatus() *smoothoperatormodel.OperatorStatus {
63+
return &wfs.Status
64+
}
65+
6266
// +kubebuilder:object:root=true
6367

6468
// WFSList contains a list of WFS.

api/v3/wms_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ type WMS struct {
6868
Status smoothoperatormodel.OperatorStatus `json:"status,omitempty"`
6969
}
7070

71+
func (wms *WMS) OperatorStatus() *smoothoperatormodel.OperatorStatus {
72+
return &wms.Status
73+
}
74+
7175
// +kubebuilder:object:root=true
7276

7377
// WMSList contains a list of WMS.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/pdok/featureinfo-generator v1.4.0
1414
github.com/pdok/ogc-capabilities-generator v1.0.1
1515
github.com/pdok/ogc-specifications v1.0.0
16-
github.com/pdok/smooth-operator v1.1.1
16+
github.com/pdok/smooth-operator v1.2.0
1717
github.com/peterbourgon/ff v1.7.1
1818
github.com/stretchr/testify v1.10.0
1919
github.com/traefik/traefik/v3 v3.4.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ github.com/pdok/ogc-capabilities-generator v1.0.1 h1:7cKgdcWO4y+M9a2hW8ONhmBxGER
152152
github.com/pdok/ogc-capabilities-generator v1.0.1/go.mod h1:Fnq2i1X3Aufjx/ptQ34c9knw1mDMUAQt0MTBscqX0/M=
153153
github.com/pdok/ogc-specifications v1.0.0 h1:YqVqKwgOrPprTuRcNrFJeUuxSHOIeOSQStBcYJZUGcA=
154154
github.com/pdok/ogc-specifications v1.0.0/go.mod h1:YDngwkwrWOfc5MYnEYseiv97K1Y9bZXlVzwi/8EaIl8=
155-
github.com/pdok/smooth-operator v1.1.1 h1:nKLXYnZooORpBzDwjl69WplVf+2y4pu8j8qVzvepbJU=
156-
github.com/pdok/smooth-operator v1.1.1/go.mod h1:tqr/CDCXZHNzQzQVlSAnCmsPlx9tWAObsj8hg9mSSEU=
155+
github.com/pdok/smooth-operator v1.2.0 h1:KFFNsFzk16IfcHPmHkgJnmbhIIY69k7crhPft3lXih8=
156+
github.com/pdok/smooth-operator v1.2.0/go.mod h1:tqr/CDCXZHNzQzQVlSAnCmsPlx9tWAObsj8hg9mSSEU=
157157
github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys=
158158
github.com/peterbourgon/ff v1.7.1 h1:xt1lxTG+Nr2+tFtysY7abFgPoH3Lug8CwYJMOmJRXhk=
159159
github.com/peterbourgon/ff v1.7.1/go.mod h1:fYI5YA+3RDqQRExmFbHnBjEeWzh9TrS8rnRpEq7XIg0=

internal/controller/reconciler.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ import (
66
"sigs.k8s.io/controller-runtime/pkg/client"
77
)
88

9-
const (
10-
reconciledConditionType = "Reconciled"
11-
reconciledConditionReasonSuccess = "Success"
12-
reconciledConditionReasonError = "Error"
13-
)
14-
159
type Reconciler interface {
1610
*WFSReconciler | *WMSReconciler
1711
client.StatusClient

internal/controller/status.go

Lines changed: 0 additions & 102 deletions
This file was deleted.

internal/controller/wfs_controller.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131

3232
pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
3333
smoothoperatorv1 "github.com/pdok/smooth-operator/api/v1"
34+
smoothoperatorstatus "github.com/pdok/smooth-operator/pkg/status"
3435
apierrors "k8s.io/apimachinery/pkg/api/errors"
3536
"k8s.io/apimachinery/pkg/runtime"
3637
ctrl "sigs.k8s.io/controller-runtime"
@@ -104,7 +105,7 @@ func (r *WFSReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result
104105
defer func() {
105106
if rec := recover(); rec != nil {
106107
err = recoveredPanicToError(rec)
107-
logAndUpdateStatusError(ctx, r, wfs, err)
108+
smoothoperatorstatus.LogAndUpdateStatusError(ctx, r.Client, wfs, err)
108109
}
109110
}()
110111

@@ -121,11 +122,11 @@ func (r *WFSReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result
121122
operationResults, err := createOrUpdateAllForWMSWFS(ctx, r, wfs, ownerInfo)
122123
if err != nil {
123124
lgr.Info("failed creating resources for wfs", "wfs", wfs.Name)
124-
logAndUpdateStatusError(ctx, r, wfs, err)
125+
smoothoperatorstatus.LogAndUpdateStatusError(ctx, r.Client, wfs, err)
125126
return result, err
126127
}
127128
lgr.Info("finished creating resources for wfs", "wfs", wfs.Name)
128-
logAndUpdateStatusFinished(ctx, r, wfs, operationResults)
129+
smoothoperatorstatus.LogAndUpdateStatusFinished(ctx, r.Client, wfs, operationResults)
129130

130131
return result, err
131132
}

internal/controller/wms_controller.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"github.com/pdok/mapserver-operator/internal/controller/legendgenerator"
3434
"github.com/pdok/mapserver-operator/internal/controller/ogcwebserviceproxy"
3535
smoothoperatorv1 "github.com/pdok/smooth-operator/api/v1"
36+
smoothoperatorstatus "github.com/pdok/smooth-operator/pkg/status"
3637
smoothoperatorutils "github.com/pdok/smooth-operator/pkg/util"
3738
corev1 "k8s.io/api/core/v1"
3839
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -115,7 +116,7 @@ func (r *WMSReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result
115116
defer func() {
116117
if rec := recover(); rec != nil {
117118
err = recoveredPanicToError(rec)
118-
logAndUpdateStatusError(ctx, r, wms, err)
119+
smoothoperatorstatus.LogAndUpdateStatusError(ctx, r.Client, wms, err)
119120
}
120121
}()
121122

@@ -132,11 +133,11 @@ func (r *WMSReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result
132133
operationResults, err := createOrUpdateAllForWMSWFS(ctx, r, wms, ownerInfo)
133134
if err != nil {
134135
lgr.Info("failed creating resources for wms", "wms", wms.Name)
135-
logAndUpdateStatusError(ctx, r, wms, err)
136+
smoothoperatorstatus.LogAndUpdateStatusError(ctx, r.Client, wms, err)
136137
return result, err
137138
}
138139
lgr.Info("finished creating resources for wms", "wms", wms.Name)
139-
logAndUpdateStatusFinished(ctx, r, wms, operationResults)
140+
smoothoperatorstatus.LogAndUpdateStatusFinished(ctx, r.Client, wms, operationResults)
140141

141142
return result, err
142143
}

0 commit comments

Comments
 (0)