Xabaril / AspNetCore.Diagnostics.HealthChecks

Enterprise HealthChecks for ASP.NET Core Diagnostics Package
Apache License 2.0
4.07k stars 795 forks source link

Custom paths in kubernetes operator #619

Closed rnarayana closed 4 years ago

rnarayana commented 4 years ago

I want to host the healthchecks ui (via the operator) at mysite.com/healthchecks/dashboard, so that even the UI resources come under /healthchecks/ui/... I am exposing this via ClusterIP and routed via nginx ingress. It works if am using the default /healthchecks route, but the ui resources are now relative to mysite.com and not mysite.com/healthchecks. Is there a way I can make everything relative to /healthchecks uri? e.g: mysite.com/healthchecks/dashboard mysite.com/healthchecks/ui/...

CarlosLanderas commented 4 years ago

Hello @rnarayana. This is possible when configuring the UI using this settings:

https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/doc/ui-docker.md#configure-ui-paths-ui-path-api-path-and-resources-path

However, I need to expose this configuration in the CRD. Right now, you can pass deployment annotations and I maybe we can add custom deployment environment variables to configurable all the UI features that are not exposed in the CRD but are avaible with IConfiguration

rnarayana commented 4 years ago

Thanks @CarlosLanderas It would be nice to have parity across all ways of usage. Are the deployment annotations same as the env variables? Would this be enough?

  apiVersion: "aspnetcore.ui/v1"
  kind: HealthCheck
  metadata:
    name: healthchecks-ui
  spec:
    name: healthchecks-ui
    servicesLabel: HealthChecks
    serviceType: ClusterIP
    deploymentAnnotations:
      ui_path: /hc/dashboard
      ui_resources_path: /hc/static
      ui_api_path: /hc/health-api
CarlosLanderas commented 4 years ago

Hello @rnarayana. The annotations are more for categorizing the deployments itself than for healthchecks.

There are two options here. Add specific ui configuration options in the CRD, ui_path, ui_resources_path, ui_api_path or add a deploymentEnvironment array section to add whatever custom environment variable.

The thing is the UI has plenty of options that can be configured and the second would be more flexible, but the first would be the best option.

CarlosLanderas commented 4 years ago

@rnarayana Im working to add newer options.

uiPath already exists.

And will be added:

            uiApiPath:
              type: string
            uiResourcesPath:
              type: string
            uiWebhooksPath:
              type: string
            uiNoRelativePaths:
              type: bool
rnarayana commented 4 years ago

Lovely, thanks a lot Carlos!

CarlosLanderas commented 4 years ago

This feature will be published in the upcoming days when the new operator image is published. I wan't to add some other feats :)