Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lift HTTP/S validation from Provider spec.address #565

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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