Skip to content

Commit

Permalink
[K8s Operator] Add Scope documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosLanderas committed Sep 10, 2020
1 parent f1059a9 commit 6ad2d06
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions doc/k8s-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,21 @@ The [HealthCheck operator definition](https://github.com/Xabaril/AspNetCore.Diag
| Field | Description |
| ------------- | :--------------------------------------------------------------------------------- |
| name | Name of the healthcheck resource |
| scope | Cluster / Namespaced |
| servicesLabel | The label the operator service watcher will use to detected healthchecks endpoints |


### Scope definition (Cluster or Namespaced)

The scope field (Cluster or Namespaced) is mandatory and will specify to the operator whether it should watch for healthchecks services in the
same namespace where the UI resource is created or watch to all services in all namespaces.

If you wan't to have different UI's for different namespaced services you should use **Namespaced**

If you wan't to have a single UI that monitors all the healthchecks from the cluster you should use **Cluster**

Note: The UI resources created by the operator (deployment, service, configmap, secret, etc) will always be created in the metadata specified namespace.

### Optional fields

| Field | Description | Default |
Expand Down Expand Up @@ -76,6 +89,8 @@ metadata:
namespace: demo
spec:
name: healthchecks-ui
scope: Namespaced #The UI will be created at specified namespace (demo) and will watch healthchecks services in demo namespace only
#scope: Cluster The UI will be created at specified namespace (demo) but will watch healthcheck services across all namespaces
servicesLabel: HealthChecks
serviceType: LoadBalancer
stylesheetContent: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal Task Watch(HealthCheckResource resource, CancellationToken token)
Func<HealthCheckResource, bool> filter = (k) => k.Metadata.NamespaceProperty == resource.Metadata.NamespaceProperty;

if (!_watchers.Keys.Any(filter))
{
{
var response = _client.ListNamespacedServiceWithHttpMessagesAsync(
namespaceParameter: resource.Metadata.NamespaceProperty,
labelSelector: $"{resource.Spec.ServicesLabel}",
Expand Down

0 comments on commit 6ad2d06

Please sign in to comment.