Skip to content

Commit

Permalink
Merge pull request #542 from tibuntu/fix-statuscake-regions-not-being…
Browse files Browse the repository at this point in the history
…-set

StatusCake: Use regions instead of node_locations
  • Loading branch information
MuneebAijaz authored Nov 22, 2023
2 parents 6e51205 + 25dfc15 commit a579736
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 17 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
6 changes: 3 additions & 3 deletions charts/ingressmonitorcontroller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ replicaCount: 1

image:
repository: stakater/ingressmonitorcontroller
tag: v2.1.44
tag: v2.1.45
pullPolicy: IfNotPresent
imagePullSecrets: []

Expand All @@ -17,7 +17,7 @@ kube-rbac-proxy:
repository: gcr.io/kubebuilder/kube-rbac-proxy
tag: v0.8.0
pullPolicy: IfNotPresent
resources:
resources:
{}
securityContext:
{}
Expand Down Expand Up @@ -100,4 +100,4 @@ env: []

envFrom: []

serviceManagedBy: helm
serviceManagedBy: helm
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
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ kind: Kustomization
images:
- name: controller
newName: stakater/ingressmonitorcontroller
newTag: v2.1.44
newTag: v2.1.45
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 a579736

Please sign in to comment.