Skip to content

Commit

Permalink
sync kruise 1.5.0 apis (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
zmberg committed Oct 16, 2023
1 parent fba43ee commit fb3acc0
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 44 deletions.
4 changes: 4 additions & 0 deletions apps/v1alpha1/cloneset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ type CloneSetStatus struct {
// indicated by updateRevision and have a Ready Condition.
UpdatedReadyReplicas int32 `json:"updatedReadyReplicas"`

// UpdatedAvailableReplicas is the number of Pods created by the CloneSet controller from the CloneSet version
// indicated by updateRevision and have a Ready Condition for at least minReadySeconds.
UpdatedAvailableReplicas int32 `json:"updatedAvailableReplicas,omitempty"`

// ExpectedUpdatedReplicas is the number of Pods that should be updated by CloneSet controller.
// This field is calculated via Replicas - Partition.
ExpectedUpdatedReplicas int32 `json:"expectedUpdatedReplicas,omitempty"`
Expand Down
10 changes: 9 additions & 1 deletion apps/v1alpha1/imagepulljob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ const (
// ImagePullJobSpec defines the desired state of ImagePullJob
type ImagePullJobSpec struct {
// Image is the image to be pulled by the job
Image string `json:"image"`
Image string `json:"image"`
ImagePullJobTemplate `json:",inline"`
}

type ImagePullJobTemplate struct {

// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling the image.
// If specified, these secrets will be passed to individual puller implementations for them to use. For example,
Expand Down Expand Up @@ -61,6 +65,10 @@ type ImagePullJobSpec struct {
// CompletionPolicy indicates the completion policy of the job.
// Default is Always CompletionPolicyType.
CompletionPolicy CompletionPolicy `json:"completionPolicy"`

// SandboxConfig support attach metadata in PullImage CRI interface during ImagePulljobs
// +optional
SandboxConfig *SandboxConfig `json:"sandboxConfig,omitempty"`
}

// ImagePullJobPodSelector is a selector over pods
Expand Down
4 changes: 4 additions & 0 deletions apps/v1alpha1/nodeimage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ type ImageSpec struct {

// Tags is a list of versions of this image
Tags []ImageTagSpec `json:"tags"`

// SandboxConfig support attach metadata in PullImage CRI interface during ImagePulljobs
// +optional
SandboxConfig *SandboxConfig `json:"sandboxConfig,omitempty"`
}

// ReferenceObject comprises a resource name, with a mandatory namespace,
Expand Down
25 changes: 25 additions & 0 deletions apps/v1alpha1/sandboxconfig_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright 2023 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

// SandboxConfig support attach metadata in PullImage CRI interface during ImagePulljobs
type SandboxConfig struct {
// +optional
Labels map[string]string `json:"labels,omitempty"`
// +optional
Annotations map[string]string `json:"annotations,omitempty"`
}
5 changes: 4 additions & 1 deletion apps/v1alpha1/sidecarset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
appspub "github.com/openkruise/kruise-api/apps/pub"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
Expand Down Expand Up @@ -260,7 +261,9 @@ type SidecarSetUpdateStrategy struct {
// This cannot be 0.
// Default value is 1.
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`

// Priorities are the rules for calculating the priority of updating pods.
// Each pod to be updated, will pass through these terms and get a sum of weights.
PriorityStrategy *appspub.UpdatePriorityStrategy `json:"priorityStrategy,omitempty"`
// ScatterStrategy defines the scatter rules to make pods been scattered when update.
// This will avoid pods with the same key-value to be updated in one batch.
// - Note that pods will be scattered after priority sort. So, although priority strategy and scatter strategy can be applied together, we suggest to use either one of them.
Expand Down
16 changes: 14 additions & 2 deletions apps/v1alpha1/uniteddeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ limitations under the License.
package v1alpha1

import (
"github.com/openkruise/kruise-api/apps/v1beta1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/intstr"

"github.com/openkruise/kruise-api/apps/v1beta1"
)

// UpdateStrategyType is a string enumeration type that enumerates
Expand Down Expand Up @@ -189,6 +191,13 @@ type Subset struct {
// Controller will try to keep all the subsets with nil replicas have average pods.
// +optional
Replicas *intstr.IntOrString `json:"replicas,omitempty"`
// Patch indicates patching to the templateSpec.
// Patch takes precedence over other fields
// If the Patch also modifies the Replicas, NodeSelectorTerm or Tolerations, use value in the Patch
// +optional
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Schemaless
Patch runtime.RawExtension `json:"patch,omitempty"`
}

// UnitedDeploymentStatus defines the observed state of UnitedDeployment.
Expand Down Expand Up @@ -232,6 +241,9 @@ type UnitedDeploymentStatus struct {
// Records the information of update progress.
// +optional
UpdateStatus *UpdateStatus `json:"updateStatus,omitempty"`

// LabelSelector is label selectors for query over pods that should match the replica count used by HPA.
LabelSelector string `json:"labelSelector,omitempty"`
}

// UnitedDeploymentCondition describes current state of a UnitedDeployment.
Expand Down Expand Up @@ -269,7 +281,7 @@ type UpdateStatus struct {
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelector
// +kubebuilder:resource:shortName=ud
// +kubebuilder:printcolumn:name="DESIRED",type="integer",JSONPath=".spec.replicas",description="The desired number of pods."
// +kubebuilder:printcolumn:name="CURRENT",type="integer",JSONPath=".status.replicas",description="The number of currently all pods."
Expand Down
2 changes: 2 additions & 0 deletions apps/v1alpha1/well_known_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const (

// ImagePreDownloadIgnoredKey indicates the images of this revision have been ignored to pre-download
ImagePreDownloadIgnoredKey = "apps.kruise.io/image-predownload-ignored"
// AnnotationSubsetPatchKey indicates the patch for every subset
AnnotationSubsetPatchKey = "apps.kruise.io/subset-patch"
)

// Sidecar container environment variable definitions which are used to enable SidecarTerminator to take effect on the sidecar container.
Expand Down
113 changes: 87 additions & 26 deletions apps/v1alpha1/zz_generated.deepcopy.go

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

4 changes: 4 additions & 0 deletions apps/v1beta1/statefulset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ type StatefulSetStatus struct {
// updatedReadyReplicas is the number of updated Pods created by the StatefulSet controller that have a Ready Condition.
UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"`

// updatedAvailableReplicas is the number of updated Pods created by the StatefulSet controller that have a Ready condition
//for atleast minReadySeconds.
UpdatedAvailableReplicas int32 `json:"updatedAvailableReplicas,omitempty"`

// currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the
// sequence [0,currentReplicas).
CurrentRevision string `json:"currentRevision,omitempty"`
Expand Down
14 changes: 7 additions & 7 deletions client/clientset/versioned/fake/register.go

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

14 changes: 7 additions & 7 deletions client/clientset/versioned/scheme/register.go

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

0 comments on commit fb3acc0

Please sign in to comment.