Skip to content

feat: OU-571 Add Perses and Incidents Feature Flags #664

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

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

zhuje
Copy link
Contributor

@zhuje zhuje commented Jan 30, 2025

JIRA Issue

https://issues.redhat.com/browse/OU-571

Description

  • Adjust COO to include the perses-dashboards flag in the arguments for the monitoring-console-plugin's Deployment; we then can use this flag to render the Perses Dashboard component.
  • Add perses proxy information to the list of proxies in the monitoring-console-plugin's ConsolePlugin; this allows the monitoring-console-plugin to proxy to perses an instance.
  • Add incidents feature flag to monitoring-console-plugin Deployment ("container.args: "-features='incidents'").
[OU-571](https://issues.redhat.com//browse/OU-571)-perses-incidents Figure 1. The first screen shows UIPlugin configuration for perses, incidents, and acm. The second screen shows the `--feature='perses-dashboards', 'incidents', 'acm-alerting',` being listed in the Deployment for the monitoring-console-plugin. The third screen shows the `alias: perses` being listed as a proxy within the ConsolePlugin CR for the monitoring-console-plugin

Changes

  1. Update schema to include new fields acm, perses, and incidents. In the future, we could add +kubebuilder validations/webhooks to validate the UIPlugin custom resources for type: monitoring.
  • bundle/manifests/observability.openshift.io_uiplugins.yaml
  • deploy/crds/common/observability.openshift.io_uiplugins.yaml
  • types.go
  1. Remove ACM-related validation. This is moved to monitoring.go.
  • pkg/controllers/uiplugin/compatibility_matrix.go
  • pkg/controllers/uiplugin/compatibility_matrix_test.go
  1. Validate configuration from UIPlugin CR. If valid, then add a feature flag(s) (e.g., "-feature= 'perses-dashboards', 'incidents'") and proxies (for perses).
  • pkg/controllers/uiplugin/monitoring.go
  • pkg/controllers/uiplugin/monitoring_test.go

Testing

Cluster Environment Requirements

  • OCP v4.18+ ("incidents" feature flag is set only if OCP 4.18+)
  • ACM v2.11+ and instance of multiclusterhub ("acm-alerting" feature flag is only set if acm v2.11+)
  1. Login into a OCP v4.18+ cluster ("incidents" feature flag is set only if OCP 4.18+)

  2. set openshift.enabled to true in main.go

# main.go 
...
	flag.BoolVar(&openShiftEnabled, "openshift.enabled", true, "Enable OpenShift specific features such as Console Plugins.")
...
  1. Build the image and push it to your quay.io repo (and regenerate CRD from types.go with make generate and make bundle)
make generate && \
make bundle && \
make operator-image bundle-image operator-push bundle-push  \
    IMAGE_BASE="quay.io/jezhu/observability-operator" \
    VERSION=1.1.0-dev-0.35.0
  1. Deploy to cluster (and clean up components from previous observability-operator deploys)
oc delete catalogsource observability-operator-catalog -n openshift-operators && \
operator-sdk cleanup observability-operator -n openshift-operators && \
operator-sdk run bundle \
    quay.io/jezhu/observability-operator-bundle:1.1.0-dev-0.35.0 \
    --install-mode AllNamespaces \
    --namespace openshift-operators \
    --security-context-config restricted
  1. Install Advanced Cluster Management (this enables the feature flag "--features=acm-alerting")
  • Go to OpenShift Container Platform UI
  • Go to the Menu > Administrator Perspective > Operators > OperatorHub
  • Search for "Advanced Cluster Management for Kubernetes", and install a version that is > v2.11
  • Create a the required MultiClusterHub
  1. Apply UIPlugin configuration for monitoring
oc apply -f - <<EOF
apiVersion: observability.openshift.io/v1alpha1
kind: UIPlugin
metadata:
  name: monitoring
spec:
  type: Monitoring
  monitoring:
    acm:
      enabled: true
      alertmanager:
        url: 'https://alertmanager.open-cluster-management-observability.svc:9095'
      thanosQuerier:
        url: 'https://rbac-query-proxy.open-cluster-management-observability.svc:8443'
    perses:
      enabled: true
      serviceName: "perses-api-http"
      namespace: "perses"
    incidents:
      enabled: true
EOF

Troubleshooting

mac specific troubleshooting

sed commands need to be adjusted on macOS update sed ... -i to sed ... -i '' .

# Makefile
...
.PHONY: bundle
...
# before 
	sed -e 's|<IMG_OBSERVABILITY_OPERATOR>|$(OPERATOR_IMG)|g' \
		-i bundle/manifests/observability-operator.clusterserviceversion.yaml
# after
	sed -e 's|<IMG_OBSERVABILITY_OPERATOR>|$(OPERATOR_IMG)|g' \
		-i  '' bundle/manifests/observability-operator.clusterserviceversion.yaml
...

Alternatively, install https://formulae.brew.sh/formula/gnu-sed and add it to your path to replace "sed"

GNU "sed" has been installed as "gsed".If you need to use it as "sed", you can add a "gnubin" directory to your PATH from your bashrc like:     PATH="$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$PATH"

If uninstall is hung

  1. oc edit crd uiplugins.observability.openshift.io
    n the editor, find the finalizers field under metadata, and remove any finalizers (it will look something like this):
metadata:
  finalizers:
  - kubernetes

After removing the finalizer(s), save and exit the editor. This should allow the CRD to be deleted.

  1. Go the the UI > Installed Operator > manually delete the operator

VSCode Local Debugger configurations

# launch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Run",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "/Users/jezhu/Git/observability-operator/cmd/operator", 
            "args": [
                "--namespace=openshift-operators",
                "--metrics-bind-address=:8080",
                "--images=alertmanager=alertmanager=quay.io/prometheus/alertmanager:v0.26.0",
                "--images=prometheus=prometheus=quay.io/prometheus/prometheus:v2.49.1",
                "--images=thanos=thanos=quay.io/thanos/thanos:v0.33.0",
                "--openshift.enabled",
            ],
            "showLog": false,
            "cwd": "/Users/jezhu/Git/observability-operator/cmd/operator",
            "env": {},
        }
    ]
}

