Skip to content

Commit b951a31

Browse files
Remove registration and check for upgrades
1 parent af9b10a commit b951a31

File tree

22 files changed

+15
-2603
lines changed

22 files changed

+15
-2603
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ deploy-dev: createnamespaces
134134
QUERIES_CONFIG_DIR="${QUERIES_CONFIG_DIR}" \
135135
CRUNCHY_DEBUG=true \
136136
PGO_FEATURE_GATES="${PGO_FEATURE_GATES}" \
137-
CHECK_FOR_UPGRADES='$(if $(CHECK_FOR_UPGRADES),$(CHECK_FOR_UPGRADES),false)' \
138137
KUBECONFIG=hack/.kube/postgres-operator/pgo \
139138
PGO_NAMESPACE='postgres-operator' \
140139
PGO_INSTALLER='deploy-dev' \

cmd/postgres-operator/main.go

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ import (
3030
"github.com/crunchydata/postgres-operator/internal/initialize"
3131
"github.com/crunchydata/postgres-operator/internal/logging"
3232
"github.com/crunchydata/postgres-operator/internal/naming"
33-
"github.com/crunchydata/postgres-operator/internal/registration"
34-
"github.com/crunchydata/postgres-operator/internal/upgradecheck"
3533
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
3634
)
3735

