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
31 changes: 17 additions & 14 deletions api/v1/clusterobjectdeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ type ClusterObjectDeploymentSpec struct {
// +optional
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`

// progressDeadlineMinutes is the maximum number of minutes a revision may take
// to roll out, measured from the ClusterObjectSet's creation timestamp. Time
// spent waiting for the ClusterObjectSet to be created is not counted. The
// deadline covers all phases together; completing a phase does not reset it.
// Once a revision has completed, the deadline no longer applies, even if it
// later becomes unhealthy. When omitted, no deadline is enforced. The minimum
// period is 1 minute, and the maximum is 720 minutes (12 hours).
//
// The deadline is rollout policy, not revision content: changing it does not
// create a new revision and applies immediately to the latest active revision.
//
// +kubebuilder:validation:Minimum:=1
// +kubebuilder:validation:Maximum:=720
// +optional
ProgressDeadlineMinutes int32 `json:"progressDeadlineMinutes,omitempty"`

// template is the desired content of newly created ClusterObjectSets.
// Changes to template create a new revision; existing revisions remain immutable.
// +required
Expand Down Expand Up @@ -119,19 +135,6 @@ type ClusterObjectDeploymentTemplateSpec struct {
// +listMapKey=name
Phases []ClusterObjectSetPhase `json:"phases,omitempty"` // These are ordered groups of objects, not an enum describing lifecycle state.

// progressDeadlineMinutes is the maximum number of minutes a revision may take
// to roll out, measured from the ClusterObjectSet's creation timestamp. Time
// spent waiting for the ClusterObjectSet to be created is not counted. The
// deadline covers all phases together; completing a phase does not reset it.
// Once a revision has completed, the deadline no longer applies, even if it
// later becomes unhealthy. When omitted, no deadline is enforced. The minimum
// period is 1 minute, and the maximum is 720 minutes (12 hours).
//
// +kubebuilder:validation:Minimum:=1
// +kubebuilder:validation:Maximum:=720
// +optional
ProgressDeadlineMinutes int32 `json:"progressDeadlineMinutes,omitempty"`

// progressionProbes supplies custom readiness probes for objects in every phase.
// The same selector and assertion semantics as ClusterObjectSet.spec.progressionProbes apply.
// When set, must contain 1 to 20 probes.
Expand All @@ -156,7 +159,7 @@ type ClusterObjectDeploymentStatus struct {
// rollout is incomplete, or False with reason NewClusterObjectSetProgressed after
// completion. Completion remains recorded even if the completed revision later
// becomes unhealthy. Progressing is False with reason ProgressDeadlineExceeded when
// the latest revision does not roll out within spec.template.spec.progressDeadlineMinutes.
// the latest revision does not roll out within spec.progressDeadlineMinutes.
// Progressing is False with reason InvalidSpecification when spec.template.metadata
// contains labels or annotations that are not valid for the resulting
// ClusterObjectSet; no new revision is created until the metadata is corrected.
Expand Down
10 changes: 5 additions & 5 deletions api/v1/clusterobjectdeployment_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,13 @@ func TestClusterObjectDeploymentTemplateSchema(t *testing.T) {
cod := newTestClusterObjectDeployment("cod-template-progress-deadline")
raw, err := runtime.DefaultUnstructuredConverter.ToUnstructured(cod)
require.NoError(t, err)
require.NoError(t, unstructured.SetNestedField(raw, int64(10), "spec", "template", "spec", "progressDeadlineMinutes"))
require.NoError(t, unstructured.SetNestedField(raw, int64(10), "spec", "progressDeadlineMinutes"))
obj := &unstructured.Unstructured{Object: raw}
require.NoError(t, c.Create(t.Context(), obj))
require.NoError(t, c.Get(t.Context(), client.ObjectKeyFromObject(obj), obj))
value, found, err := unstructured.NestedInt64(obj.Object, "spec", "template", "spec", "progressDeadlineMinutes")
value, found, err := unstructured.NestedInt64(obj.Object, "spec", "progressDeadlineMinutes")
require.NoError(t, err)
require.True(t, found, "template must expose progressDeadlineMinutes")
require.True(t, found, "spec must expose progressDeadlineMinutes")
require.Equal(t, int64(10), value)
})
}
Expand All @@ -282,11 +282,11 @@ func TestClusterObjectDeploymentDeferredFieldsArePruned(t *testing.T) {
cod := newTestClusterObjectDeployment("cod-deferred-fields")
raw, err := runtime.DefaultUnstructuredConverter.ToUnstructured(cod)
require.NoError(t, err)
require.NoError(t, unstructured.SetNestedField(raw, int64(10), "spec", "progressDeadlineMinutes"))
require.NoError(t, unstructured.SetNestedField(raw, int64(10), "spec", "template", "spec", "group"))
obj := &unstructured.Unstructured{Object: raw}
require.NoError(t, c.Create(t.Context(), obj))
require.NoError(t, c.Get(t.Context(), client.ObjectKeyFromObject(obj), obj))
for _, path := range [][]string{{"spec", "progressDeadlineMinutes"}} {
for _, path := range [][]string{{"spec", "template", "spec", "group"}} {
_, found, err := unstructured.NestedFieldNoCopy(obj.Object, path...)
require.NoError(t, err)
require.False(t, found, "deployment must not expose %s", strings.Join(path, "."))
Expand Down
16 changes: 4 additions & 12 deletions api/v1/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,39 +117,31 @@ func TestValidate(t *testing.T) {
"ClusterObjectDeployment: valid progress deadline = 1": {
args: args{
object: ClusterObjectDeploymentSpec{
Template: ClusterObjectDeploymentTemplate{
Spec: ClusterObjectDeploymentTemplateSpec{ProgressDeadlineMinutes: 1},
},
ProgressDeadlineMinutes: 1,
},
},
want: want{valid: true},
},
"ClusterObjectDeployment: valid progress deadline = 10": {
args: args{
object: ClusterObjectDeploymentSpec{
Template: ClusterObjectDeploymentTemplate{
Spec: ClusterObjectDeploymentTemplateSpec{ProgressDeadlineMinutes: 10},
},
ProgressDeadlineMinutes: 10,
},
},
want: want{valid: true},
},
"ClusterObjectDeployment: valid progress deadline = 720": {
args: args{
object: ClusterObjectDeploymentSpec{
Template: ClusterObjectDeploymentTemplate{
Spec: ClusterObjectDeploymentTemplateSpec{ProgressDeadlineMinutes: 720},
},
ProgressDeadlineMinutes: 720,
},
},
want: want{valid: true},
},
"ClusterObjectDeployment: invalid progress deadline > 720": {
args: args{
object: ClusterObjectDeploymentSpec{
Template: ClusterObjectDeploymentTemplate{
Spec: ClusterObjectDeploymentTemplateSpec{ProgressDeadlineMinutes: 721},
},
ProgressDeadlineMinutes: 721,
},
},
want: want{valid: false, errContains: "spec.progressDeadlineMinutes"},
Expand Down
21 changes: 20 additions & 1 deletion applyconfigurations/api/v1/clusterobjectdeploymentspec.go

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

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

16 changes: 0 additions & 16 deletions applyconfigurations/api/v1/clusterobjectdeploymenttemplatespec.go

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

6 changes: 3 additions & 3 deletions applyconfigurations/internal/internal.go

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

2 changes: 1 addition & 1 deletion config/samples/olm_v1_clusterobjectdeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
name: cod-example
spec:
revisionHistoryLimit: 2
progressDeadlineMinutes: 10
template:
metadata:
labels:
Expand All @@ -17,7 +18,6 @@ spec:
example.com/description: Configuration managed by a standalone COD
spec:
collisionProtection: Prevent
progressDeadlineMinutes: 10
phases:
- name: configuration
objects:
Expand Down
Loading
Loading