Skip to content

Create component exposer#19

Closed
ZiyangLinScality wants to merge 26 commits intomainfrom
feature/create-component-exposer
Closed

Create component exposer#19
ZiyangLinScality wants to merge 26 commits intomainfrom
feature/create-component-exposer

Conversation

@ZiyangLinScality
Copy link
Copy Markdown
Contributor

@ZiyangLinScality ZiyangLinScality commented May 20, 2025

  1. RING-50439 Create ScalityUIComponentExposer Ingress
  2. RING-50436 Create the CM for runtime-app-configuration
  3. RING-50438 Mount runtime-app-configuration in ScalityUIComponent deployment
  4. RING-50440 Update ScalityUI deployed-ui-apps

hervedombya and others added 13 commits May 19, 2025 16:19
Add Service creation and reconciliation to ScalityUIComponent controller

Revert "Add Service creation and reconciliation to ScalityUIComponent controller"

This reverts commit 166b7b2.
Implement mock configuration fetching and enhance ScalityUIComponent reconciliation tests

Refactor ScalityUIComponent tests to remove mock client and enhance deployment/service verification

Enhance ScalityUIComponent reconciliation logic and tests
Enhance ScalityUI API and CRD documentation
…plify theme handling in ScalityUI controller
@ZiyangLinScality ZiyangLinScality marked this pull request as ready for review May 21, 2025 14:35
Copilot AI review requested due to automatic review settings May 21, 2025 14:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces the ScalityUIComponentExposer resource and wiring to expose component configurations at runtime.

  • Adds end-to-end tests for the Exposer CR, validating Ingress, ConfigMap creation, volume mounts, and annotations.
  • Extends the ScalityUIComponent reconciler to fetch, parse, and mount .well-known/micro-app-configuration and emit status conditions.
  • Updates RBAC, CRD schema, and Go types to support the new Exposer API with camelCase JSON tags and the AppHistoryPath field.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/controller/scalityuicomponentexposer_controller_test.go Expanded setup/teardown and added assertions for Ingress, ConfigMap, volumes, and hash annotation in Exposer tests.
internal/controller/scalityuicomponent_controller_test.go Added cleanup for deployments, services, Exposer; tests for Exposer creation, requeue logic, and status conditions.
internal/controller/scalityuicomponent_controller.go Implemented fetchMicroAppConfig, JSON parsing, status conditions, and Exposer creation logic.
internal/controller/scalityui_controller.go Added DefaultScalityUIName and DefaultScalityUINamespace constants.
config/rbac/role.yaml Granted RBAC for deployments, configmaps, and ingresses.
config/crd/bases/ui.scality.com_scalityuicomponentexposers.yaml Introduced appHistoryPath and renamed properties to camelCase.
api/v1alpha1/scalityuicomponentexposer_types.go Updated JSON tags to scalityUI, scalityUIComponent, and added appHistoryPath.

}

// Exposer
exposerName := fmt.Sprintf("%s-exposer", scalityUIComponent.Name)
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

The Exposer creation block is never reached because both the success and failure branches above return before this point. Refactor the readiness check to only return when needed and move Exposer logic outside the early returns.

Copilot uses AI. Check for mistakes.
// This is crucial for determining if pods are ready before attempting to fetch the UI configuration
if err := r.Get(ctx, client.ObjectKey{Name: deployment.Name, Namespace: deployment.Namespace}, deployment); err != nil {
logger.Error(err, "Failed to get deployment status")
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

[nitpick] The literal time.Second * 10 is reused for requeue delays. Consider extracting this into a named constant (e.g. requeueDelay) to improve readability and simplify future changes.

Suggested change
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
return ctrl.Result{RequeueAfter: requeueDelay}, nil

Copilot uses AI. Check for mistakes.

// Add a failure condition
meta.SetStatusCondition(&scalityUIComponent.Status.Conditions, metav1.Condition{
Type: "ConfigurationRetrieved",
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

[nitpick] The condition type string ConfigurationRetrieved is repeated in multiple places. Define it as a package-level constant to avoid typos and centralize its definition.

Suggested change
Type: "ConfigurationRetrieved",
Type: ConditionTypeConfigurationRetrieved,

Copilot uses AI. Check for mistakes.
hervedombya and others added 10 commits May 21, 2025 17:50
Enhance ScalityUI API and CRD documentation

Revert "RING-50435 // Create ScalityUI Service"

This reverts commit b6188f6.

Enhance ScalityUI API and CRD

Update config/crd/bases/ui.scality.com_scalityuis.yaml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Update internal/controller/scalityui_controller.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ty UI image version, and fix target port in service UI configuration
…ize ConfigMap naming and improve configuration handling
@ZiyangLinScality ZiyangLinScality deleted the feature/create-component-exposer branch June 1, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants