Skip to content

Commit

Permalink
revert status check for skipjob
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhny committed Aug 21, 2024
1 parent cd5e4d6 commit a7fc542
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
8 changes: 4 additions & 4 deletions api/v1alpha1/skipjob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ type SKIPJobStatus struct {
// +kubebuilder:object:generate=true
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.summary.status`
//
// A SKIPJob is either defined as a one-off or a scheduled job. If the Cron field is set for SKIPJob, it may not be removed. If the Cron field is unset, it may not be added.
// The Container field of a SKIPJob is only mutable if the Cron field is set. If unset, you must delete your SKIPJob to change container settings.
// +kubebuilder:validation:XValidation:rule="(has(oldSelf.spec.cron) && has(self.spec.cron)) || (!has(oldSelf.spec.cron) && !has(self.spec.cron))", message="After creation of a SKIPJob you may not remove the Cron field if it was previously present, or add it if it was previously omitted. Please delete the SKIPJob to change its nature from a one-off/scheduled job."
// +kubebuilder:validation:XValidation:rule="(size(self.status.subresources) == 0|| ((!has(self.spec.cron) && (oldSelf.spec.container == self.spec.container)) || has(self.spec.cron)))", message="The field Container is immutable for one-off jobs. Please delete your SKIPJob to change the containers settings."
// SKIPJob is the Schema for the skipjobs API
type SKIPJob struct {
metav1.TypeMeta `json:",inline"`
Expand All @@ -64,6 +60,10 @@ type SKIPJobList struct {
// SKIPJobSpec defines the desired state of SKIPJob
//
// +kubebuilder:object:generate=true
// A SKIPJob is either defined as a one-off or a scheduled job. If the Cron field is set for SKIPJob, it may not be removed. If the Cron field is unset, it may not be added.
// The Container field of a SKIPJob is only mutable if the Cron field is set. If unset, you must delete your SKIPJob to change container settings.
// +kubebuilder:validation:XValidation:rule="(has(oldSelf.cron) && has(self.cron)) || (!has(oldSelf.cron) && !has(self.cron))", message="After creation of a SKIPJob you may not remove the Cron field if it was previously present, or add it if it was previously omitted. Please delete the SKIPJob to change its nature from a one-off/scheduled job."
// +kubebuilder:validation:XValidation:rule="((!has(self.cron) && (oldSelf.container == self.container)) || has(self.cron))", message="The field Container is immutable for one-off jobs. Please delete your SKIPJob to change the containers settings."
type SKIPJobSpec struct {
// Settings for the actual Job. If you use a scheduled job, the settings in here will also specify the template of the job.
//
Expand Down
32 changes: 17 additions & 15 deletions config/crd/skiperator.kartverket.no_skipjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: |-
A SKIPJob is either defined as a one-off or a scheduled job. If the Cron field is set for SKIPJob, it may not be removed. If the Cron field is unset, it may not be added.
The Container field of a SKIPJob is only mutable if the Cron field is set. If unset, you must delete your SKIPJob to change container settings.
SKIPJob is the Schema for the skipjobs API
description: SKIPJob is the Schema for the skipjobs API
properties:
apiVersion:
description: |-
Expand All @@ -44,7 +41,11 @@ spec:
metadata:
type: object
spec:
description: SKIPJobSpec defines the desired state of SKIPJob
description: |-
SKIPJobSpec defines the desired state of SKIPJob
A SKIPJob is either defined as a one-off or a scheduled job. If the Cron field is set for SKIPJob, it may not be removed. If the Cron field is unset, it may not be added.
The Container field of a SKIPJob is only mutable if the Cron field is set. If unset, you must delete your SKIPJob to change container settings.
properties:
container:
description: |-
Expand Down Expand Up @@ -835,6 +836,17 @@ spec:
required:
- container
type: object
x-kubernetes-validations:
- message: After creation of a SKIPJob you may not remove the Cron field
if it was previously present, or add it if it was previously omitted.
Please delete the SKIPJob to change its nature from a one-off/scheduled
job.
rule: (has(oldSelf.cron) && has(self.cron)) || (!has(oldSelf.cron) &&
!has(self.cron))
- message: The field Container is immutable for one-off jobs. Please delete
your SKIPJob to change the containers settings.
rule: ((!has(self.cron) && (oldSelf.container == self.container)) ||
has(self.cron))
status:
description: |-
SkiperatorStatus
Expand Down Expand Up @@ -941,16 +953,6 @@ spec:
required:
- spec
type: object
x-kubernetes-validations:
- message: After creation of a SKIPJob you may not remove the Cron field if
it was previously present, or add it if it was previously omitted. Please
delete the SKIPJob to change its nature from a one-off/scheduled job.
rule: (has(oldSelf.spec.cron) && has(self.spec.cron)) || (!has(oldSelf.spec.cron)
&& !has(self.spec.cron))
- message: The field Container is immutable for one-off jobs. Please delete
your SKIPJob to change the containers settings.
rule: (size(self.status.subresources) == 0|| ((!has(self.spec.cron) && (oldSelf.spec.container
== self.spec.container)) || has(self.spec.cron)))
served: true
storage: true
subresources:
Expand Down

0 comments on commit a7fc542

Please sign in to comment.