Skip to content

Commit

Permalink
fix: Change from nodeLocations to regions to reflect current StatusCa…
Browse files Browse the repository at this point in the history
…ke API

Issue: #540
  • Loading branch information
tibuntu committed Nov 15, 2023
1 parent 6e51205 commit 0bb3c11
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/endpointmonitor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ type StatusCakeConfig struct {

// Comma separated list of Node Location IDs
// +optional
NodeLocations string `json:"nodeLocations,omitempty"`
Regions string `json:"regions,omitempty"`

// Comma separated list of HTTP codes to trigger error on
// +optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ spec:
followRedirect:
description: Enable ingress redirects
type: boolean
nodeLocations:
description: Comma separated list of Node Location IDs
regions:
description: Comma separated list of regions.
type: string
paused:
description: Pause the service
Expand Down
4 changes: 2 additions & 2 deletions charts/ingressmonitorcontroller/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: ingressmonitorcontroller
description: IngressMonitorController Operator chart that runs on kubernetes

# Helm chart Version
version: 2.1.44
version: 2.1.45

# Application version to be deployed
appVersion: 2.1.44
appVersion: 2.1.45

keywords:
- IngressMonitorController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ spec:
followRedirect:
description: Enable ingress redirects
type: boolean
nodeLocations:
description: Comma separated list of Node Location IDs
regions:
description: Comma separated list of regions.
type: string
paused:
description: Pause the service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ spec:
followRedirect:
description: Enable ingress redirects
type: boolean
nodeLocations:
description: Comma separated list of Node Location IDs
type: string
paused:
description: Pause the service
type: boolean
Expand All @@ -168,6 +165,9 @@ spec:
realBrowser:
description: Enable Real Browser
type: boolean
regions:
description: Comma separated list of Node Location IDs
type: string
statusCodes:
description: Comma separated list of HTTP codes to trigger error
on
Expand Down
7 changes: 4 additions & 3 deletions docs/statuscake-configuration.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# StatusCake Configuration

## Basic
The following properties need to be configured for Statuscake, in addition to the general properties listed
The following properties need to be configured for Statuscake, in addition to the general properties listed
in the [Configuration section of the README](../README.md#configuration):

| Key | Description |
Expand All @@ -25,15 +25,16 @@ Currently additional Statuscake configurations can be added through these fields
| TestTags | Comma separated list of tags |
| FindString | String to look for within the response |
| BasicAuthUser | Required for [basic-authenticationchecks](#basic-auth-checks) |
| Regions | Regions to execute the check from |


### Basic Auth checks

Statuscake supports checks completing basic auth requirements. In `EndpointMonitor` the field `basicAuthUser` can be used to trigger the Ingress Monitor attempting to configure this setting. The value of the field should be the *username* to be configured. The Ingress Monitor Controller will then attempt to access an OS env variable of the same name which will return the *password* that should be used. The env variable can be mounted within the Ingress Monitor Controller container via a secret.

For example; setting the field like `basic-auth-user: 'my-service-username'` will set the username field to the value `my-service-username` and will retrieve the password via `os.Getenv('my-service-username')` and set this appropriately.
For example; setting the field like `basic-auth-user: 'my-service-username'` will set the username field to the value `my-service-username` and will retrieve the password via `os.Getenv('my-service-username')` and set this appropriately.

## Example:
## Example:

```yaml
apiVersion: endpointmonitor.stakater.com/v1alpha1
Expand Down
1 change: 1 addition & 0 deletions examples/endpointMonitor/statuscake-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ spec:
triggerRate: 1
pingUrl: 'https://stakater2.com/'
contactGroup: '123456,654321'
regions: amsterdam, stockholm
url: 'https://stakater1.com/'
7 changes: 7 additions & 0 deletions pkg/monitors/statuscake/statuscake-monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ func buildUpsertForm(m models.Monitor, cgroup string) url.Values {
}
}

if providerConfig != nil && len(providerConfig.Regions) > 0 {
regions := convertStringToArray(providerConfig.Regions)
for _, region := range regions {
f.Add("regions[]", region)
}
}

if providerConfig != nil && len(providerConfig.BasicAuthUser) > 0 {
// This value is mandatory
// Environment variable should define the password
Expand Down

0 comments on commit 0bb3c11

Please sign in to comment.