Skip to content

Commit

Permalink
Make Path an optional field and remove validation
Browse files Browse the repository at this point in the history
As due to secure joins, the requirement on both providing a path
and/or requiring it to be in a certain format offers little value
over the UX experience of not having to provide it when you just
want to reconcile whatever can be found in the root of the source
reference.

Signed-off-by: Hidde Beydals <hello@hidde.co>
  • Loading branch information
hiddeco committed Dec 16, 2020
1 parent 6a4bf74 commit 69a7e75
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 19 deletions.
11 changes: 6 additions & 5 deletions api/v1beta1/kustomization_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type KustomizationSpec struct {
// +optional
Decryption *Decryption `json:"decryption,omitempty"`

// The interval at which to reconcile the kustomization.
// The interval at which to reconcile the Kustomization.
// +required
Interval metav1.Duration `json:"interval"`

Expand All @@ -54,10 +54,11 @@ type KustomizationSpec struct {
// +optional
KubeConfig *KubeConfig `json:"kubeConfig,omitempty"`

// Path to the directory containing the kustomization file.
// +kubebuilder:validation:Pattern="^\\./"
// +required
Path string `json:"path"`
// Path to the directory containing the kustomization.yaml file, or the
// set of plain YAMLs a kustomization.yaml should be generated for.
// Defaults to 'None', which translates to the root path of the SourceRef.
// +optional
Path string `json:"path,omitempty"`

// Prune enables garbage collection.
// +required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ spec:
type: object
type: array
interval:
description: The interval at which to reconcile the kustomization.
description: The interval at which to reconcile the Kustomization.
type: string
kubeConfig:
description: The KubeConfig for reconciling the Kustomization on a
Expand All @@ -159,8 +159,10 @@ spec:
type: object
type: object
path:
description: Path to the directory containing the kustomization file.
pattern: ^\./
description: Path to the directory containing the kustomization.yaml
file, or the set of plain YAMLs a kustomization.yaml should be generated
for. Defaults to 'None', which translates to the root path of the
SourceRef.
type: string
prune:
description: Prune enables garbage collection.
Expand Down Expand Up @@ -219,7 +221,6 @@ spec:
type: string
required:
- interval
- path
- prune
- sourceRef
type: object
Expand Down
14 changes: 10 additions & 4 deletions docs/api/kustomize.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Kubernetes meta/v1.Duration
</em>
</td>
<td>
<p>The interval at which to reconcile the kustomization.</p>
<p>The interval at which to reconcile the Kustomization.</p>
</td>
</tr>
<tr>
Expand All @@ -134,7 +134,10 @@ string
</em>
</td>
<td>
<p>Path to the directory containing the kustomization file.</p>
<em>(Optional)</em>
<p>Path to the directory containing the kustomization.yaml file, or the
set of plain YAMLs a kustomization.yaml should be generated for.
Defaults to &lsquo;None&rsquo;, which translates to the root path of the SourceRef.</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -609,7 +612,7 @@ Kubernetes meta/v1.Duration
</em>
</td>
<td>
<p>The interval at which to reconcile the kustomization.</p>
<p>The interval at which to reconcile the Kustomization.</p>
</td>
</tr>
<tr>
Expand All @@ -635,7 +638,10 @@ string
</em>
</td>
<td>
<p>Path to the directory containing the kustomization file.</p>
<em>(Optional)</em>
<p>Path to the directory containing the kustomization.yaml file, or the
set of plain YAMLs a kustomization.yaml should be generated for.
Defaults to &lsquo;None&rsquo;, which translates to the root path of the SourceRef.</p>
</td>
</tr>
<tr>
Expand Down
1 change: 0 additions & 1 deletion docs/spec/v1alpha1/kustomization.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type KustomizationSpec struct {
KubeConfig *KubeConfig `json:"kubeConfig,omitempty"`

// Path to the directory containing the kustomization file.
// +kubebuilder:validation:Pattern="^\\./"
// +required
Path string `json:"path"`

Expand Down
11 changes: 6 additions & 5 deletions docs/spec/v1beta1/kustomization.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type KustomizationSpec struct {
// +optional
Decryption *Decryption `json:"decryption,omitempty"`

// The interval at which to apply the kustomization.
// The interval at which to reconcile the Kustomization.
// +required
Interval metav1.Duration `json:"interval"`

Expand All @@ -30,10 +30,11 @@ type KustomizationSpec struct {
// +optional
KubeConfig *KubeConfig `json:"kubeConfig,omitempty"`

// Path to the directory containing the kustomization.yaml file.
// +kubebuilder:validation:Pattern="^\\./"
// +required
Path string `json:"path"`
// Path to the directory containing the kustomization.yaml file, or the
// set of plain YAMLs a kustomization.yaml should be generated for.
// Defaults to 'None', which translates to the root path of the SourceRef.
// +optional
Path string `json:"path,omitempty"`

// Enables garbage collection.
// +required
Expand Down

0 comments on commit 69a7e75

Please sign in to comment.