Skip to content
Draft
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
3 changes: 3 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ spec:
- --oidc-client-secret=$(OIDC_CLIENT_SECRET)
- --oidc-issuer-url=$(OIDC_ISSUER_URL)
- --only-public-clusters=$(ONLY_PUBLIC_CLUSTERS)
- --skip-infrastructure-health-check=$(SKIP_INFRASTRUCTURE_HEALTH_CHECK)
env:
- name: LOG_LEVEL
# level 1 is debug, so when we want to raise the level we can
Expand All @@ -70,6 +71,8 @@ spec:
value: "" # Default to empty - can be overridden in app-interface
- name: ONLY_PUBLIC_CLUSTERS
value: "false" # Default to false - can be overridden in app-interface
- name: SKIP_INFRASTRUCTURE_HEALTH_CHECK
value: "false" # Default to false - can be overridden in app-interface
image: controller:latest
name: manager
securityContext:
Expand Down
14 changes: 12 additions & 2 deletions controllers/hostedcontrolplane/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ const (
// HCP namespace, and this process will be restarted. Additionally, should healthchecking need to be skipped for any reason, the annotation
// "routemonitor.managed.openshift.io/successful-healthchecks" can be added-to/edited-on the configmap with a large number (ie - 999) to bypass
// this functionality
func (r *HostedControlPlaneReconciler) hcpReady(ctx context.Context, hostedcontrolplane *hypershiftv1beta1.HostedControlPlane) (bool, error) {
func (r *HostedControlPlaneReconciler) hcpReady(ctx context.Context, hostedcontrolplane *hypershiftv1beta1.HostedControlPlane, cfg RHOBSConfig) (bool, error) {
// Skip health check for test environments (e.g., osde2e tests without real kube-apiserver)
if cfg.SkipInfrastructureHealthCheck {
return true, nil
}

if olderThan(hostedcontrolplane, hcpHealthCheckSkipAge) {
return true, nil
}
Expand Down Expand Up @@ -227,7 +232,12 @@ func olderThan(obj metav1.Object, age time.Duration) bool {
}

// isVpcEndpointReady checks if the VPC Endpoint associated with the HostedControlPlane is ready.
func (r *HostedControlPlaneReconciler) isVpcEndpointReady(ctx context.Context, hostedcontrolplane *hypershiftv1beta1.HostedControlPlane) (bool, error) {
func (r *HostedControlPlaneReconciler) isVpcEndpointReady(ctx context.Context, hostedcontrolplane *hypershiftv1beta1.HostedControlPlane, cfg RHOBSConfig) (bool, error) {
// Skip VPC endpoint check for test environments (e.g., osde2e tests without real VPC infrastructure)
if cfg.SkipInfrastructureHealthCheck {
return true, nil
}

// Create an instance of the VpcEndpoint
vpcEndpoint := &avov1alpha2.VpcEndpoint{}

Expand Down
16 changes: 12 additions & 4 deletions controllers/hostedcontrolplane/hostedcontrolplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ func (r *HostedControlPlaneReconciler) getRHOBSConfig(ctx context.Context) RHOBS
if strings.TrimSpace(configMap.Data["only-public-clusters"]) == "true" {
cfg.OnlyPublicClusters = true
}
if strings.TrimSpace(configMap.Data["skip-infrastructure-health-check"]) == "true" {
cfg.SkipInfrastructureHealthCheck = true
}

return cfg
}
Expand Down Expand Up @@ -261,7 +264,7 @@ func (r *HostedControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.R
}

// Ensure cluster is ready to be monitored before deploying any probing objects
hcpReady, err := r.hcpReady(ctx, hostedcontrolplane)
hcpReady, err := r.hcpReady(ctx, hostedcontrolplane, rhobsConfig)
if err != nil {
log.Error(err, "HCP readiness check failed")
return utilreconcile.RequeueWith(fmt.Errorf("HCP readiness check failed: %v", err))
Expand All @@ -271,7 +274,7 @@ func (r *HostedControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.R
return utilreconcile.RequeueAfter(healthcheckIntervalSeconds * time.Second), nil
}

vpcEndpointReady, err := r.isVpcEndpointReady(ctx, hostedcontrolplane)
vpcEndpointReady, err := r.isVpcEndpointReady(ctx, hostedcontrolplane, rhobsConfig)
if err != nil {
log.Error(err, "VPC Endpoint check failed")
return utilreconcile.RequeueWith(err)
Expand All @@ -283,7 +286,7 @@ func (r *HostedControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.R

// Cluster ready - deploy kube-apiserver monitoring objects
log.Info("Deploying internal monitoring objects")
err = r.deployInternalMonitoringObjects(ctx, log, hostedcontrolplane)
err = r.deployInternalMonitoringObjects(ctx, log, hostedcontrolplane, rhobsConfig)
if err != nil {
log.Error(err, "failed to deploy internal monitoring components")
return utilreconcile.RequeueWith(err)
Expand Down Expand Up @@ -322,7 +325,12 @@ func (r *HostedControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.R
}

// deployInternalMonitoringObjects creates or updates the objects needed to monitor the kube-apiserver using cluster-internal routes
func (r *HostedControlPlaneReconciler) deployInternalMonitoringObjects(ctx context.Context, log logr.Logger, hostedcontrolplane *hypershiftv1beta1.HostedControlPlane) error {
func (r *HostedControlPlaneReconciler) deployInternalMonitoringObjects(ctx context.Context, log logr.Logger, hostedcontrolplane *hypershiftv1beta1.HostedControlPlane, cfg RHOBSConfig) error {
// Skip internal monitoring for test environments (e.g., osde2e tests without real kube-apiserver infrastructure)
if cfg.SkipInfrastructureHealthCheck {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a separate, dedicated flag/config for this

return nil
}

// Create or update route object
expectedRoute := r.buildInternalMonitoringRoute(hostedcontrolplane)
err := r.Create(ctx, &expectedRoute)
Expand Down
4 changes: 2 additions & 2 deletions controllers/hostedcontrolplane/hostedcontrolplane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ func TestHostedControlPlaneReconciler_deployInternalMonitoringObjects(t *testing
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
r := newTestReconciler(t, tt.objs...)
err := r.deployInternalMonitoringObjects(tt.args.ctx, tt.args.log, tt.args.hostedcontrolplane)
err := r.deployInternalMonitoringObjects(tt.args.ctx, tt.args.log, tt.args.hostedcontrolplane, RHOBSConfig{})
passed, reason := tt.eval(err, r)
if !passed {
t.Errorf("HostedControlPlaneReconciler.deployInternalMonitoringObjects() did not pass due to = %s", reason)
Expand Down Expand Up @@ -827,7 +827,7 @@ func TestIsVpcEndpointReady(t *testing.T) {
}

// Test the function
result, err := r.isVpcEndpointReady(context.Background(), hcp)
result, err := r.isVpcEndpointReady(context.Background(), hcp, RHOBSConfig{})

// Validate the results
if result != tt.expectedResult {
Expand Down
13 changes: 7 additions & 6 deletions controllers/hostedcontrolplane/synthetics.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,13 @@ func (r *HostedControlPlaneReconciler) deleteDynatraceHttpMonitorResources(dynat

// RHOBSConfig holds RHOBS API configuration
type RHOBSConfig struct {
ProbeAPIURL string
Tenant string
OIDCClientID string
OIDCClientSecret string
OIDCIssuerURL string
OnlyPublicClusters bool
ProbeAPIURL string
Tenant string
OIDCClientID string
OIDCClientSecret string
OIDCIssuerURL string
OnlyPublicClusters bool
SkipInfrastructureHealthCheck bool
}

// ensureRHOBSProbe ensures that a RHOBS probe exists for the HostedControlPlane
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ spec:
- --oidc-client-secret=$(OIDC_CLIENT_SECRET)
- --oidc-issuer-url=$(OIDC_ISSUER_URL)
- --only-public-clusters=$(ONLY_PUBLIC_CLUSTERS)
- --skip-infrastructure-health-check=$(SKIP_INFRASTRUCTURE_HEALTH_CHECK)
command:
- /manager
env:
Expand All @@ -65,6 +66,8 @@ spec:
value: ""
- name: ONLY_PUBLIC_CLUSTERS
value: "false"
- name: SKIP_INFRASTRUCTURE_HEALTH_CHECK
value: "false"
image: route-monitor-operator:latest
livenessProbe:
httpGet:
Expand Down
148 changes: 99 additions & 49 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,85 +3,135 @@ module github.com/openshift/route-monitor-operator
go 1.25.5

require (
github.com/go-logr/logr v1.4.2
github.com/go-logr/logr v1.4.3
github.com/google/gofuzz v1.2.0
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/go-version v1.7.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/openshift/api v0.0.0-20240524162738-d899f8877d22
github.com/onsi/ginkgo/v2 v2.27.3
github.com/onsi/gomega v1.39.0
github.com/openshift/api v0.0.0-20250409155250-8fcc4e71758a
github.com/openshift/aws-vpce-operator v0.0.0-20241211114942-1daecf2e4364
github.com/openshift/hypershift/api v0.0.0-20241204143212-857ccab4fd7c
github.com/openshift/osde2e-common v0.0.0-20240604133256-b7200cad0cca
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.63.0
github.com/prometheus/client_golang v1.19.1
github.com/prometheus/common v0.54.0
github.com/openshift/osde2e v0.0.0-20260209164730-1a4541c8e2b1
github.com/openshift/osde2e-common v0.0.0-20260126213857-862206787cf9
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.64.0
github.com/prometheus/client_golang v1.23.2
github.com/prometheus/common v0.67.5
github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.60.0-rhobs1
go.uber.org/mock v0.4.0
gopkg.in/inf.v0 v0.9.1
k8s.io/api v0.30.3
k8s.io/apiextensions-apiserver v0.29.5
k8s.io/apimachinery v0.30.3
k8s.io/client-go v0.29.5
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340
sigs.k8s.io/controller-runtime v0.17.2
k8s.io/api v0.32.3
k8s.io/apiextensions-apiserver v0.32.2
k8s.io/apimachinery v0.32.3
k8s.io/client-go v0.32.3
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff
sigs.k8s.io/controller-runtime v0.20.2
)

require (
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/adamliesko/retry v0.0.0-20200123222335-86c8baac277d // indirect
github.com/aws/aws-sdk-go v1.55.6 // indirect
github.com/aws/aws-sdk-go-v2 v1.41.1 // indirect
github.com/aws/aws-sdk-go-v2/config v1.32.7 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.7 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.71.4 // indirect
github.com/aws/aws-sdk-go-v2/service/ec2 v1.277.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.17 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.9 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.13 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.41.6 // indirect
github.com/aws/smithy-go v1.24.0 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/golang/glog v1.2.4 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/gnostic-models v0.6.9 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/spdystream v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/openshift-online/ocm-api-model/clientapi v0.0.440 // indirect
github.com/openshift-online/ocm-api-model/model v0.0.440 // indirect
github.com/openshift-online/ocm-sdk-go v0.1.486 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/oauth2 v0.27.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/term v0.31.0 // indirect
golang.org/x/text v0.24.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
golang.org/x/mod v0.30.0 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/oauth2 v0.34.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/term v0.38.0 // indirect
golang.org/x/text v0.32.0 // indirect
golang.org/x/time v0.11.0 // indirect
golang.org/x/tools v0.39.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/protobuf v1.34.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/component-base v0.29.5 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 // indirect
sigs.k8s.io/e2e-framework v0.3.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e // indirect
sigs.k8s.io/e2e-framework v0.5.0 // indirect
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading