Skip to content

chore(update): rename janus references to rhdh#2067

Merged
openshift-merge-bot[bot] merged 2 commits into
redhat-developer:mainfrom
Fortune-Ndlovu:rename-prefix-to-rhdh
Jan 12, 2026
Merged

chore(update): rename janus references to rhdh#2067
openshift-merge-bot[bot] merged 2 commits into
redhat-developer:mainfrom
Fortune-Ndlovu:rename-prefix-to-rhdh

Conversation

@Fortune-Ndlovu
Copy link
Copy Markdown
Member

@Fortune-Ndlovu Fortune-Ndlovu commented Jan 5, 2026

Description

chore(update): rename janus references to rhdh

Which issue(s) does this PR fix or relate to

PR acceptance criteria

  • Tests
  • Documentation

How to test changes / Special notes to the reviewer

Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
@Fortune-Ndlovu
Copy link
Copy Markdown
Member Author

FYI remaining "janus" references in docs/orchestrator-cicd.md are references to an external GitHub repository (https://github.com/rhdhorchestrator/janus-idp-bootstrap.git) and were intentionally left unchanged since they refer to an actual external project name.
All tests pass successfully after the changes.

@rhdh-qodo-merge
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🔒 No security concerns identified
⚡ Recommended focus areas for review

Test Fixture Rename

The test now references rhdh-db-statefulset.yaml instead of the previous janus-... fixture. Verify the renamed fixture exists in the repository/testdata and that any code that loads default-config resources was updated consistently so tests don’t silently start using a different fallback/default file.

func TestOverrideDbImage(t *testing.T) {
	bs := *dbStatefulSetBackstage.DeepCopy()

	bs.Spec.Database.EnableLocalDb = ptr.To(false)

	testObj := createBackstageTest(bs).withDefaultConfig(true).
		addToDefaultConfig("db-statefulset.yaml", "rhdh-db-statefulset.yaml").withLocalDb()

	_ = os.Setenv(LocalDbImageEnvVar, "dummy")

	model, err := InitObjects(context.TODO(), bs, testObj.externalConfig, platform.Default, testObj.scheme)
Config Consistency

Multiple tests were switched to load rhdh-deployment.yaml. Ensure this file matches expectations of these tests (e.g., contains CATALOG_INDEX_IMAGE where assumed) and that the rename was applied everywhere that composes default configs; otherwise tests may become coupled to an unintended deployment template or fail due to missing/changed env defaults.

	testObj := createBackstageTest(*bs).withDefaultConfig(true).
		addToDefaultConfig("dynamic-plugins.yaml", "raw-dynamic-plugins.yaml").
		addToDefaultConfig("deployment.yaml", "rhdh-deployment.yaml")

	testObj.externalConfig.DynamicPlugins = corev1.ConfigMap{
		ObjectMeta: metav1.ObjectMeta{Name: "dplugin"},
		Data:       map[string]string{"WrongKeyName.yml": "tt"},
	}

	_, err := InitObjects(context.TODO(), *bs, testObj.externalConfig, platform.Default, testObj.scheme)

	assert.Error(t, err)
	//assert.Contains(t, err.Error(), "expects exactly one Data key named 'dynamic-plugins.yaml'")
	assert.Contains(t, err.Error(), "dynamic plugin configMap expects 'dynamic-plugins.yaml' Data key")

}

// RHDH specific test
func TestDefaultDynamicPlugins(t *testing.T) {

	bs := testDynamicPluginsBackstage.DeepCopy()

	testObj := createBackstageTest(*bs).withDefaultConfig(true).
		addToDefaultConfig("dynamic-plugins.yaml", "raw-dynamic-plugins.yaml").
		addToDefaultConfig("deployment.yaml", "rhdh-deployment.yaml")

	model, err := InitObjects(context.TODO(), *bs, testObj.externalConfig, platform.Default, testObj.scheme)

	assert.NoError(t, err)
	assert.NotNil(t, model.backstageDeployment)
	//dynamic-plugins-root
	//dynamic-plugins-npmrc
	//dynamic-plugins-auth
	//vol-default-dynamic-plugins
	assert.Equal(t, 4, len(model.backstageDeployment.podSpec().Volumes))

	ic := initContainer(model)
	assert.NotNil(t, ic)
	//dynamic-plugins-root
	//dynamic-plugins-npmrc
	//dynamic-plugins-auth
	//vol-default-dynamic-plugins
	assert.Equal(t, 4, len(ic.VolumeMounts))

	deps, err := model.DynamicPlugins.Dependencies()
	assert.NoError(t, err)
	assert.Equal(t, 0, len(deps))

}

func TestDefaultAndSpecifiedDynamicPlugins(t *testing.T) {

	bs := testDynamicPluginsBackstage.DeepCopy()
	bs.Spec.Application.DynamicPluginsConfigMapName = "dplugin"

	testObj := createBackstageTest(*bs).withDefaultConfig(true).
		addToDefaultConfig("dynamic-plugins.yaml", "raw-dynamic-plugins.yaml").
		addToDefaultConfig("deployment.yaml", "rhdh-deployment.yaml")

	testObj.externalConfig.DynamicPlugins = corev1.ConfigMap{
		ObjectMeta: metav1.ObjectMeta{Name: "dplugin"},
		Data:       map[string]string{DynamicPluginsFile: "dynamic-plugins.yaml: | \n plugins: []"},
	}

	model, err := InitObjects(context.TODO(), *bs, testObj.externalConfig, platform.Default, testObj.scheme)

	assert.NoError(t, err)
	assert.NotNil(t, model)

	ic := initContainer(model)
	assert.NotNil(t, ic)
	//dynamic-plugins-root
	//dynamic-plugins-npmrc
	//dynamic-plugins-auth
	//vol-dplugin
	assert.Equal(t, 4, len(ic.VolumeMounts))
	assert.Equal(t, utils.GenerateVolumeNameFromCmOrSecret(DynamicPluginsDefaultName(bs.Name)), ic.VolumeMounts[3].Name)

	deps, err := model.DynamicPlugins.Dependencies()
	assert.NoError(t, err)
	assert.Equal(t, 0, len(deps))
}

func TestSpecifiedOnlyDynamicPlugins(t *testing.T) {

	bs := testDynamicPluginsBackstage.DeepCopy()
	bs.Spec.Application.DynamicPluginsConfigMapName = "dplugin"

	testObj := createBackstageTest(*bs).withDefaultConfig(true).
		addToDefaultConfig("deployment.yaml", "rhdh-deployment.yaml")

	testObj.externalConfig.DynamicPlugins = corev1.ConfigMap{
		ObjectMeta: metav1.ObjectMeta{Name: "dplugin"},
		Data:       map[string]string{DynamicPluginsFile: "dynamic-plugins.yaml: | \n plugins: []"},
	}

	model, err := InitObjects(context.TODO(), *bs, testObj.externalConfig, platform.Default, testObj.scheme)

	assert.NoError(t, err)
	assert.NotNil(t, model)

	ic := initContainer(model)
	assert.NotNil(t, ic)
	//dynamic-plugins-root
	//dynamic-plugins-npmrc
	//dynamic-plugins-auth
	//dplugin
	assert.Equal(t, 4, len(ic.VolumeMounts))
	assert.Equal(t, bs.Spec.Application.DynamicPluginsConfigMapName, ic.VolumeMounts[3].Name)

	deps, err := model.DynamicPlugins.Dependencies()
	assert.NoError(t, err)
	assert.Equal(t, 0, len(deps))
}

func TestDynamicPluginsFailOnArbitraryDepl(t *testing.T) {

	bs := testDynamicPluginsBackstage.DeepCopy()
	//bs.Spec.Application.DynamicPluginsConfigMapName = "dplugin"

	testObj := createBackstageTest(*bs).withDefaultConfig(true).
		addToDefaultConfig("dynamic-plugins.yaml", "raw-dynamic-plugins.yaml")

	_, err := InitObjects(context.TODO(), *bs, testObj.externalConfig, platform.Default, testObj.scheme)

	assert.Error(t, err)
}

func TestNotConfiguredDPsNotInTheModel(t *testing.T) {

	bs := testDynamicPluginsBackstage.DeepCopy()
	assert.Empty(t, bs.Spec.Application.DynamicPluginsConfigMapName)

	testObj := createBackstageTest(*bs).withDefaultConfig(true)

	m, err := InitObjects(context.TODO(), *bs, testObj.externalConfig, platform.Default, testObj.scheme)

	assert.NoError(t, err)
	for _, obj := range m.RuntimeObjects {
		if _, ok := obj.(*DynamicPlugins); ok {
			assert.Fail(t, "Model contains DynamicPlugins object")
		}
	}
}

func TestWithDynamicPluginsDeps(t *testing.T) {

	bs := testDynamicPluginsBackstage.DeepCopy()
	bs.Spec.Application.DynamicPluginsConfigMapName = "dplugin"

	testObj := createBackstageTest(*bs).withDefaultConfig(true).
		addToDefaultConfig("dynamic-plugins.yaml", "raw-dynamic-plugins.yaml").
		addToDefaultConfig("deployment.yaml", "rhdh-deployment.yaml")

	yamlData := `"dynamic-plugins.yaml": |
plugins:
  - package: "plugin-a"
    disabled: false
    dependencies:
      - ref: "dependency-1"
      - ref: "dependency-2"
`

	testObj.externalConfig.DynamicPlugins = corev1.ConfigMap{
		ObjectMeta: metav1.ObjectMeta{Name: "dplugin"},
		Data:       map[string]string{DynamicPluginsFile: yamlData},
	}

	model, err := InitObjects(context.TODO(), *bs, testObj.externalConfig, platform.Default, testObj.scheme)

	assert.NoError(t, err)
	assert.NotNil(t, model)

	// dependencies from external config
	//  - ref: "dependency-1"
	//  - ref: "dependency-2"
	deps, err := model.DynamicPlugins.Dependencies()
	assert.NoError(t, err)
	assert.Equal(t, 2, len(deps))

	depends, err := (model.getRuntimeObjectByType(&DynamicPlugins{})).(*DynamicPlugins).Dependencies()
	assert.NoError(t, err)
	assert.Equal(t, 2, len(depends))

}

func initContainer(model *BackstageModel) *corev1.Container {
	for _, v := range model.backstageDeployment.podSpec().InitContainers {
		if v.Name == dynamicPluginInitContainerName {
			return &v
		}
	}
	return nil
}


// TestCatalogIndexImageFromDefaultConfig verifies that the operator sets CATALOG_INDEX_IMAGE
// on the install-dynamic-plugins init container from the default config by default
func TestCatalogIndexImageFromDefaultConfig(t *testing.T) {
	bs := testDynamicPluginsBackstage.DeepCopy()

	testObj := createBackstageTest(*bs).withDefaultConfig(true).
		addToDefaultConfig("dynamic-plugins.yaml", "raw-dynamic-plugins.yaml").
		addToDefaultConfig("deployment.yaml", "rhdh-deployment.yaml")

	model, err := InitObjects(context.TODO(), *bs, testObj.externalConfig, platform.Default, testObj.scheme)
	assert.NoError(t, err)
	assert.NotNil(t, model.backstageDeployment)

	ic := initContainer(model)
	assert.NotNil(t, ic)

	assert.Len(t, ic.Env, 2)
	assert.Equal(t, "NPM_CONFIG_USERCONFIG", ic.Env[0].Name)
	assert.Equal(t, "CATALOG_INDEX_IMAGE", ic.Env[1].Name)
	assert.Equal(t, "quay.io/rhdh/plugin-catalog-index:1.9", ic.Env[1].Value, "CATALOG_INDEX_IMAGE should be set from the default config")
}

// TestCatalogIndexImageOverridesDefaultConfig verifies that RELATED_IMAGE_catalog_index
// overrides the CATALOG_INDEX_IMAGE value that comes from the default config.
// This is the critical test case: the default-config deployment.yaml has CATALOG_INDEX_IMAGE
// set to one value, but RELATED_IMAGE_catalog_index should override it.
func TestCatalogIndexImageOverridesDefaultConfig(t *testing.T) {
	bs := testDynamicPluginsBackstage.DeepCopy()

	// rhdh-deployment.yaml has CATALOG_INDEX_IMAGE set (like the real default-config)
	testObj := createBackstageTest(*bs).withDefaultConfig(true).
		addToDefaultConfig("dynamic-plugins.yaml", "raw-dynamic-plugins.yaml").
		addToDefaultConfig("deployment.yaml", "rhdh-deployment.yaml")

	// Set RELATED_IMAGE_catalog_index to a DIFFERENT value - this should override the default config
	t.Setenv(CatalogIndexImageEnvVar, "quay.io/fake-reg/img:1.2.3")

	model, err := InitObjects(context.TODO(), *bs, testObj.externalConfig, platform.Default, testObj.scheme)
	assert.NoError(t, err)
	assert.NotNil(t, model.backstageDeployment)

	ic := initContainer(model)
	assert.NotNil(t, ic)

	assert.Len(t, ic.Env, 2)
	assert.Equal(t, "NPM_CONFIG_USERCONFIG", ic.Env[0].Name)
	assert.Equal(t, "CATALOG_INDEX_IMAGE", ic.Env[1].Name)
	assert.Equal(t, "quay.io/fake-reg/img:1.2.3", ic.Env[1].Value, "RELATED_IMAGE_catalog_index should override the default config value")
}

// TestCatalogIndexImageUserPatchTakesPrecedence verifies that user-specified deployment patch
// takes precedence over the operator's RELATED_IMAGE_catalog_index env var
func TestCatalogIndexImageUserPatchTakesPrecedence(t *testing.T) {
	bs := testDynamicPluginsBackstage.DeepCopy()

	// User specifies CATALOG_INDEX_IMAGE via deployment patch
	bs.Spec.Deployment = &bsv1.BackstageDeployment{}
	bs.Spec.Deployment.Patch = &apiextensionsv1.JSON{
		Raw: []byte(`
spec:
  template:
    spec:
      initContainers:
        - name: install-dynamic-plugins
          env:
            - name: CATALOG_INDEX_IMAGE
              value: "quay.io/user-specified/image:2.0"
`),
	}

	testObj := createBackstageTest(*bs).withDefaultConfig(true).
		addToDefaultConfig("dynamic-plugins.yaml", "raw-dynamic-plugins.yaml").
		addToDefaultConfig("deployment.yaml", "rhdh-deployment.yaml")

	// Set RELATED_IMAGE_catalog_index - but user's patch should take precedence
	t.Setenv(CatalogIndexImageEnvVar, "quay.io/rhdh/plugin-catalog-index:related-image")

	model, err := InitObjects(context.TODO(), *bs, testObj.externalConfig, platform.Default, testObj.scheme)
	assert.NoError(t, err)
	assert.NotNil(t, model.backstageDeployment)

	ic := initContainer(model)
	assert.NotNil(t, ic)
	assert.Len(t, ic.Env, 2)
	assert.Equal(t, "NPM_CONFIG_USERCONFIG", ic.Env[0].Name)
	assert.Equal(t, "CATALOG_INDEX_IMAGE", ic.Env[1].Name)
	assert.Equal(t, "quay.io/user-specified/image:2.0", ic.Env[1].Value, "user's deployment patch should override RELATED_IMAGE_catalog_index")
}

// TestCatalogIndexImageExtraEnvsOverride verifies that user-specified extraEnvs
// takes precedence over the operator's RELATED_IMAGE_catalog_index env var
func TestCatalogIndexImageExtraEnvsOverride(t *testing.T) {
	bs := testDynamicPluginsBackstage.DeepCopy()

	// User specifies a different catalog index image via extraEnvs
	bs.Spec.Application.ExtraEnvs = &bsv1.ExtraEnvs{
		Envs: []bsv1.Env{
			{Name: "CATALOG_INDEX_IMAGE", Value: "quay.io/rhdh/plugin-catalog-index:extra-env", Containers: []string{"install-dynamic-plugins"}},
		},
	}

	testObj := createBackstageTest(*bs).withDefaultConfig(true).
		addToDefaultConfig("dynamic-plugins.yaml", "raw-dynamic-plugins.yaml").
		addToDefaultConfig("deployment.yaml", "rhdh-deployment.yaml")
📄 References
  1. redhat-developer/rhdh-operator/tests/e2e/e2e_suite_test.go [63-91]
  2. redhat-developer/rhdh-operator/tests/e2e/e2e_suite_test.go [54-61]
  3. redhat-developer/rhdh-operator/tests/e2e/e2e_suite_test.go [320-336]
  4. redhat-developer/rhdh-operator/tests/e2e/e2e_upgrade_test.go [1-29]
  5. redhat-developer/rhdh-operator/tests/e2e/e2e_upgrade_test.go [29-70]
  6. redhat-developer/rhdh-operator/tests/e2e/e2e_upgrade_test.go [94-121]
  7. redhat-developer/rhdh-operator/tests/e2e/e2e_upgrade_test.go [122-136]
  8. redhat-developer/rhdh-operator/tests/e2e/e2e_upgrade_test.go [137-154]

@rhdh-qodo-merge rhdh-qodo-merge Bot added Review effort 2/5 enhancement New feature or request labels Jan 5, 2026
@rhdh-qodo-merge
Copy link
Copy Markdown

PR Type

Enhancement


Description

  • Rename Janus references to RHDH throughout test files

  • Update configuration file references from janus-* to rhdh-*

  • Update code comments to reflect RHDH branding

  • Standardize naming conventions across deployment and database tests


File Walkthrough

Relevant files
Enhancement
db-statefulset_test.go
Update database statefulset test config reference               

pkg/model/db-statefulset_test.go

  • Replace janus-db-statefulset.yaml with rhdh-db-statefulset.yaml in
    test configuration
+1/-1     
deployment.go
Update RHDH configuration comment                                               

pkg/model/deployment.go

  • Update code comment from "RHDH/Janus configuration" to "RHDH
    configuration"
  • Remove outdated Janus reference in workaround comment
+1/-1     
deployment_test.go
Update deployment test config reference                                   

pkg/model/deployment_test.go

  • Replace janus-deployment.yaml with rhdh-deployment.yaml in test
    configuration
+1/-1     
dynamic-plugins_test.go
Rename Janus to RHDH in dynamic plugins tests                       

pkg/model/dynamic-plugins_test.go

  • Replace all janus-deployment.yaml references with rhdh-deployment.yaml
    across 7 test functions
  • Update test comment from "Janus specific test" to "RHDH specific test"
  • Standardize naming in TestDefaultDynamicPlugins,
    TestDefaultAndSpecifiedDynamicPlugins,
    TestSpecifiedOnlyDynamicPlugins, TestWithDynamicPluginsDeps,
    TestCatalogIndexImageFromDefaultConfig,
    TestCatalogIndexImageOverridesDefaultConfig, and
    TestCatalogIndexImageExtraEnvsOverride
+11/-11 

@rhdh-qodo-merge
Copy link
Copy Markdown

rhdh-qodo-merge Bot commented Jan 5, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix broken tests due to empty test data file

Populate the empty test data file pkg/model/testdata/rhdh-deployment.yaml with
the necessary content to fix the failing assertions in
TestMergeFromSpecDeployment.

pkg/model/deployment_test.go [133-159]

+	testObj := createBackstageTest(bs).withDefaultConfig(true).
+		addToDefaultConfig("deployment.yaml", "rhdh-deployment.yaml")
 
+	model, err := InitObjects(context.TODO(), bs, testObj.externalConfig, platform.OpenShift, testObj.scheme)
+	assert.NoError(t, err)
 
+	// label added
+	assert.Equal(t, "java", model.backstageDeployment.deployable.GetObject().GetLabels()["mylabel"])
+	assert.Equal(t, "backstage", model.backstageDeployment.deployable.PodObjectMeta().GetLabels()["pod"])
+
+	// sidecar added
+	assert.Equal(t, 2, len(model.backstageDeployment.podSpec().Containers))
+	assert.Equal(t, "sidecar", model.backstageDeployment.podSpec().Containers[1].Name)
+	assert.Equal(t, "my-image:1.0.0", model.backstageDeployment.podSpec().Containers[1].Image)
+
+	// backstage container resources updated
+	assert.Equal(t, "backstage-backend", model.backstageDeployment.container().Name)
+	assert.Equal(t, "257Mi", model.backstageDeployment.container().Resources.Requests.Memory().String())
+
+	// volumes
+	// dynamic-plugins-root, dynamic-plugins-npmrc, dynamic-plugins-auth, my-vol
+	assert.Equal(t, 4, len(model.backstageDeployment.podSpec().Volumes))
+	assert.Equal(t, "dynamic-plugins-root", model.backstageDeployment.podSpec().Volumes[0].Name)
+	// overrides StorageClassName
+	assert.Equal(t, "special", *model.backstageDeployment.podSpec().Volumes[0].Ephemeral.VolumeClaimTemplate.Spec.StorageClassName)
+	// adds new volume
+	assert.Equal(t, "my-vol", model.backstageDeployment.podSpec().Volumes[3].Name)
+
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies that the PR breaks the TestMergeFromSpecDeployment test by replacing a test data file with an empty one, which will cause multiple assertions to fail.

High
General
use t.Setenv for test env var

In the test TestOverrideDbImage, replace os.Setenv with t.Setenv to properly
scope the environment variable to the test and prevent side effects.

pkg/model/db-statefulset_test.go [53]

-_ = os.Setenv(LocalDbImageEnvVar, "dummy")
+t.Setenv(LocalDbImageEnvVar, "dummy")
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly recommends using t.Setenv instead of os.Setenv as a best practice to prevent environment variable leakage between tests, improving test suite stability.

Low
  • Update

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown
Member

@rm3l rm3l left a comment

Choose a reason for hiding this comment

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

Could you also remove this line containing a reference to janus, as it is no longer relevant for the operator repo? https://github.com/Fortune-Ndlovu/rhdh-operator/blob/rename-prefix-to-rhdh/.github/README.workflows.adoc?plain=1#L5

Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jan 8, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 8, 2026

Copy link
Copy Markdown
Member

@rm3l rm3l left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm label Jan 9, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jan 9, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rm3l

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

The pull request process is described here

Details 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

Copy link
Copy Markdown
Member

@rm3l rm3l left a comment

Choose a reason for hiding this comment

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

/override "SonarCloud Code Analysis"

SonarCloud analysis failures addressed in #2106

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jan 12, 2026

@rm3l: Overrode contexts on behalf of rm3l: SonarCloud Code Analysis

Details

In response to this:

/override "SonarCloud Code Analysis"

SonarCloud analysis failures addressed in #2106

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-bot openshift-merge-bot Bot merged commit 7b266c9 into redhat-developer:main Jan 12, 2026
9 of 10 checks passed
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.

2 participants