Skip to content

Commit

Permalink
Allow disabling validation
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
  • Loading branch information
stefanprodan committed Nov 12, 2020
1 parent a3a743e commit 2ba6252
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions api/v1beta1/kustomization_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ type KustomizationSpec struct {
Timeout *metav1.Duration `json:"timeout,omitempty"`

// Validate the Kubernetes objects before applying them on the cluster.
// The validation strategy can be 'client' (local dry-run) or 'server' (APIServer dry-run).
// +kubebuilder:validation:Enum=client;server
// The validation strategy can be 'client' (local dry-run), 'server' (APIServer dry-run) or 'none'.
// +kubebuilder:validation:Enum=none;client;server
// +optional
Validation string `json:"validation,omitempty"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,10 @@ spec:
type: string
validation:
description: Validate the Kubernetes objects before applying them
on the cluster. The validation strategy can be 'client' (local dry-run)
or 'server' (APIServer dry-run).
on the cluster. The validation strategy can be 'client' (local dry-run),
'server' (APIServer dry-run) or 'none'.
enum:
- none
- client
- server
type: string
Expand Down
2 changes: 1 addition & 1 deletion controllers/kustomization_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ func (r *KustomizationReconciler) reconcileDelete(ctx context.Context, log logr.
}

func (r *KustomizationReconciler) validate(kustomization kustomizev1.Kustomization, dirPath string) error {
if kustomization.Spec.Validation == "" {
if kustomization.Spec.Validation == "" || kustomization.Spec.Validation == "none" {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions docs/api/kustomize.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ string
<td>
<em>(Optional)</em>
<p>Validate the Kubernetes objects before applying them on the cluster.
The validation strategy can be &lsquo;client&rsquo; (local dry-run) or &lsquo;server&rsquo; (APIServer dry-run).</p>
The validation strategy can be &lsquo;client&rsquo; (local dry-run), &lsquo;server&rsquo; (APIServer dry-run) or &lsquo;none&rsquo;.</p>
</td>
</tr>
</table>
Expand Down Expand Up @@ -672,7 +672,7 @@ string
<td>
<em>(Optional)</em>
<p>Validate the Kubernetes objects before applying them on the cluster.
The validation strategy can be &lsquo;client&rsquo; (local dry-run) or &lsquo;server&rsquo; (APIServer dry-run).</p>
The validation strategy can be &lsquo;client&rsquo; (local dry-run), &lsquo;server&rsquo; (APIServer dry-run) or &lsquo;none&rsquo;.</p>
</td>
</tr>
</tbody>
Expand Down
4 changes: 2 additions & 2 deletions docs/spec/v1beta1/kustomization.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ type KustomizationSpec struct {
Timeout *metav1.Duration `json:"timeout,omitempty"`

// Validate the Kubernetes objects before applying them on the cluster.
// The validation strategy can be 'client' (local dry-run) or 'server' (APIServer dry-run).
// +kubebuilder:validation:Enum=client;server
// The validation strategy can be 'client' (local dry-run), 'server' (APIServer dry-run) or 'none'.
// +kubebuilder:validation:Enum=none;client;server
// +optional
Validation string `json:"validation,omitempty"`
}
Expand Down

0 comments on commit 2ba6252

Please sign in to comment.