Skip to content

Feature/ring 50379 publish micro app in status#13

Merged
hervedombya merged 6 commits intomainfrom
feature/RING-50379-publish-micro-app-in-status
May 23, 2025
Merged

Feature/ring 50379 publish micro app in status#13
hervedombya merged 6 commits intomainfrom
feature/RING-50379-publish-micro-app-in-status

Conversation

@hervedombya
Copy link
Copy Markdown
Contributor

No description provided.

@hervedombya hervedombya force-pushed the feature/RING-50379-publish-micro-app-in-status branch 5 times, most recently from 04cce60 to 5ddff70 Compare May 15, 2025 13:31
@hervedombya hervedombya marked this pull request as ready for review May 15, 2025 13:33
Copilot AI review requested due to automatic review settings May 15, 2025 13:33
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 functionality to fetch, parse, and update the UI component configuration for the micro-app upon reconciliation, and adds associated test cases. Key changes include:

  • Enhancements in the reconciliation logic to fetch and apply configuration based on the state of a Deployment.
  • Addition of new tests for various configuration fetch outcomes (not ready, fetch failure, parse failure, and successful fetch).
  • New helper function to retrieve configuration via the Kubernetes REST client.

Reviewed Changes

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

File Description
internal/controller/scalityuicomponent_controller_test.go Added tests for configuration retrieval and condition setting; includes cleanup of associated Deployment and Service resources.
internal/controller/scalityuicomponent_controller.go Integrated configuration fetching and parsing into the reconcile loop; introduced types and helper function for the micro-app configuration.

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
@hervedombya hervedombya force-pushed the feature/RING-50379-publish-micro-app-in-status branch from c372cab to a7d4d1b Compare May 19, 2025 14:19
func (r *ScalityUIComponentReconciler) fetchMicroAppConfig(ctx context.Context, namespace, serviceName string) (string, error) {
logger := log.FromContext(ctx)

clientset, err := kubernetes.NewForConfig(r.Config)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why not simply relying on inCluster config ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

inCluster config would only work in the cluster and would require a special configuration for local development

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

local dev is something that can be addressed by a specific config injection, when using it in prod it wil always be running in a cluster, in local it is also running in kind so in a cluster, expect when you attach it to a cluster. But anyway with below comment I think we don't need this client here

Comment on lines +245 to +249
restClient := clientset.CoreV1().RESTClient()
req := restClient.Get().
Namespace(namespace).
Resource("services").
Name(fmt.Sprintf("%s:%d", serviceName, DefaultServicePort)).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Isn't it us to create the service ? SO i think we already know the service name and don't need to fetch it right ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I mean we can dircetly query serviceName + '.' + namespace + '.svc.cluster.local'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

with this approach, we need to implement a full HTTP client, right ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What do you mean by a full http client.
It's just http.NewRequest("GET", "http://"+ serviceName + '.' + namespace + '.svc.cluster.local/.well-known/micro-app-configuration", nil)

@hervedombya hervedombya merged commit 479a650 into main May 23, 2025
1 check passed
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.

5 participants