Service instance detail page improvements #333

Merged
tobru merged 11 commits from 257-service-detail-page into main 2025-12-18 13:32:21 +00:00
Member

#257

Not tested yet due to the k8s cluster being down

#257 **Not tested yet due to the k8s cluster being down**
Move events to end of page and take up full width
All checks were successful
Tests / test (push) Successful in 28s
5e543b1e4c
tobru changed title from Service instance detail page improvements to WIP: Service instance detail page improvements 2025-12-11 10:29:00 +00:00
redesign service detail page
All checks were successful
Tests / test (push) Successful in 56s
5c39d26b62
with the help of Claude Code
rixx force-pushed 257-service-detail-page from 275e5e3cc1
All checks were successful
Tests / test (push) Successful in 30s
to 1ac799e29c
All checks were successful
Tests / test (push) Successful in 28s
2025-12-12 07:51:52 +00:00
Compare
Author
Member

Open questions:

  • Where on the Claude-designed page should the instance name go (as opposed to the display name)? (@tobru )

TODO:

  • Refactor duplicated code in service instance detail view
Open questions: - Where on the Claude-designed page should the instance name go (as opposed to the display name)? (@tobru ) TODO: - Refactor duplicated code in service instance detail view
rixx force-pushed 257-service-detail-page from 1ac799e29c
All checks were successful
Tests / test (push) Successful in 28s
to 4ae27e4109 2025-12-12 07:52:35 +00:00
Compare
Owner

Where on the Claude-designed page should the instance name go (as opposed to the display name)?

In the title as well:

Instance Display Name (Instance ID)

The instance ID should be formatted as a mono font.

> Where on the Claude-designed page should the instance name go (as opposed to the display name)? In the title as well: `Instance Display Name (Instance ID)` The instance ID should be formatted as a mono font.
Owner

In addition to what we do now, we should also communicate the service status to the end user. Currently, the best way to do that is to query the Pod status of the service.

On a Claim on the Kubernetes API (e.g. VSHNForgejo), we can get the namespace where the actual service is deployed into by querying the field .status.instanceNamespace. We can then get some status information from the Pods running in this Namespace. It might be that there are no Pods, one Pod, multiple Pods, this has to be coped with.

I talked to Claude to ask about Pod status fields which could help us to communicate the Service Status: https://claude.ai/share/0d2ad9d5-6f22-4f4e-8df8-14775b0ecd40

From that, I propose: Use the "1. Service Status - combine phase and ready condition" and "4. Health status" from the proposed get_user_friendly_status() function and display this information in the service detail page. The problem is that in a service namespace, multiple Pods can be available. When that is the case, let's display the status of all Pods, because we currently don't know which is the most important one.

Label selector for Pods in instance namespace: "app,!job-name,!batch.kubernetes.io/controller-uid"

I'd love to have this status updated dynamically using server sent events and HTMX. There is some example code here: https://github.com/vshn/conferenceli/blob/main/podstatus/app.py#L113 This uses the Kubernetes Watch functionality to get notified about changes.

def get_user_friendly_status(pod_data):  
    status = pod_data.get('status', {})
    metadata = pod_data.get('metadata', {})
    
    # 1. Service Status - combine phase and ready condition
    phase = status.get('phase', 'Unknown')
    conditions = {c['type']: c['status'] for c in status.get('conditions', [])}
    
    if phase == 'Running' and conditions.get('Ready') == 'True':
        service_status = 'operational'
        status_label = 'Operational'
        status_icon = '🟢'
    elif phase == 'Running' and conditions.get('Ready') != 'True':
        service_status = 'degraded'
        status_label = 'Starting up'
        status_icon = '🟡'
    elif phase == 'Pending':
        service_status = 'starting'
        status_label = 'Starting'
        status_icon = '🟡'
    else:
        service_status = 'unavailable'
        status_label = 'Unavailable'
        status_icon = '🔴'
    
    
    # 4. Health status
    is_ready = container_statuses[0].get('ready', False) if container_statuses else False
    health = 'Healthy' if is_ready else 'Unhealthy'
    
    return {
        'status': service_status,
        'status_label': status_label,
        'status_icon': status_icon,
        'health': health,
    }

Furthermore, let's display the Kubernetes events from the instance namespace as well, because this can be helpful information when something doesn't work. Let's put this information into the "Technical Details" section.

In addition to what we do now, we should also communicate the service status to the end user. Currently, the best way to do that is to query the Pod status of the service. On a Claim on the Kubernetes API (e.g. VSHNForgejo), we can get the namespace where the actual service is deployed into by querying the field `.status.instanceNamespace`. We can then get some status information from the Pods running in this Namespace. It might be that there are no Pods, one Pod, multiple Pods, this has to be coped with. I talked to Claude to ask about Pod status fields which could help us to communicate the Service Status: https://claude.ai/share/0d2ad9d5-6f22-4f4e-8df8-14775b0ecd40 From that, I propose: Use the "1. Service Status - combine phase and ready condition" and "4. Health status" from the proposed `get_user_friendly_status()` function and display this information in the service detail page. The problem is that in a service namespace, multiple Pods can be available. When that is the case, let's display the status of all Pods, because we currently don't know which is the most important one. Label selector for Pods in instance namespace: `"app,!job-name,!batch.kubernetes.io/controller-uid"` I'd love to have this status updated dynamically using server [sent events and HTMX](https://htmx.org/extensions/sse/). There is some example code here: https://github.com/vshn/conferenceli/blob/main/podstatus/app.py#L113 This uses the Kubernetes Watch functionality to get notified about changes. ```python def get_user_friendly_status(pod_data): status = pod_data.get('status', {}) metadata = pod_data.get('metadata', {}) # 1. Service Status - combine phase and ready condition phase = status.get('phase', 'Unknown') conditions = {c['type']: c['status'] for c in status.get('conditions', [])} if phase == 'Running' and conditions.get('Ready') == 'True': service_status = 'operational' status_label = 'Operational' status_icon = '🟢' elif phase == 'Running' and conditions.get('Ready') != 'True': service_status = 'degraded' status_label = 'Starting up' status_icon = '🟡' elif phase == 'Pending': service_status = 'starting' status_label = 'Starting' status_icon = '🟡' else: service_status = 'unavailable' status_label = 'Unavailable' status_icon = '🔴' # 4. Health status is_ready = container_statuses[0].get('ready', False) if container_statuses else False health = 'Healthy' if is_ready else 'Unhealthy' return { 'status': service_status, 'status_label': status_label, 'status_icon': status_icon, 'health': health, } ``` Furthermore, let's display the Kubernetes events from the instance namespace as well, because this can be helpful information when something doesn't work. Let's put this information into the "Technical Details" section.
Hide superflous separator
All checks were successful
Tests / test (push) Successful in 30s
24732fde26
tobru changed title from WIP: Service instance detail page improvements to Service instance detail page improvements 2025-12-18 13:32:08 +00:00
tobru merged commit 7bfae6c66a into main 2025-12-18 13:32:21 +00:00
tobru deleted branch 257-service-detail-page 2025-12-18 13:32:21 +00:00
Sign in to join this conversation.
No description provided.