Merge pull request #565 from matheuscscp/lift-url-validation

Lift HTTP/S validation from Provider spec.address
This commit is contained in:
Stefan Prodan 2023-07-04 10:50:47 +03:00 committed by GitHub
commit 4dd70490b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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>
@ -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>

View File

@ -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`.