Skip to content

Commit

Permalink
Merge pull request #565 from matheuscscp/lift-url-validation
Browse files Browse the repository at this point in the history
Lift HTTP/S validation from Provider spec.address
  • Loading branch information
stefanprodan authored Jul 4, 2023
2 parents c6b8362 + 13d3d8f commit 4dd7049
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
6 changes: 4 additions & 2 deletions api/v1beta2/provider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ type ProviderSpec struct {
// +optional
Username string `json:"username,omitempty"`

// Address specifies the HTTP/S incoming webhook address of this Provider.
// +kubebuilder:validation:Pattern="^(http|https)://.*$"
// Address specifies the endpoint, in a generic sense, to where alerts are sent.
// What kind of endpoint depends on the specific Provider type being used.
// For the generic Provider, for example, this is an HTTP/S address.
// For other Provider types this could be a project ID or a namespace.
// +kubebuilder:validation:MaxLength:=2048
// +kubebuilder:validation:Optional
// +optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,12 @@ spec:
description: ProviderSpec defines the desired state of the Provider.
properties:
address:
description: Address specifies the HTTP/S incoming webhook address
of this Provider.
description: Address specifies the endpoint, in a generic sense, to
where alerts are sent. What kind of endpoint depends on the specific
Provider type being used. For the generic Provider, for example,
this is an HTTP/S address. For other Provider types this could be
a project ID or a namespace.
maxLength: 2048
pattern: ^(http|https)://.*$
type: string
certSecretRef:
description: CertSecretRef specifies the Secret containing a PEM-encoded
Expand Down
10 changes: 8 additions & 2 deletions docs/api/v1beta2/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ string
</td>
<td>
<em>(Optional)</em>
<p>Address specifies the HTTP/S incoming webhook address of this Provider.</p>
<p>Address specifies the endpoint, in a generic sense, to where alerts are sent.
What kind of endpoint depends on the specific Provider type being used.
For the generic Provider, for example, this is an HTTP/S address.
For other Provider types this could be a project ID or a namespace.</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -902,7 +905,10 @@ string
</td>
<td>
<em>(Optional)</em>
<p>Address specifies the HTTP/S incoming webhook address of this Provider.</p>
<p>Address specifies the endpoint, in a generic sense, to where alerts are sent.
What kind of endpoint depends on the specific Provider type being used.
For the generic Provider, for example, this is an HTTP/S address.
For other Provider types this could be a project ID or a namespace.</p>
</td>
</tr>
<tr>
Expand Down
5 changes: 4 additions & 1 deletion docs/spec/v1beta2/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,10 @@ stringData:

### Address

`.spec.address` is an optional field that specifies the URL where the events are posted.
`.spec.address` is an optional field that specifies the endpoint where the events are posted.
The meaning of endpoint here depends on the specific Provider type being used.
For the `generic` Provider for example this is an HTTP/S address.
For other Provider types this could be a project ID or a namespace.

If the address contains sensitive information such as tokens or passwords, it is
recommended to store the address in the Kubernetes secret referenced by `.spec.secretRef.name`.
Expand Down

0 comments on commit 4dd7049

Please sign in to comment.