@@ -121,7 +119,7 @@ func initManager() (runtime.Options, error) {
121119

122120
func main() {
123121
// This context is canceled by SIGINT, SIGTERM, or by calling shutdown.
124-
ctx, shutdown := context.WithCancel(runtime.SignalHandler())
122+
ctx := runtime.SignalHandler()
125123

126124
otelFlush, err := initOpenTelemetry()
127125
assertNoError(err)
@@ -171,13 +169,8 @@ func main() {
171169
log.Info("detected OpenShift environment")
172170
}
173171

174-
registrar, err := registration.NewRunner(os.Getenv("RSA_KEY"), os.Getenv("TOKEN_PATH"), shutdown)
175-
assertNoError(err)
176-
assertNoError(mgr.Add(registrar))
177-
token, _ := registrar.CheckToken()
178-
179172
// add all PostgreSQL Operator controllers to the runtime manager
180-
addControllersToManager(mgr, openshift, log, registrar)
173+
addControllersToManager(mgr, openshift, log)
181174

182175
if features.Enabled(feature.BridgeIdentifiers) {
183176
constructor := func() *bridge.Client {
@@ -189,23 +182,6 @@ func main() {
189182
assertNoError(bridge.ManagedInstallationReconciler(mgr, constructor))
190183
}
191184

192-
// Enable upgrade checking
193-
upgradeCheckingDisabled := strings.EqualFold(os.Getenv("CHECK_FOR_UPGRADES"), "false")
194-
if !upgradeCheckingDisabled {
195-
log.Info("upgrade checking enabled")
196-
// get the URL for the check for upgrades endpoint if set in the env
197-
assertNoError(
198-
upgradecheck.ManagedScheduler(
199-
mgr,
200-
openshift,
201-
os.Getenv("CHECK_FOR_UPGRADES_URL"),
202-
versionString,
203-
token,
204-
))
205-
} else {
206-
log.Info("upgrade checking disabled")
207-
}
208-
209185
// Enable health probes
210186
assertNoError(mgr.AddHealthzCheck("health", healthz.Ping))
211187
assertNoError(mgr.AddReadyzCheck("check", healthz.Ping))
@@ -218,14 +194,13 @@ func main() {
218194

219195
// addControllersToManager adds all PostgreSQL Operator controllers to the provided controller
220196
// runtime manager.
221-
func addControllersToManager(mgr runtime.Manager, openshift bool, log logging.Logger, reg registration.Registration) {
197+
func addControllersToManager(mgr runtime.Manager, openshift bool, log logging.Logger) {
222198
pgReconciler := &postgrescluster.Reconciler{
223-
Client: mgr.GetClient(),
224-
IsOpenShift: openshift,
225-
Owner: postgrescluster.ControllerName,
226-
Recorder: mgr.GetEventRecorderFor(postgrescluster.ControllerName),
227-
Registration: reg,
228-
Tracer: otel.Tracer(postgrescluster.ControllerName),
199+
Client: mgr.GetClient(),
200+
IsOpenShift: openshift,
201+
Owner: postgrescluster.ControllerName,
202+
Recorder: mgr.GetEventRecorderFor(postgrescluster.ControllerName),
203+
Tracer: otel.Tracer(postgrescluster.ControllerName),
229204
}
230205

231206
if err := pgReconciler.SetupWithManager(mgr); err != nil {
@@ -234,10 +209,9 @@ func addControllersToManager(mgr runtime.Manager, openshift bool, log logging.Lo
234209
}
235210

236211
upgradeReconciler := &pgupgrade.PGUpgradeReconciler{
237-
Client: mgr.GetClient(),
238-
Owner: "pgupgrade-controller",
239-
Recorder: mgr.GetEventRecorderFor("pgupgrade-controller"),
240-
Registration: reg,
212+
Client: mgr.GetClient(),
213+
Owner: "pgupgrade-controller",
214+
Recorder: mgr.GetEventRecorderFor("pgupgrade-controller"),
241215
}
242216

243217
if err := upgradeReconciler.SetupWithManager(mgr); err != nil {

config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17233,11 +17233,6 @@ spec:
1723317233
type: integer
1723417234
type: object
1723517235
type: object
17236-
registrationRequired:
17237-
properties:
17238-
pgoVersion:
17239-
type: string
17240-
type: object
1724117236
startupInstance:
1724217237
description: |-
1724317238
The instance that should be started first when bootstrapping and/or starting a
@@ -17246,8 +17241,6 @@ spec:
1724617241
startupInstanceSet:
1724717242
description: The instance set associated with the startupInstance
1724817243
type: string
17249-
tokenRequired:
17250-
type: string
1725117244
userInterface:
1725217245
description: Current state of the PostgreSQL user interface.
1725317246
properties:

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ go 1.23.0
44

55
require (
66
github.com/go-logr/logr v1.4.2
7-
github.com/golang-jwt/jwt/v5 v5.2.2
87
github.com/google/go-cmp v0.6.0
9-
github.com/google/uuid v1.6.0
108
github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0
119
github.com/onsi/ginkgo/v2 v2.17.2
1210
github.com/onsi/gomega v1.33.1
@@ -53,6 +51,7 @@ require (
5351
github.com/google/gnostic-models v0.6.8 // indirect
5452
github.com/google/gofuzz v1.2.0 // indirect
5553
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
54+
github.com/google/uuid v1.6.0 // indirect
5655
github.com/gorilla/websocket v1.5.0 // indirect
5756
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
5857
github.com/imdario/mergo v0.3.16 // indirect

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v
3838
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
3939
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
4040
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
41-
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
42-
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
4341
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
4442
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
4543
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=

internal/controller/pgupgrade/pgupgrade_controller.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222

2323
"github.com/crunchydata/postgres-operator/internal/config"
2424
"github.com/crunchydata/postgres-operator/internal/controller/runtime"
25-
"github.com/crunchydata/postgres-operator/internal/registration"
2625
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2726
)
2827

@@ -35,8 +34,7 @@ type PGUpgradeReconciler struct {
3534
Client client.Client
3635
Owner client.FieldOwner
3736

38-
Recorder record.EventRecorder
39-
Registration registration.Registration
37+
Recorder record.EventRecorder
4038
}
4139

4240
//+kubebuilder:rbac:groups="batch",resources="jobs",verbs={list,watch}
@@ -165,10 +163,6 @@ func (r *PGUpgradeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
165163
return
166164
}
167165

168-
if !r.UpgradeAuthorized(upgrade) {
169-
return ctrl.Result{}, nil
170-
}
171-
172166
// Set progressing condition to true if it doesn't exist already
173167
setStatusToProgressingIfReasonWas("", upgrade)
174168

internal/controller/pgupgrade/registration.go

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

internal/controller/pgupgrade/registration_test.go

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

internal/controller/postgrescluster/controller.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import (
4040
"github.com/crunchydata/postgres-operator/internal/pgmonitor"
4141
"github.com/crunchydata/postgres-operator/internal/pki"
4242
"github.com/crunchydata/postgres-operator/internal/postgres"
43-
"github.com/crunchydata/postgres-operator/internal/registration"
4443
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
4544
)
4645

@@ -59,9 +58,8 @@ type Reconciler struct {
5958
ctx context.Context, namespace, pod, container string,
6059
stdin io.Reader, stdout, stderr io.Writer, command ...string,
6160
) error
62-
Recorder record.EventRecorder
63-
Registration registration.Registration
64-
Tracer trace.Tracer
61+
Recorder record.EventRecorder
62+
Tracer trace.Tracer
6563
}
6664

6765
// +kubebuilder:rbac:groups="",resources="events",verbs={create,patch}
@@ -195,12 +193,6 @@ func (r *Reconciler) Reconcile(
195193
return nil
196194
}
197195

198-
if r.Registration != nil && r.Registration.Required(r.Recorder, cluster, &cluster.Status.Conditions) {
199-
registration.SetAdvanceWarning(r.Recorder, cluster, &cluster.Status.Conditions)
200-
}
201-
cluster.Status.RegistrationRequired = nil
202-
cluster.Status.TokenRequired = ""
203-
204196
// if the cluster is paused, set a condition and return
205197
if cluster.Spec.Paused != nil && *cluster.Spec.Paused {
206198
meta.SetStatusCondition(&cluster.Status.Conditions, metav1.Condition{

0 commit comments

Comments
 (0)