Skip to content
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
20 changes: 19 additions & 1 deletion apis/mysql/v1alpha1/provider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,27 @@ type ProviderConfigSpec struct {
// or use preferred to use TLS only when advertised by the server. This is similar
// to skip-verify, but additionally allows a fallback to a connection which is
// not encrypted. Neither skip-verify nor preferred add any reliable security.
// +kubebuilder:validation:Enum="true";skip-verify;preferred
// Alternatively, set tls=custom and provide a custom TLS configuration via the tlsConfig field.
// +kubebuilder:validation:Enum="true";skip-verify;preferred;custom
// +optional
TLS *string `json:"tls"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may consider enforcing this
https://kubernetes.io/docs/reference/using-api/cel/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be an interesting exercise, but I have never used CEL, would need to read up on it and learn it, so I'd maybe hope to get away with it! 😅

// Optional TLS configuration for sql driver. Setting this field also requires the tls field to be set to custom.
// +optional
TLSConfig *TLSConfig `json:"tlsConfig"`
}

// TLSConfig defines the TLS configuration for the provider when tls=custom.
type TLSConfig struct {
CACert TLSSecret `json:"caCert,omitempty"`
ClientCert TLSSecret `json:"clientCert,omitempty"`
ClientKey TLSSecret `json:"clientKey,omitempty"`
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
}

// TLSSecret defines a reference to a K8s secret and its specific internal key that contains the TLS cert/keys in PEM format.
type TLSSecret struct {
SecretRef xpv1.SecretKeySelector `json:"secretRef,omitempty"`
}

const (
Expand Down
39 changes: 39 additions & 0 deletions apis/mysql/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading