Skip to content

Commit 19ed98c

Browse files
ryanzhang-ossRyan Zhang
and
Ryan Zhang
authored
feat: add rollout API spec (#897)
-------- Co-authored-by: Ryan Zhang <[email protected]>
1 parent 8a5f0d2 commit 19ed98c

11 files changed

+2273
-9
lines changed

apis/placement/v1alpha1/stagedupdate_types.go

+477
Large diffs are not rendered by default.

apis/placement/v1alpha1/zz_generated.deepcopy.go

+444
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/placement/v1beta1/clusterresourceplacement_types.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,11 @@ const (
410410

411411
// RolloutStrategy describes how to roll out a new change in selected resources to target clusters.
412412
type RolloutStrategy struct {
413-
// Type of rollout. The only supported type is "RollingUpdate". Default is "RollingUpdate".
413+
// Type of rollout. The only supported types are "RollingUpdate" and "External".
414+
// Default is "RollingUpdate".
414415
// +kubebuilder:validation:Optional
415-
// +kubebuilder:validation:Enum=RollingUpdate
416416
// +kubebuilder:default=RollingUpdate
417+
// +kubebuilder:validation:Enum=RollingUpdate;External
417418
Type RolloutStrategyType `json:"type,omitempty"`
418419

419420
// Rolling update config params. Present only if RolloutStrategyType = RollingUpdate.
@@ -515,6 +516,10 @@ const (
515516
// RollingUpdateRolloutStrategyType replaces the old placed resource using rolling update
516517
// i.e. gradually create the new one while replace the old ones.
517518
RollingUpdateRolloutStrategyType RolloutStrategyType = "RollingUpdate"
519+
520+
// ExternalRolloutStrategyType means there is an external rollout controller that will
521+
// handle the rollout of the resources.
522+
ExternalRolloutStrategyType RolloutStrategyType = "External"
518523
)
519524

520525
// RollingUpdateConfig contains the config to control the desired behavior of rolling update.

apis/placement/v1beta1/commons.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ const (
8282
// NamespacedName comprises a resource name, with a mandatory namespace.
8383
type NamespacedName struct {
8484
// Name is the name of the namespaced scope resource.
85-
// +required
85+
// +kubebuilder:validation:Required
8686
Name string `json:"name"`
87+
8788
// Namespace is namespace of the namespaced scope resource.
88-
// +required
89+
// +kubebuilder:validation:Required
8990
Namespace string `json:"namespace"`
9091
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.15.0
7+
name: approvalrequests.placement.kubernetes-fleet.io
8+
spec:
9+
group: placement.kubernetes-fleet.io
10+
names:
11+
categories:
12+
- fleet
13+
- fleet-placement
14+
kind: ApprovalRequest
15+
listKind: ApprovalRequestList
16+
plural: approvalrequests
17+
singular: approvalrequest
18+
scope: Namespaced
19+
versions:
20+
- name: v1alpha1
21+
schema:
22+
openAPIV3Schema:
23+
description: |-
24+
ApprovalRequest defines a request for the approval from the user.
25+
The request object MUST have the following labels:
26+
- `TargetUpdateRun` which points to the update run that this approval request is for.
27+
- `TargetStage` which is the name of the stage that this approval request is for.
28+
- `IsLatestUpdateRunApproval` which indicates whether this approval request is the latest one related to this update run.
29+
properties:
30+
apiVersion:
31+
description: |-
32+
APIVersion defines the versioned schema of this representation of an object.
33+
Servers should convert recognized schemas to the latest internal value, and
34+
may reject unrecognized values.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
36+
type: string
37+
kind:
38+
description: |-
39+
Kind is a string value representing the REST resource this object represents.
40+
Servers may infer this from the endpoint the client submits requests to.
41+
Cannot be updated.
42+
In CamelCase.
43+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
44+
type: string
45+
metadata:
46+
type: object
47+
spec:
48+
description: The desired state of ApprovalRequest.
49+
properties:
50+
parentStageRollout:
51+
description: The name of the staged update run that this approval
52+
request is for.
53+
type: string
54+
targetStage:
55+
description: The name of the update stage that this approval request
56+
is for.
57+
type: string
58+
required:
59+
- parentStageRollout
60+
- targetStage
61+
type: object
62+
x-kubernetes-validations:
63+
- message: The spec field is immutable
64+
rule: self == oldSelf
65+
status:
66+
description: The desired state of ApprovalRequest.
67+
properties:
68+
conditions:
69+
description: |-
70+
Conditions is an array of current observed conditions for the specific type of post update task.
71+
Known conditions are "Approved", and "ApprovalAccepted".
72+
items:
73+
description: "Condition contains details for one aspect of the current
74+
state of this API Resource.\n---\nThis struct is intended for
75+
direct use as an array at the field path .status.conditions. For
76+
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
77+
observations of a foo's current state.\n\t // Known .status.conditions.type
78+
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
79+
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
80+
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
81+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
82+
\ // other fields\n\t}"
83+
properties:
84+
lastTransitionTime:
85+
description: |-
86+
lastTransitionTime is the last time the condition transitioned from one status to another.
87+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
88+
format: date-time
89+
type: string
90+
message:
91+
description: |-
92+
message is a human readable message indicating details about the transition.
93+
This may be an empty string.
94+
maxLength: 32768
95+
type: string
96+
observedGeneration:
97+
description: |-
98+
observedGeneration represents the .metadata.generation that the condition was set based upon.
99+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
100+
with respect to the current state of the instance.
101+
format: int64
102+
minimum: 0
103+
type: integer
104+
reason:
105+
description: |-
106+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
107+
Producers of specific condition types may define expected values and meanings for this field,
108+
and whether the values are considered a guaranteed API.
109+
The value should be a CamelCase string.
110+
This field may not be empty.
111+
maxLength: 1024
112+
minLength: 1
113+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
114+
type: string
115+
status:
116+
description: status of the condition, one of True, False, Unknown.
117+
enum:
118+
- "True"
119+
- "False"
120+
- Unknown
121+
type: string
122+
type:
123+
description: |-
124+
type of condition in CamelCase or in foo.example.com/CamelCase.
125+
---
126+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
127+
useful (see .node.status.conditions), the ability to deconflict is important.
128+
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
129+
maxLength: 316
130+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
131+
type: string
132+
required:
133+
- lastTransitionTime
134+
- message
135+
- reason
136+
- status
137+
- type
138+
type: object
139+
type: array
140+
x-kubernetes-list-map-keys:
141+
- type
142+
x-kubernetes-list-type: map
143+
type: object
144+
required:
145+
- spec
146+
type: object
147+
served: true
148+
storage: true
149+
subresources:
150+
status: {}

config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1859,10 +1859,12 @@ spec:
18591859
type: object
18601860
type:
18611861
default: RollingUpdate
1862-
description: Type of rollout. The only supported type is "RollingUpdate".
1862+
description: |-
1863+
Type of rollout. The only supported types are "RollingUpdate" and "External".
18631864
Default is "RollingUpdate".
18641865
enum:
18651866
- RollingUpdate
1867+
- External
18661868
type: string
18671869
type: object
18681870
required:

0 commit comments

Comments
 (0)