Skip to content

Commit dd3af04

Browse files
authored
Merge pull request #8540 from abdelrahman882/capacity-buffer-ca
Add capacity buffers scalable objects, limits and fake pods injection
2 parents af53141 + 4cce41f commit dd3af04

File tree

63 files changed

+2996
-441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2996
-441
lines changed

cluster-autoscaler/apis/capacitybuffer/autoscaling.x-k8s.io/v1/doc.go renamed to cluster-autoscaler/apis/capacitybuffer/autoscaling.x-k8s.io/v1alpha1/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ limitations under the License.
2121
// +k8s:prerelease-lifecycle-gen=true
2222
// +kubebuilder:object:generate=true
2323

24-
package v1
24+
package v1alpha1

cluster-autoscaler/apis/capacitybuffer/autoscaling.x-k8s.io/v1/register.go renamed to cluster-autoscaler/apis/capacitybuffer/autoscaling.x-k8s.io/v1alpha1/register.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v1
17+
package v1alpha1
1818

1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -23,7 +23,7 @@ import (
2323
)
2424

2525
// SchemeGroupVersion is group version used to register these objects
26-
var SchemeGroupVersion = schema.GroupVersion{Group: "autoscaling.x-k8s.io", Version: "v1"}
26+
var SchemeGroupVersion = schema.GroupVersion{Group: "autoscaling.x-k8s.io", Version: "v1alpha1"}
2727

2828
// Resource takes an unqualified resource and returns a Group qualified GroupResource
2929
func Resource(resource string) schema.GroupResource {

cluster-autoscaler/apis/capacitybuffer/autoscaling.x-k8s.io/v1/types.go renamed to cluster-autoscaler/apis/capacitybuffer/autoscaling.x-k8s.io/v1alpha1/types.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ limitations under the License.
1818
// +groupName=autoscaling.x-k8s.io
1919
// +k8s:protobuf-gen=package
2020

21-
// Package v1 contains the v1 API for the autoscaling.x-k8s.io group.
21+
// Package v1alpha1 contains the v1alpha1 API for the autoscaling.x-k8s.io group.
2222
// This API group defines custom resources used by the Cluster Autoscaler
2323
// for managing buffer capacity.
24-
package v1
24+
package v1alpha1
2525

2626
import (
2727
"k8s.io/apimachinery/pkg/api/resource"
@@ -95,6 +95,8 @@ type ScalableRef struct {
9595
type ResourceList map[ResourceName]resource.Quantity
9696

9797
// CapacityBufferSpec defines the desired state of CapacityBuffer.
98+
// +kubebuilder:validation:XValidation:rule="!has(self.podTemplateRef) || has(self.replicas) || has(self.limits)",message="If X is set, replicas or limits must also be set"
99+
// +kubebuilder:validation:XValidation:rule="!(has(self.podTemplateRef) && has(self.scalableRef))",message="You must define both PodTemplateRef and ScalableRef"
98100
type CapacityBufferSpec struct {
99101
// ProvisioningStrategy defines how the buffer is utilized.
100102
// "buffer.x-k8s.io/active-capacity" is the default strategy, where the buffer actively scales up the cluster by creating placeholder pods.
@@ -172,6 +174,9 @@ type CapacityBufferStatus struct {
172174
// +listType=map
173175
// +listMapKey=type
174176
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,4,rep,name=conditions"`
177+
// ProvisioningStrategy defines how the buffer should be utilized.
178+
// +optional
179+
ProvisioningStrategy *string `json:"provisioningStrategy,omitempty" protobuf:"bytes,5,opt,name=provisioningStrategy"`
175180
}
176181

177182
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

cluster-autoscaler/apis/capacitybuffer/autoscaling.x-k8s.io/v1/zz_generated.deepcopy.go renamed to cluster-autoscaler/apis/capacitybuffer/autoscaling.x-k8s.io/v1alpha1/zz_generated.deepcopy.go

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cluster-autoscaler/apis/capacitybuffer/client/applyconfiguration/utils.go

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)