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 // +optional
Username string `json:"username,omitempty"` Username string `json:"username,omitempty"`
// Address specifies the HTTP/S incoming webhook address of this Provider. // Address specifies the endpoint, in a generic sense, to where alerts are sent.
// +kubebuilder:validation:Pattern="^(http|https)://.*$" // 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:MaxLength:=2048
// +kubebuilder:validation:Optional // +kubebuilder:validation:Optional
// +optional // +optional

View File

@ -228,10 +228,12 @@ spec:
description: ProviderSpec defines the desired state of the Provider. description: ProviderSpec defines the desired state of the Provider.
properties: properties:
address: address:
description: Address specifies the HTTP/S incoming webhook address description: Address specifies the endpoint, in a generic sense, to
of this Provider. 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 maxLength: 2048
pattern: ^(http|https)://.*$
type: string type: string
certSecretRef: certSecretRef:
description: CertSecretRef specifies the Secret containing a PEM-encoded description: CertSecretRef specifies the Secret containing a PEM-encoded

View File

@ -313,7 +313,10 @@ string
</td> </td>
<td> <td>
<em>(Optional)</em> <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> </td>
</tr> </tr>
<tr> <tr>
@ -902,7 +905,10 @@ string
</td> </td>
<td> <td>
<em>(Optional)</em> <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> </td>
</tr> </tr>
<tr> <tr>

View File

@ -936,7 +936,10 @@ stringData:
### Address ### 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 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`. recommended to store the address in the Kubernetes secret referenced by `.spec.secretRef.name`.