Skip to content

Commit 2654780

Browse files
committed
CLEANUP/MINOR: doc: use same wording for custom annotations
1 parent 5f1c09f commit 2654780

File tree

7 files changed

+39
-31
lines changed

7 files changed

+39
-31
lines changed

cmd/docs/annotations.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import (
2828
var header = `
2929
This is autogenerated from [doc.yaml](doc.yaml). Description can be found in [generator readme](gen/README.md)
3030
31+
### Custom annotations
32+
33+
more info about custom annotations can be found in [annotations-custom.md](annotations-custom.md)
34+
3135
### Available annotations
3236
3337
> :information_source: Ingress and service annotations can have ` + "`ingress.kubernetes.io`, `haproxy.org` and `haproxy.com`" + ` prefixes
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# User annotations
1+
# Custom annotations
22

3-
User annotations are custom annotations with full validation that user can create for frontend and backend side of HAProxy configuration. They can be limited for certain resources and they unlock all HAProxy options that might not be available with other options.
3+
Custom annotations are annotations with full validation that user can create for frontend and backend side of HAProxy configuration. They can be limited for certain resources and they unlock all HAProxy options that might not be available with other options. In background they use CRD (Custom resources definition) to validate its content and access.
44

55
## Why ?
66

77
HAProxy has extensive number of powerful options to tweak load balancing: [docs.haproxy.org](https://docs.haproxy.org/). The best way to expose them in most reliable way is to provide a secure method to deploy them while still allowing full exposure of settings that HAProxy provides.
88

99
## What is the main difference if we compare them to CRDs ?
1010

11-
They are pretty similar, both have validation and can potentially add almost everything HAProxy can offer. Main difference with CRDs is, that CRDs do not have granularity like we can have with user defined annotations.
11+
They are pretty similar, both have validation and can potentially add almost everything HAProxy can offer. Main difference with CRDs is, that CRDs do not have granularity like we can have with custom defined annotations.
1212

1313
## What is the main difference compared to config snippets
1414

@@ -21,27 +21,27 @@ In short reliability, validation and security. While snippets allow really high
2121
The most important difference is security part of it. With custom annotations there is clear separation of two groups of people who configure and consume them:
2222

2323
- Administrator
24-
using pre defined CRD, administrator can define and limit usage of user annotations. This can be achieved with limiting annotation on certain HAProxy section, service, ingress or namespace if needed. Also, if a specific service or group needs a little more freedom in what to configure, administrator can create a user annotation that is specific to that team.
24+
using pre defined CRD, administrator can define and limit usage of custom annotations. This can be achieved with limiting annotation on certain HAProxy section, service, ingress or namespace if needed. Also, if a specific service or group needs a little more freedom in what to configure, administrator can create a custom annotation that is specific to that team.
2525

2626
- Developers/Teams
2727
Teams gets a list of all available annotations that admin created. If more is needed, request can be sent to admin to create additional annotation.
2828

2929
### Validation
3030

31-
User defined annotations have validation. [Common Expression language](https://github.com/google/cel-spec) is used to write rules. Rules can be simple or strict. The more strict rule is there is less chance of accidental mistake.
31+
Custom annotations have validation. [Common Expression language](https://github.com/google/cel-spec) is used to write rules. Rules can be simple or strict. The more strict rule is there is less chance of accidental mistake.
3232

3333
### Speed of delivery
3434

35-
While number of annotations have grown over time in this project, no two deployments are the same. Company A needs different customization than Company B. While purpose of this project is to cover all possible ideas and setups our users might need, it is not possible to cover all use cases with (in the end) limited number of resources and time. With user annotation there is no need to wait until new annotation is accepted, developed and released, we can simply create a new one, deploy it and start using it immediately after we deploy it.
35+
While number of annotations have grown over time in this project, no two deployments are the same. Company A needs different customization than Company B. While purpose of this project is to cover all possible ideas and setups our users might need, it is not possible to cover all use cases with (in the end) limited number of resources and time. With custom annotation there is no need to wait until new annotation is accepted, developed and released, we can simply create a new one, deploy it and start using it immediately after we deploy it.
3636

3737
### Monitoring
3838

3939
We all read logs, right, right ?
4040
While we do have a log message with annotations where we can see if some annotations is not accepted due to xyz, user annotations have additional advantage. Even in case if validation was not successful it will still appear in configuration, but as comment on certain frontend or backend. Additionall, as a comment, error message will appear that will explain what went wrong.
4141

42-
## How can I distinguish user annotations from 'regular' ones ?
42+
## How can I distinguish custom annotations from 'regular' ones ?
4343

44-
As seen in [annotations.md](https://github.com/haproxytech/kubernetes-ingress/blob/master/documentation/annotations.md), HAProxy annotations can have `ingress.kubernetes.io`, `haproxy.org` and `haproxy.com` prefixes. User annotations can have any prefix we define. For example a 'famous' example.com corporation can use `example.com` prefix. How exactly structure is defined we will see next.
44+
As seen in [annotations.md](https://github.com/haproxytech/kubernetes-ingress/blob/master/documentation/annotations.md), HAProxy annotations can have `ingress.kubernetes.io`, `haproxy.org` and `haproxy.com` prefixes. Custom annotations can have any prefix we define. For example a 'famous' example.com corporation can use `example.com` prefix. How exactly structure is defined we will see next.
4545

4646
## Is there any downside ?
4747

@@ -51,7 +51,7 @@ Not really, but we always need to keep in mind that adding/modifying annotation
5151

5252
### CRD
5353

54-
We need to write a CRD where we will define all user annotations.
54+
We need to write a CRD where we will define all custom annotations.
5555

5656
```yaml
5757
apiVersion: ingress.v3.haproxy.org/v3 # yes, you are right, CRD updates are lovely
@@ -60,7 +60,7 @@ metadata:
6060
name: example-validationrules
6161
namespace: haproxy-controller
6262
spec:
63-
prefix: "example.com" # company prefix for user defined annotations
63+
prefix: "example.com" # company prefix for custom annotations
6464
validation_rules: # list of user defined annotations
6565
# Rule for 'timeout-server' accepting duration values
6666
timeout-server:
@@ -252,7 +252,7 @@ there are several values we can use in template that are predefined
252252
section: backend
253253
template: |
254254
# ==============================================
255-
# user annotation, owner: {{.owner}} - Reason: {{.reason}} for {{.BACKEND}}
255+
# custom annotation, owner: {{.owner}} - Reason: {{.reason}} for {{.BACKEND}}
256256
# namespace {{.NAMESPACE}}, ingress {{.INGRESS}}, service {{.SERVICE}}
257257
# POD_NAME {{.POD_NAME}}, POD_NAMESPACE {{.POD_NAMESPACE}}, POD_IP {{.POD_IP}}
258258
# ==============================================
@@ -275,7 +275,7 @@ usage (as you see while rule and template is complex, usage is simple)
275275
backend.example.com/timeouts: |
276276
{
277277
"owner": "oktalz",
278-
"reason": "user annotations demo",
278+
"reason": "custom annotations demo",
279279
"server": "51s",
280280
"server_fin": "20s",
281281
"tarpit": "5s"
@@ -287,7 +287,7 @@ config
287287
```txt
288288
### example.com/timeouts ###
289289
# ==============================================
290-
# user annotation, owner: oktalz - Reason: user annotations demo for default_svc_http-echo_http
290+
# custom annotation, owner: oktalz - Reason: custom annotations demo for default_svc_http-echo_http
291291
# namespace default, ingress http-echo, service http-echo
292292
# POD_NAME haproxy-ingress-56ml56gs, POD_NAMESPACE haproxy-controller, POD_IP 10.8.0.2
293293
# ==============================================
@@ -308,7 +308,7 @@ config
308308
- <name>
309309
ingresses: # limit usage to specific ingresses
310310
- <name>
311-
order_priority: 100 # order of user annotations in config. higher is more priority
311+
order_priority: 100 # order of custom annotations in config. higher is more priority
312312
template: "timeout server {{.}}" # template we can use (golang templates)
313313
type: duration # expected data type for conversion (duration;int;uint;bool;string;float;json;)
314314
rule: "value > duration('42s') && value <= duration('42m')" # CEL expression
@@ -339,12 +339,12 @@ its similar as with other configuration values, except we define it as configmap
339339

340340
### Structure
341341

342-
`frontend.<frontend-name>.<org>/<user-annotation-name>`
342+
`frontend.<frontend-name>.<org>/<custom-annotation-name>`
343343

344-
the only difference is extra information what frontend this settings belong to. With HAProxy Ingress controller, you have 3 different frontends: `http`, `https` and `stats`, each can be customized with user annotations.
344+
the only difference is extra information what frontend this settings belong to. With HAProxy Ingress controller, you have 3 different frontends: `http`, `https` and `stats`, each can be customized with custom annotations.
345345

346346

347-
## Where can user annotations can be defined ?
347+
## Where can custom annotations can be defined ?
348348

349349
### Frontend Annotations
350350

@@ -357,7 +357,7 @@ metadata:
357357
name: haproxy-kubernetes-ingress
358358
namespace: haproxy-controller
359359
annotations:
360-
frontend.<frontend-name>.<org>/<user-annotation-name>: <value>
360+
frontend.<frontend-name>.<org>/<custom-annotation-name>: <value>
361361
```
362362

363363
### Backend Annotations
@@ -366,8 +366,8 @@ you can define them on:
366366

367367
- `configmap` - this will be applied for each backend
368368
- ⚠ `ingress` - this will be applied on services used in ingress. **use with precaution.**
369-
- setting user annotations on ingress level is disabled by default!
370-
- use `--enable-user-annotations-on-ingress` to enable it. Setting different annotation values in different ingresses for same service will trigger **inconsistencies**, so this is not encouraged. use `service` annotations.
369+
- setting custom annotations on ingress level is disabled by default!
370+
- use `--enable-custom-annotations-on-ingress` to enable it. Setting different annotation values in different ingresses for same service will trigger **inconsistencies**, so this is not encouraged. use `service` annotations.
371371
- `service` - this will be applied just on service
372372

373373
#### what happens if you try to use same annotation on multiple places

documentation/annotations.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
## HAProxy kubernetes ingress controller 3.0
55
This is autogenerated from [doc.yaml](doc.yaml). Description can be found in [generator readme](gen/README.md)
66

7+
### Custom annotations
8+
9+
more info about custom annotations can be found in [annotations-custom.md](annotations-custom.md)
10+
711
### Available annotations
812

913
> :information_source: Ingress and service annotations can have `ingress.kubernetes.io`, `haproxy.org` and `haproxy.com` prefixes

documentation/controller.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Image can be run with arguments:
5050
| [`--input-file`](#--input-file) :construction:(dev) | |
5151
| [`--output-file`](#--output-file) :construction:(dev) | |
5252
| [`--disable-ingress-status-update`](#--disable-ingress-status-update) | `false` |
53-
| [`--enable-user-annotations-on-ingress`](#--enable-user-annotations-on-ingress) :construction:(dev) | |
53+
| [`--enable-custom-annotations-on-ingress`](#--enable-custom-annotations-on-ingress) :construction:(dev) | |
5454

5555

5656
### `--configmap`
@@ -907,12 +907,12 @@ Example:
907907

908908
***
909909

910-
### `--enable-user-annotations-on-ingress`
910+
### `--enable-custom-annotations-on-ingress`
911911

912912

913913
> :construction: this is only available from next version, currently available in dev build
914914

915-
Enable support for user annotations on ingress resources.
915+
Enable support for custom annotations on ingress resources.
916916
Use with caution when using the same annotation on multiple ingresses for same service.
917917

918918
Possible values:
@@ -922,7 +922,7 @@ Possible values:
922922
Example:
923923

924924
```yaml
925-
--enable-user-annotations-on-ingress
925+
--enable-custom-annotations-on-ingress
926926
```
927927

928928
<p align='right'><a href='#haproxy-kubernetes-ingress-controller'>:arrow_up_small: back to top</a></p>

documentation/doc.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,11 @@ image_arguments:
430430
default: false
431431
version_min: "3.0"
432432
example: --disable-ingress-status-update
433-
- argument: --enable-user-annotations-on-ingress
433+
- argument: --enable-custom-annotations-on-ingress
434434
description: |-
435-
Enable support for user annotations on ingress resources.
435+
Enable support for custom annotations on ingress resources.
436436
Use with caution when using the same annotation on multiple ingresses for same service.
437-
example: --enable-user-annotations-on-ingress
437+
example: --enable-custom-annotations-on-ingress
438438
version_min: "3.2"
439439
values:
440440
- Boolean value, just need to declare the flag

pkg/k8s/informers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ func (k k8s) addIngressHandlers(eventChan chan k8ssync.SyncDataEvent, informer c
637637
_, err := informer.AddEventHandler(
638638
cache.ResourceEventHandlerFuncs{
639639
AddFunc: func(obj interface{}) {
640-
item, err := store.ConvertToIngress(obj, osArgs.EnableUserAnnotationsIngress)
640+
item, err := store.ConvertToIngress(obj, osArgs.EnableCustomAnnotationsOnIngress)
641641
if err != nil {
642642
logger.Errorf("%s: Invalid data from k8s api, %s", k8ssync.INGRESS, obj)
643643
return
@@ -654,7 +654,7 @@ func (k k8s) addIngressHandlers(eventChan chan k8ssync.SyncDataEvent, informer c
654654
eventChan <- ToSyncDataEvent(item, item, uid, resourceVersion)
655655
},
656656
DeleteFunc: func(obj interface{}) {
657-
item, err := store.ConvertToIngress(obj, osArgs.EnableUserAnnotationsIngress)
657+
item, err := store.ConvertToIngress(obj, osArgs.EnableCustomAnnotationsOnIngress)
658658
if err != nil {
659659
logger.Errorf("%s: Invalid data from k8s api, %s", k8ssync.INGRESS, obj)
660660
return
@@ -671,7 +671,7 @@ func (k k8s) addIngressHandlers(eventChan chan k8ssync.SyncDataEvent, informer c
671671
eventChan <- ToSyncDataEvent(item, item, uid, resourceVersion)
672672
},
673673
UpdateFunc: func(oldObj, newObj interface{}) {
674-
item, err := store.ConvertToIngress(newObj, osArgs.EnableUserAnnotationsIngress)
674+
item, err := store.ConvertToIngress(newObj, osArgs.EnableCustomAnnotationsOnIngress)
675675
if err != nil {
676676
logger.Errorf("%s: Invalid data from k8s api, %s", k8ssync.INGRESS, oldObj)
677677
return

pkg/utils/flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,5 @@ type OSArgs struct {
123123
CRDInputFile string `long:"input-file" description:"The file path of a CRD manifest to convert"`
124124
CRDOutputFile string `long:"output-file" description:"The file path of the converted (to the most recent version) CRD manifest"`
125125
DisableIngressStatusUpdate bool `long:"disable-ingress-status-update" description:"If true, disables updating the status field of Ingress resources"`
126-
EnableUserAnnotationsIngress bool `long:"enable-user-annotations-on-ingress" description:"allow custom user annotations on ingress"`
126+
EnableCustomAnnotationsOnIngress bool `long:"enable-custom-annotations-on-ingress" description:"allow custom user annotations on ingress"`
127127
}

0 commit comments

Comments
 (0)