Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sync] changes from main #1607

Merged
merged 2 commits into from
Feb 4, 2025
Merged
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
27 changes: 8 additions & 19 deletions controllers/services/monitoring/monitoring_controller_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"

componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1"
serviceApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/services/v1alpha1"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
cr "github.com/opendatahub-io/opendatahub-operator/v2/pkg/componentsregistry"
odhtypes "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
Expand All @@ -38,22 +36,13 @@
}

// initialize handles all pre-deployment configurations.
func initialize(ctx context.Context, rr *odhtypes.ReconciliationRequest) error {
log := logf.FromContext(ctx)
// Only handle manifests setup and initial configurations
platform := rr.Release.Name
switch platform {
case cluster.ManagedRhoai:
// Only set prometheus configmap path
rr.Manifests = []odhtypes.ManifestInfo{
{
Path: odhdeploy.DefaultManifestPath,
ContextDir: "monitoring/prometheus/apps",
},
}

default:
log.V(3).Info("Monitoring enabled, won't apply changes in this mode", "cluster", platform)
func initialize(_ context.Context, rr *odhtypes.ReconciliationRequest) error {
// Only set prometheus configmap path
rr.Manifests = []odhtypes.ManifestInfo{
{
Path: odhdeploy.DefaultManifestPath,
ContextDir: "monitoring/prometheus/apps",
},

Check warning on line 45 in controllers/services/monitoring/monitoring_controller_actions.go

View check run for this annotation

Codecov / codecov/patch

controllers/services/monitoring/monitoring_controller_actions.go#L39-L45

Added lines #L39 - L45 were not covered by tests
}

return nil
Expand Down Expand Up @@ -119,7 +108,7 @@
err := rr.Client.List(
ctx,
promDeployment,
client.InNamespace(rr.DSCI.Spec.Monitoring.Namespace),
client.InNamespace(m.Spec.Namespace),

Check warning on line 111 in controllers/services/monitoring/monitoring_controller_actions.go

View check run for this annotation

Codecov / codecov/patch

controllers/services/monitoring/monitoring_controller_actions.go#L111

Added line #L111 was not covered by tests
)
if err != nil {
return fmt.Errorf("error fetching promethus deployments: %w", err)
Expand Down