Skip to content

Commit

Permalink
Remove unnecessary controller constants
Browse files Browse the repository at this point in the history
Removing ID transaction also highlights controllers which still needed
to be updated to use merge for status ID.
  • Loading branch information
mdbooth committed Dec 20, 2024
1 parent 2867a61 commit b52cfe0
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 38 deletions.
6 changes: 0 additions & 6 deletions internal/controllers/flavor/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@ import (
)

const (
Finalizer = "openstack.k-orc.cloud/flavor"

FieldOwner = "openstack.k-orc.cloud/flavorcontroller"
// Field owner of the object finalizer.
SSAFinalizerTxn = "finalizer"
// Field owner of transient status.
SSAStatusTxn = "status"
// Field owner of persistent id field.
SSAIDTxn = "id"
)

// ssaFieldOwner returns the field owner for a specific named SSA transaction.
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/flavor/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (r *orcFlavorReconciler) setStatusID(ctx context.Context, obj client.Object
WithStatus(orcapplyconfigv1alpha1.FlavorStatus().
WithID(id))

return r.client.Status().Patch(ctx, obj, applyconfigs.Patch(types.ApplyPatchType, applyConfig), client.ForceOwnership, ssaFieldOwner(SSAIDTxn))
return r.client.Status().Patch(ctx, obj, applyconfigs.Patch(types.MergePatchType, applyConfig))
}

type updateStatusOpts struct {
Expand Down
4 changes: 0 additions & 4 deletions internal/controllers/image/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ import (
)

const (
Finalizer = "openstack.k-orc.cloud/image"

FieldOwner = "openstack.k-orc.cloud/imagecontroller"
// Field owner of the object finalizer.
SSAFinalizerTxn = "finalizer"
// Field owner of transient status.
SSAStatusTxn = "status"
)
Expand Down
6 changes: 0 additions & 6 deletions internal/controllers/network/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@ import (
)

const (
Finalizer = "openstack.k-orc.cloud/network"

FieldOwner = "openstack.k-orc.cloud/networkcontroller"
// Field owner of the object finalizer.
SSAFinalizerTxn = "finalizer"
// Field owner of transient status.
SSAStatusTxn = "status"
// Field owner of persistent id field.
SSAIDTxn = "id"
)

// ssaFieldOwner returns the field owner for a specific named SSA transaction.
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/network/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (r *orcNetworkReconciler) setStatusID(ctx context.Context, obj client.Objec
WithStatus(orcapplyconfigv1alpha1.NetworkStatus().
WithID(id))

return r.client.Status().Patch(ctx, obj, applyconfigs.Patch(types.ApplyPatchType, applyConfig), client.ForceOwnership, ssaFieldOwner(SSAIDTxn))
return r.client.Status().Patch(ctx, obj, applyconfigs.Patch(types.MergePatchType, applyConfig))
}

type updateStatusOpts struct {
Expand Down
4 changes: 0 additions & 4 deletions internal/controllers/port/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,8 @@ const (
Finalizer = "openstack.k-orc.cloud/port"

FieldOwner = "openstack.k-orc.cloud/portcontroller"
// Field owner of the object finalizer.
SSAFinalizerTxn = "finalizer"
// Field owner of transient status.
SSAStatusTxn = "status"
// Field owner of persistent id field.
SSAIDTxn = "id"
)

// ssaFieldOwner returns the field owner for a specific named SSA transaction.
Expand Down
2 changes: 0 additions & 2 deletions internal/controllers/router/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ const (
Finalizer = "openstack.k-orc.cloud/router"

FieldOwner = "openstack.k-orc.cloud/routercontroller"
// Field owner of the object finalizer.
SSAFinalizerTxn = "finalizer"
// Field owner of transient status.
SSAStatusTxn = "status"
)
Expand Down
4 changes: 0 additions & 4 deletions internal/controllers/securitygroup/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ import (
)

const (
Finalizer = "openstack.k-orc.cloud/securitygroup"

FieldOwner = "openstack.k-orc.cloud/securitygroupcontroller"
// Field owner of the object finalizer.
SSAFinalizerTxn = "finalizer"
// Field owner of transient status.
SSAStatusTxn = "status"
)
Expand Down
4 changes: 0 additions & 4 deletions internal/controllers/server/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ const (
Finalizer = "openstack.k-orc.cloud/server"

FieldOwner = "openstack.k-orc.cloud/servercontroller"
// Field owner of the object finalizer.
SSAFinalizerTxn = "finalizer"
// Field owner of transient status.
SSAStatusTxn = "status"
// Field owner of persistent id field.
SSAIDTxn = "id"
)

// ssaFieldOwner returns the field owner for a specific named SSA transaction.
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/server/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (r *orcServerReconciler) setStatusID(ctx context.Context, obj client.Object
WithStatus(applyconfigv1alpha1.ServerStatus().
WithID(id))

return r.client.Status().Patch(ctx, obj, applyconfigs.Patch(types.ApplyPatchType, applyConfig), client.ForceOwnership, ssaFieldOwner(SSAIDTxn))
return r.client.Status().Patch(ctx, obj, applyconfigs.Patch(types.MergePatchType, applyConfig))
}

type updateStatusOpts struct {
Expand Down
4 changes: 0 additions & 4 deletions internal/controllers/subnet/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,8 @@ const (
Finalizer = "openstack.k-orc.cloud/subnet"

FieldOwner = "openstack.k-orc.cloud/subnetcontroller"
// Field owner of the object finalizer.
SSAFinalizerTxn = "finalizer"
// Field owner of transient status.
SSAStatusTxn = "status"
// Field owner of persistent id field.
SSAIDTxn = "id"
)

// ssaFieldOwner returns the field owner for a specific named SSA transaction.
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/subnet/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (r *orcSubnetReconciler) setStatusID(ctx context.Context, obj client.Object
WithStatus(orcapplyconfigv1alpha1.SubnetStatus().
WithID(id))

return r.client.Status().Patch(ctx, obj, applyconfigs.Patch(types.ApplyPatchType, applyConfig), client.ForceOwnership, ssaFieldOwner(SSAIDTxn))
return r.client.Status().Patch(ctx, obj, applyconfigs.Patch(types.MergePatchType, applyConfig))
}

type updateStatusOpts struct {
Expand Down

0 comments on commit b52cfe0

Please sign in to comment.