Skip to content

Commit

Permalink
docs(ingress): Update docs and sample
Browse files Browse the repository at this point in the history
* Updated based on the new code updates
  • Loading branch information
akosveres committed Nov 4, 2024
1 parent d29b901 commit 6f1d0cc
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 11 deletions.
32 changes: 28 additions & 4 deletions config/samples/network_v1_ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,41 @@ metadata:
name: ingress-sample
annotations:
k8s.checklyhq.com/enabled: "true"
k8s.checklyhq.com/path: "/baz"
# k8s.checklyhq.com/endpoint: "foo.baaz" - Default read from spec.rules[0].host
# k8s.checklyhq.com/success: "200" - Default "200"
# k8s.checklyhq.com/endpoint: "foo.baaz" - Default read from spec.rules[*].host
k8s.checklyhq.com/group: "group-sample"
# k8s.checklyhq.com/muted: "false" # If not set, default "true"
# k8s.checklyhq.com/path: "/baz" - Default read from spec.rules[*].http.paths[*].path
# k8s.checklyhq.com/success: "200" - Default "200"
spec:
rules:
- host: "foo.bar"
http:
paths:
- path: /
- path: /foo
pathType: ImplementationSpecific
backend:
service:
name: test-service
port:
number: 8080
- path: /bar
pathType: ImplementationSpecific
backend:
service:
name: test-service
port:
number: 8080
- host: "example.com"
http:
paths:
- path: /tea
pathType: ImplementationSpecific
backend:
service:
name: test-service
port:
number: 8080
- path: /coffee
pathType: ImplementationSpecific
backend:
service:
Expand Down
27 changes: 20 additions & 7 deletions docs/ingress.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# ingress

We also support kubernetes native `ingress` resources. See [official docs](https://kubernetes.io/docs/concepts/services-networking/ingress/) for more details on what they are and what they do.
Support for kubernetes native `ingress` resources. See [official docs](https://kubernetes.io/docs/concepts/services-networking/ingress/) for more details on what they are and what they do.

We pull out information with the use of `annotations`. The information from the annotations is used to create `ApiCheck` resources, we make use of [ownerReferences](https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/) to link ingress resources to ApiCheck resources.
We pull out information with the use of `annotations` and use the built in spec. The information from the annotations is used to create `ApiCheck` resources, we make use of [ownerReferences](https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/) to link ingress resources to ApiCheck resources.

> ***Warning***
> We currently only support one API check / ingress resource.
> We currently only support API checks for ingress resources.
## Logic of discovery

We iterate over the ingress resource's specifications to work out what needs to be created. The operator creates one ApiCheck resource for each `host` + `path`, if in your ingress resource you have 2 hosts with 3 paths each, you'll end up with 6 ApiChecks created.

Specific annotations are optional, as we can't automatically discover the group you want the Checkly APIChecks to be deployd in.

## Configuration options

Expand All @@ -14,10 +20,10 @@ The name of the API Check derives from the `metadata.name` of the `ingress` reso
| Annotation | Details | Default |
|--------------------|-------------|---------|
| `k8s.checklyhq.com/enabled` | Bool; Should the operator read the annotations or not | `false` (*required) |
| `k8s.checklyhq.com/path` | String; The URI to put after the `endpoint`, for example `/path` | "" (*required) |
| `k8s.checklyhq.com/endpoint` | String; The host of the URL, for example `/` | Value of `spec.rules[0].Host`, defaults to `https://` (*required) |
| `k8s.checklyhq.com/endpoint` | String; The host of the URL, for example `/` | Value of `spec.rules[0].Host`, defaults to `https://` |
| `k8s.checklyhq.com/group` | String; Name of the group to which the check belongs; Kubernetes `Group` resource name` | none (*required)|
| `k8s.checklyhq.com/muted` | String; Is the check muted or not | `true` |
| `k8s.checklyhq.com/path` | String; The URI to put after the `endpoint`, for example `/path` | ""|
| `k8s.checklyhq.com/success` | String; The expected success code | `200` |

### Example
Expand All @@ -29,7 +35,7 @@ metadata:
name: checkly-operator-ingress
annotations:
k8s.checklyhq.com/enabled: "true"
k8s.checklyhq.com/path: "/baz"
# k8s.checklyhq.com/path: "/baz" - Default read from spec.rules[0].http.paths[*].path
# k8s.checklyhq.com/endpoint: "foo.baaz" - Default read from spec.rules[0].host
# k8s.checklyhq.com/success: "200" - Default "200"
k8s.checklyhq.com/group: "group-sample"
Expand All @@ -39,7 +45,14 @@ spec:
- host: "foo.bar"
http:
paths:
- path: /
- path: /foo
pathType: ImplementationSpecific
backend:
service:
name: test-service
port:
number: 8080
- path: /bar
pathType: ImplementationSpecific
backend:
service:
Expand Down

0 comments on commit 6f1d0cc

Please sign in to comment.