Skip to content

Commit ca12b9d

Browse files
authored
feat(crd): add deployment policy (#99)
* feat(crd): add deployment policy * add deployment policy to project file
1 parent 7ecb54c commit ca12b9d

File tree

8 files changed

+937
-2
lines changed

8 files changed

+937
-2
lines changed
Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
---
18+
apiVersion: apiextensions.k8s.io/v1
19+
kind: CustomResourceDefinition
20+
metadata:
21+
annotations:
22+
controller-gen.kubebuilder.io/version: v0.18.0
23+
name: deploymentpolicies.skyhook.nvidia.com
24+
spec:
25+
group: skyhook.nvidia.com
26+
names:
27+
kind: DeploymentPolicy
28+
listKind: DeploymentPolicyList
29+
plural: deploymentpolicies
30+
singular: deploymentpolicy
31+
scope: Namespaced
32+
versions:
33+
- name: v1alpha1
34+
schema:
35+
openAPIV3Schema:
36+
description: DeploymentPolicy configures safe rollout defaults and compartment
37+
overrides
38+
properties:
39+
apiVersion:
40+
description: |-
41+
APIVersion defines the versioned schema of this representation of an object.
42+
Servers should convert recognized schemas to the latest internal value, and
43+
may reject unrecognized values.
44+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
45+
type: string
46+
kind:
47+
description: |-
48+
Kind is a string value representing the REST resource this object represents.
49+
Servers may infer this from the endpoint the client submits requests to.
50+
Cannot be updated.
51+
In CamelCase.
52+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
53+
type: string
54+
metadata:
55+
type: object
56+
spec:
57+
description: DeploymentPolicySpec defines rollout ceilings/strategy by
58+
default and per-compartment
59+
properties:
60+
compartments:
61+
description: Compartments, each with selector and budget; optional
62+
strategy
63+
items:
64+
description: Compartment defines a named selector with its own ceiling
65+
and optional strategy
66+
properties:
67+
budget:
68+
description: Exactly one of percent or count
69+
properties:
70+
count:
71+
minimum: 1
72+
type: integer
73+
percent:
74+
maximum: 100
75+
minimum: 1
76+
type: integer
77+
type: object
78+
name:
79+
description: Unique name within the policy
80+
minLength: 1
81+
type: string
82+
selector:
83+
description: Selector defining the nodes in this compartment
84+
properties:
85+
matchExpressions:
86+
description: matchExpressions is a list of label selector
87+
requirements. The requirements are ANDed.
88+
items:
89+
description: |-
90+
A label selector requirement is a selector that contains values, a key, and an operator that
91+
relates the key and values.
92+
properties:
93+
key:
94+
description: key is the label key that the selector
95+
applies to.
96+
type: string
97+
operator:
98+
description: |-
99+
operator represents a key's relationship to a set of values.
100+
Valid operators are In, NotIn, Exists and DoesNotExist.
101+
type: string
102+
values:
103+
description: |-
104+
values is an array of string values. If the operator is In or NotIn,
105+
the values array must be non-empty. If the operator is Exists or DoesNotExist,
106+
the values array must be empty. This array is replaced during a strategic
107+
merge patch.
108+
items:
109+
type: string
110+
type: array
111+
x-kubernetes-list-type: atomic
112+
required:
113+
- key
114+
- operator
115+
type: object
116+
type: array
117+
x-kubernetes-list-type: atomic
118+
matchLabels:
119+
additionalProperties:
120+
type: string
121+
description: |-
122+
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
123+
map is equivalent to an element of matchExpressions, whose key field is "key", the
124+
operator is "In", and the values array contains only "value". The requirements are ANDed.
125+
type: object
126+
type: object
127+
x-kubernetes-map-type: atomic
128+
strategy:
129+
description: Optional per-compartment strategy override
130+
properties:
131+
exponential:
132+
properties:
133+
batchThreshold:
134+
maximum: 100
135+
minimum: 1
136+
type: integer
137+
failureThreshold:
138+
minimum: 1
139+
type: integer
140+
growthFactor:
141+
minimum: 2
142+
type: integer
143+
initialBatch:
144+
minimum: 1
145+
type: integer
146+
safetyLimit:
147+
maximum: 100
148+
minimum: 1
149+
type: integer
150+
type: object
151+
fixed:
152+
description: Strategy parameters
153+
properties:
154+
batchThreshold:
155+
maximum: 100
156+
minimum: 1
157+
type: integer
158+
failureThreshold:
159+
minimum: 1
160+
type: integer
161+
initialBatch:
162+
minimum: 1
163+
type: integer
164+
safetyLimit:
165+
maximum: 100
166+
minimum: 1
167+
type: integer
168+
type: object
169+
linear:
170+
properties:
171+
batchThreshold:
172+
maximum: 100
173+
minimum: 1
174+
type: integer
175+
delta:
176+
minimum: 1
177+
type: integer
178+
failureThreshold:
179+
minimum: 1
180+
type: integer
181+
initialBatch:
182+
minimum: 1
183+
type: integer
184+
safetyLimit:
185+
maximum: 100
186+
minimum: 1
187+
type: integer
188+
type: object
189+
type: object
190+
required:
191+
- budget
192+
- name
193+
- selector
194+
type: object
195+
type: array
196+
default:
197+
description: Default budget/strategy for unmatched nodes
198+
properties:
199+
budget:
200+
description: Exactly one of percent or count
201+
properties:
202+
count:
203+
minimum: 1
204+
type: integer
205+
percent:
206+
maximum: 100
207+
minimum: 1
208+
type: integer
209+
type: object
210+
strategy:
211+
description: Strategy to use
212+
properties:
213+
exponential:
214+
properties:
215+
batchThreshold:
216+
maximum: 100
217+
minimum: 1
218+
type: integer
219+
failureThreshold:
220+
minimum: 1
221+
type: integer
222+
growthFactor:
223+
minimum: 2
224+
type: integer
225+
initialBatch:
226+
minimum: 1
227+
type: integer
228+
safetyLimit:
229+
maximum: 100
230+
minimum: 1
231+
type: integer
232+
type: object
233+
fixed:
234+
description: Strategy parameters
235+
properties:
236+
batchThreshold:
237+
maximum: 100
238+
minimum: 1
239+
type: integer
240+
failureThreshold:
241+
minimum: 1
242+
type: integer
243+
initialBatch:
244+
minimum: 1
245+
type: integer
246+
safetyLimit:
247+
maximum: 100
248+
minimum: 1
249+
type: integer
250+
type: object
251+
linear:
252+
properties:
253+
batchThreshold:
254+
maximum: 100
255+
minimum: 1
256+
type: integer
257+
delta:
258+
minimum: 1
259+
type: integer
260+
failureThreshold:
261+
minimum: 1
262+
type: integer
263+
initialBatch:
264+
minimum: 1
265+
type: integer
266+
safetyLimit:
267+
maximum: 100
268+
minimum: 1
269+
type: integer
270+
type: object
271+
type: object
272+
type: object
273+
required:
274+
- default
275+
type: object
276+
type: object
277+
served: true
278+
storage: true

chart/templates/skyhook-crd.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,21 @@ spec:
105105
type: string
106106
type: object
107107
type: array
108+
deploymentPolicy:
109+
description: DeploymentPolicy is the name of a DeploymentPolicy for
110+
rollout settings
111+
properties:
112+
name:
113+
default: ""
114+
description: |-
115+
Name of the referent.
116+
This field is effectively required, but due to backwards compatibility is
117+
allowed to be empty. Instances of this type with an empty value here are
118+
almost certainly wrong.
119+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
120+
type: string
121+
type: object
122+
x-kubernetes-map-type: atomic
108123
interruptionBudget:
109124
description: InterruptionBudget configures how many nodes that match
110125
node selectors that allowed to be interrupted at once.

operator/PROJECT

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,12 @@ resources:
2626
kind: Pod
2727
path: k8s.io/api/core/v1
2828
version: v1
29+
- api:
30+
crdVersion: v1
31+
namespaced: true
32+
domain: nvidia.com
33+
group: skyhook
34+
kind: DeploymentPolicy
35+
path: github.com/NVIDIA/skyhook/operator/api/v1alpha1
36+
version: v1alpha1
2937
version: "3"

0 commit comments

Comments
 (0)