Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:

- name: Run e2e tests
run: ARTIFACT_PATH=/tmp/artifacts make test-e2e

# To not store pprof
# - uses: actions/upload-artifact@v4
# with:
# name: upgrade-e2e-artifacts
# path: test/e2e/results/**

- uses: actions/upload-artifact@v4
if: failure()
Expand Down
3 changes: 3 additions & 0 deletions cmd/operator-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ var (

type config struct {
metricsAddr string
pprofAddr string
certFile string
keyFile string
enableLeaderElection bool
Expand Down Expand Up @@ -131,6 +132,7 @@ func init() {
//create flagset, the collection of flags for this command
flags := operatorControllerCmd.Flags()
flags.StringVar(&cfg.metricsAddr, "metrics-bind-address", "", "The address for the metrics endpoint. Requires tls-cert and tls-key. (Default: ':8443')")
flags.StringVar(&cfg.pprofAddr, "pprof-bind-address", "0", "The address the pprof endpoint binds to. an empty string or 0 disables pprof")
flags.StringVar(&cfg.probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flags.StringVar(&cfg.catalogdCasDir, "catalogd-cas-dir", "", "The directory of TLS certificate authorities to use for verifying HTTPS connections to the Catalogd web service.")
flags.StringVar(&cfg.pullCasDir, "pull-cas-dir", "", "The directory of TLS certificate authorities to use for verifying HTTPS connections to image registries.")
Expand Down Expand Up @@ -265,6 +267,7 @@ func run() error {
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme.Scheme,
Metrics: metricsServerOptions,
PprofBindAddress: cfg.pprofAddr,
HealthProbeBindAddress: cfg.probeAddr,
LeaderElection: cfg.enableLeaderElection,
LeaderElectionID: "9c4404e7.operatorframework.io",
Expand Down
3 changes: 3 additions & 0 deletions config/base/catalogd/manager/catalogd_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ spec:
protocol: TCP
port: 80
targetPort: 8443
- name: pprof
port: 8083
targetPort: 8083
- name: webhook
protocol: TCP
port: 9443
Expand Down
1 change: 1 addition & 0 deletions config/base/catalogd/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ spec:
- ./catalogd
args:
- --leader-elect
- --pprof-bind-address=:8083
- --metrics-bind-address=:7443
- --external-address=catalogd-service.olmv1-system.svc
image: controller:latest
Expand Down
1 change: 1 addition & 0 deletions config/base/operator-controller/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ spec:
- /operator-controller
args:
- "--health-probe-bind-address=:8081"
- "--pprof-bind-address=:8082"
- "--metrics-bind-address=:8443"
- "--leader-elect"
image: controller:latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func (r *ClusterCatalogReconciler) SetupWithManager(mgr ctrl.Manager) error {

return ctrl.NewControllerManagedBy(mgr).
For(&ocv1.ClusterCatalog{}).
Named("catalogd-clustercatalog-controller").
Complete(r)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func (r *PullSecretReconciler) Reconcile(ctx context.Context, req ctrl.Request)
func (r *PullSecretReconciler) SetupWithManager(mgr ctrl.Manager) error {
_, err := ctrl.NewControllerManagedBy(mgr).
For(&corev1.Secret{}).
Named("catalogd-pull-secret-controller").
WithEventFilter(newSecretPredicate(r.SecretKey)).
Build(r)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func (r *ClusterCatalogReconciler) Reconcile(ctx context.Context, req ctrl.Reque
// SetupWithManager sets up the controller with the Manager.
func (r *ClusterCatalogReconciler) SetupWithManager(mgr ctrl.Manager) error {
_, err := ctrl.NewControllerManagedBy(mgr).
Named("con-oper-clustercatalog-controller").
For(&ocv1.ClusterCatalog{}).
Build(r)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ func SetDeprecationStatus(ext *ocv1.ClusterExtension, bundleName string, depreca
func (r *ClusterExtensionReconciler) SetupWithManager(mgr ctrl.Manager) error {
controller, err := ctrl.NewControllerManagedBy(mgr).
For(&ocv1.ClusterExtension{}).
Named("con-oper-cluster-extension-controller").
Watches(&ocv1.ClusterCatalog{},
crhandler.EnqueueRequestsFromMapFunc(clusterExtensionRequestsForCatalog(mgr.GetClient(), mgr.GetLogger())),
builder.WithPredicates(predicate.Funcs{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (r *PullSecretReconciler) Reconcile(ctx context.Context, req ctrl.Request)
// SetupWithManager sets up the controller with the Manager.
func (r *PullSecretReconciler) SetupWithManager(mgr ctrl.Manager) error {
_, err := ctrl.NewControllerManagedBy(mgr).
Named("con-oper-pull-secret-controller").
For(&corev1.Secret{}).
WithEventFilter(newSecretPredicate(r.SecretKey)).
Build(r)
Expand Down
31 changes: 31 additions & 0 deletions test/e2e/cluster_extension_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ func TestClusterExtensionInstallRegistry(t *testing.T) {
assert.NotEmpty(ct, clusterExtension.Status.Install.Bundle)
}
}, pollDuration, pollInterval)

// For this case we cannot get the metrics
//FetchCatalogdMetricsExportedEndpoint(t)
//FetchOperatorControllerMetricsExportedEndpoint(t)
})
}
}
Expand Down Expand Up @@ -455,6 +459,9 @@ location = "docker-registry.operator-controller-e2e.svc.cluster.local:5000"`,
assert.NotEmpty(ct, clusterExtension.Status.Install.Bundle)
}
}, pollDuration, pollInterval)

FetchCatalogdMetricsExportedEndpoint(t)
FetchOperatorControllerMetricsExportedEndpoint(t)
}

func TestClusterExtensionInstallRegistryMultipleBundles(t *testing.T) {
Expand Down Expand Up @@ -505,6 +512,9 @@ func TestClusterExtensionInstallRegistryMultipleBundles(t *testing.T) {
assert.Contains(ct, cond.Message, "in multiple catalogs with the same priority [extra-test-catalog test-catalog]")
}
}, pollDuration, pollInterval)

FetchCatalogdMetricsExportedEndpoint(t)
FetchOperatorControllerMetricsExportedEndpoint(t)
}

func TestClusterExtensionBlockInstallNonSuccessorVersion(t *testing.T) {
Expand Down Expand Up @@ -568,6 +578,9 @@ func TestClusterExtensionBlockInstallNonSuccessorVersion(t *testing.T) {
assert.Equal(ct, "error upgrading from currently installed version \"1.0.0\": no bundles found for package \"test\" matching version \"1.2.0\"", cond.Message)
}
}, pollDuration, pollInterval)

FetchCatalogdMetricsExportedEndpoint(t)
FetchOperatorControllerMetricsExportedEndpoint(t)
}

func TestClusterExtensionForceInstallNonSuccessorVersion(t *testing.T) {
Expand Down Expand Up @@ -618,6 +631,9 @@ func TestClusterExtensionForceInstallNonSuccessorVersion(t *testing.T) {
assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason)
}
}, pollDuration, pollInterval)

FetchCatalogdMetricsExportedEndpoint(t)
FetchOperatorControllerMetricsExportedEndpoint(t)
}

func TestClusterExtensionInstallSuccessorVersion(t *testing.T) {
Expand Down Expand Up @@ -666,6 +682,9 @@ func TestClusterExtensionInstallSuccessorVersion(t *testing.T) {
assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason)
}
}, pollDuration, pollInterval)

FetchCatalogdMetricsExportedEndpoint(t)
FetchOperatorControllerMetricsExportedEndpoint(t)
}

func TestClusterExtensionInstallReResolvesWhenCatalogIsPatched(t *testing.T) {
Expand Down Expand Up @@ -733,6 +752,9 @@ func TestClusterExtensionInstallReResolvesWhenCatalogIsPatched(t *testing.T) {
assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason)
}
}, pollDuration, pollInterval)

FetchCatalogdMetricsExportedEndpoint(t)
FetchOperatorControllerMetricsExportedEndpoint(t)
}

func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) {
Expand Down Expand Up @@ -814,6 +836,9 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) {
assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason)
}
}, pollDuration, pollInterval)

FetchCatalogdMetricsExportedEndpoint(t)
FetchOperatorControllerMetricsExportedEndpoint(t)
}

func TestClusterExtensionInstallReResolvesWhenManagedContentChanged(t *testing.T) {
Expand Down Expand Up @@ -866,6 +891,9 @@ func TestClusterExtensionInstallReResolvesWhenManagedContentChanged(t *testing.T
require.EventuallyWithT(t, func(ct *assert.CollectT) {
assert.NoError(ct, globalClient.Get(context.Background(), types.NamespacedName{Name: testConfigMap.Name, Namespace: testConfigMap.Namespace}, testConfigMap))
}, pollDuration, pollInterval)

FetchCatalogdMetricsExportedEndpoint(t)
FetchOperatorControllerMetricsExportedEndpoint(t)
}

func TestClusterExtensionRecoversFromInitialInstallFailedWhenFailureFixed(t *testing.T) {
Expand Down Expand Up @@ -959,4 +987,7 @@ func TestClusterExtensionRecoversFromInitialInstallFailedWhenFailureFixed(t *tes
assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason)
}
}, pollDuration, pollInterval)

FetchCatalogdMetricsExportedEndpoint(t)
FetchOperatorControllerMetricsExportedEndpoint(t)
}
Loading
Loading