Video Demo (Requires Red Hat SSO)

These videos do not show the initial setup. The setup requires the COO to install an image that includes changes from this PR, AMC installed, and the MultiClusterHub instance created.

Figure 2. Video demo of configuring incidents feature flag, perses feature flag, and perses proxy.
https://drive.google.com/file/d/1ub34XoG8gW6AIBfQyPGC1m6XYQdheVzV/view?usp=sharing

Figure 3. Video demo of testing updating UIPlugin CR
https://drive.google.com/file/d/1Bb-Ji03wXk8L8LbwRrOBVYm1sbUc-ISa/view?usp=sharing

@zhuje zhuje requested a review from a team as a code owner January 30, 2025 02:27
@zhuje zhuje requested review from slashpai and JoaoBraveCoding and removed request for a team January 30, 2025 02:27
@openshift-ci openshift-ci bot requested review from jan--f and marioferh January 30, 2025 02:27
@zhuje zhuje force-pushed the OU-571-perses-feature-flag-pr branch from 26eab0f to db5581f Compare January 30, 2025 02:29
@zhuje zhuje force-pushed the OU-571-perses-feature-flag-pr branch from db5581f to 15ffcc9 Compare January 30, 2025 02:40
@zhuje
Copy link
Contributor Author

zhuje commented Feb 4, 2025

/hold
I pushed some changes, but they must be tested on a cluster.

@zhuje
Copy link
Contributor Author

zhuje commented Feb 4, 2025

/unhold

tested on cluster

image

@zhuje zhuje force-pushed the OU-571-perses-feature-flag-pr branch 5 times, most recently from 5f38854 to 8e2364f Compare February 5, 2025 23:04
@zhuje zhuje changed the title feat: OU-571 Add Perses Flag feat: OU-571 Add Perses and Incidents Feature Flags Feb 13, 2025
@jgbernalp jgbernalp force-pushed the OU-571-perses-feature-flag-pr branch from 435f8eb to d5586d7 Compare February 20, 2025 12:07
@jan--f
Copy link
Collaborator

jan--f commented Feb 20, 2025

This looks very good overall, thanks for the detailed PR description!

One question: Iiuc the plan is currently to add the Perses operator as a component to COO (instead of productizing it). That means that we'll add the operator deployment to the COO bundle instead of relying on other install mechanisms.

Is the plan to add this to this upstream project as well, similar to how we handle our prometheus-operator fork? This doesn't block this PR here, but would be good to get clarity over.

@jgbernalp
Copy link
Contributor

This looks very good overall, thanks for the detailed PR description!

One question: Iiuc the plan is currently to add the Perses operator as a component to COO (instead of productizing it). That means that we'll add the operator deployment to the COO bundle instead of relying on other install mechanisms.

Is the plan to add this to this upstream project as well, similar to how we handle our prometheus-operator fork? This doesn't block this PR here, but would be good to get clarity over.

Yes, the plan is to include the deployment of the controller and the APIs similar to what we currently have with prometheus operator.

@jgbernalp
Copy link
Contributor

/lgtm

@jgbernalp
Copy link
Contributor

/approve

Copy link

openshift-ci bot commented Feb 20, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jgbernalp, zhuje

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit c5b39c1 into rhobs:main Feb 20, 2025
11 checks passed
@jgbernalp jgbernalp deleted the OU-571-perses-feature-flag-pr branch March 14, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants