diff --git a/.golangci.yaml b/.golangci.yaml index bc62949f3..260abc75a 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,10 +1,10 @@ # golangci-lint configuration file # see: https://golangci-lint.run/usage/configuration/ -# Options for analysis running -run: - # Which dirs to skip: they won't be analyzed; - skip-dirs: +# Settings related to issues +issues: + # Which dirs to exclude: issues from them won't be reported + exclude-dirs: - bin # Settings of specific linters diff --git a/Makefile b/Makefile index d55cec4c7..34618e7c7 100644 --- a/Makefile +++ b/Makefile @@ -124,7 +124,7 @@ ci-lint: golangci-lint $(GOLANGCI_LINT) run --timeout 15m0s .PHONY: test -test: manifests fmt vet envtest gotestsum test-python-sdk +test: manifests fmt vet envtest gotestsum KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" $(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.xml -- ./pkg/... ./api/... -coverprofile $(ARTIFACTS)/cover.out .PHONY: test-python-sdk @@ -207,7 +207,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest ## Tool Versions KUSTOMIZE_VERSION ?= v3.8.7 -CONTROLLER_TOOLS_VERSION ?= v0.14.0 +CONTROLLER_TOOLS_VERSION ?= v0.16.2 KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" .PHONY: kustomize @@ -289,7 +289,7 @@ artifacts: kustomize GOLANGCI_LINT = $(PROJECT_DIR)/bin/golangci-lint .PHONY: golangci-lint golangci-lint: ## Download golangci-lint locally if necessary. - @GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 + @GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3 GOTESTSUM = $(shell pwd)/bin/gotestsum .PHONY: gotestsum diff --git a/client-go/applyconfiguration/jobset/v1alpha2/coordinator.go b/client-go/applyconfiguration/jobset/v1alpha2/coordinator.go index 997bf1806..78e87cd27 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/coordinator.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/coordinator.go @@ -14,7 +14,7 @@ limitations under the License. package v1alpha2 -// CoordinatorApplyConfiguration represents an declarative configuration of the Coordinator type for use +// CoordinatorApplyConfiguration represents a declarative configuration of the Coordinator type for use // with apply. type CoordinatorApplyConfiguration struct { ReplicatedJob *string `json:"replicatedJob,omitempty"` @@ -22,7 +22,7 @@ type CoordinatorApplyConfiguration struct { PodIndex *int `json:"podIndex,omitempty"` } -// CoordinatorApplyConfiguration constructs an declarative configuration of the Coordinator type for use with +// CoordinatorApplyConfiguration constructs a declarative configuration of the Coordinator type for use with // apply. func Coordinator() *CoordinatorApplyConfiguration { return &CoordinatorApplyConfiguration{} diff --git a/client-go/applyconfiguration/jobset/v1alpha2/failurepolicy.go b/client-go/applyconfiguration/jobset/v1alpha2/failurepolicy.go index 82b6756e0..f2a319bbe 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/failurepolicy.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/failurepolicy.go @@ -14,14 +14,14 @@ limitations under the License. package v1alpha2 -// FailurePolicyApplyConfiguration represents an declarative configuration of the FailurePolicy type for use +// FailurePolicyApplyConfiguration represents a declarative configuration of the FailurePolicy type for use // with apply. type FailurePolicyApplyConfiguration struct { MaxRestarts *int32 `json:"maxRestarts,omitempty"` Rules []FailurePolicyRuleApplyConfiguration `json:"rules,omitempty"` } -// FailurePolicyApplyConfiguration constructs an declarative configuration of the FailurePolicy type for use with +// FailurePolicyApplyConfiguration constructs a declarative configuration of the FailurePolicy type for use with // apply. func FailurePolicy() *FailurePolicyApplyConfiguration { return &FailurePolicyApplyConfiguration{} diff --git a/client-go/applyconfiguration/jobset/v1alpha2/failurepolicyrule.go b/client-go/applyconfiguration/jobset/v1alpha2/failurepolicyrule.go index 870a6c063..28cf1ebd8 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/failurepolicyrule.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/failurepolicyrule.go @@ -18,7 +18,7 @@ import ( v1alpha2 "sigs.k8s.io/jobset/api/jobset/v1alpha2" ) -// FailurePolicyRuleApplyConfiguration represents an declarative configuration of the FailurePolicyRule type for use +// FailurePolicyRuleApplyConfiguration represents a declarative configuration of the FailurePolicyRule type for use // with apply. type FailurePolicyRuleApplyConfiguration struct { Name *string `json:"name,omitempty"` @@ -27,7 +27,7 @@ type FailurePolicyRuleApplyConfiguration struct { TargetReplicatedJobs []string `json:"targetReplicatedJobs,omitempty"` } -// FailurePolicyRuleApplyConfiguration constructs an declarative configuration of the FailurePolicyRule type for use with +// FailurePolicyRuleApplyConfiguration constructs a declarative configuration of the FailurePolicyRule type for use with // apply. func FailurePolicyRule() *FailurePolicyRuleApplyConfiguration { return &FailurePolicyRuleApplyConfiguration{} diff --git a/client-go/applyconfiguration/jobset/v1alpha2/jobset.go b/client-go/applyconfiguration/jobset/v1alpha2/jobset.go index f2194fe84..99e29e108 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/jobset.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/jobset.go @@ -20,7 +20,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// JobSetApplyConfiguration represents an declarative configuration of the JobSet type for use +// JobSetApplyConfiguration represents a declarative configuration of the JobSet type for use // with apply. type JobSetApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -29,7 +29,7 @@ type JobSetApplyConfiguration struct { Status *JobSetStatusApplyConfiguration `json:"status,omitempty"` } -// JobSet constructs an declarative configuration of the JobSet type for use with +// JobSet constructs a declarative configuration of the JobSet type for use with // apply. func JobSet(name, namespace string) *JobSetApplyConfiguration { b := &JobSetApplyConfiguration{} @@ -213,3 +213,9 @@ func (b *JobSetApplyConfiguration) WithStatus(value *JobSetStatusApplyConfigurat b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *JobSetApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/client-go/applyconfiguration/jobset/v1alpha2/jobsetspec.go b/client-go/applyconfiguration/jobset/v1alpha2/jobsetspec.go index a5bf915b7..d046e3634 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/jobsetspec.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/jobsetspec.go @@ -14,7 +14,7 @@ limitations under the License. package v1alpha2 -// JobSetSpecApplyConfiguration represents an declarative configuration of the JobSetSpec type for use +// JobSetSpecApplyConfiguration represents a declarative configuration of the JobSetSpec type for use // with apply. type JobSetSpecApplyConfiguration struct { ReplicatedJobs []ReplicatedJobApplyConfiguration `json:"replicatedJobs,omitempty"` @@ -28,7 +28,7 @@ type JobSetSpecApplyConfiguration struct { TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished,omitempty"` } -// JobSetSpecApplyConfiguration constructs an declarative configuration of the JobSetSpec type for use with +// JobSetSpecApplyConfiguration constructs a declarative configuration of the JobSetSpec type for use with // apply. func JobSetSpec() *JobSetSpecApplyConfiguration { return &JobSetSpecApplyConfiguration{} diff --git a/client-go/applyconfiguration/jobset/v1alpha2/jobsetstatus.go b/client-go/applyconfiguration/jobset/v1alpha2/jobsetstatus.go index 32bd69270..ffdd1053c 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/jobsetstatus.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/jobsetstatus.go @@ -18,7 +18,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// JobSetStatusApplyConfiguration represents an declarative configuration of the JobSetStatus type for use +// JobSetStatusApplyConfiguration represents a declarative configuration of the JobSetStatus type for use // with apply. type JobSetStatusApplyConfiguration struct { Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` @@ -28,7 +28,7 @@ type JobSetStatusApplyConfiguration struct { ReplicatedJobsStatus []ReplicatedJobStatusApplyConfiguration `json:"replicatedJobsStatus,omitempty"` } -// JobSetStatusApplyConfiguration constructs an declarative configuration of the JobSetStatus type for use with +// JobSetStatusApplyConfiguration constructs a declarative configuration of the JobSetStatus type for use with // apply. func JobSetStatus() *JobSetStatusApplyConfiguration { return &JobSetStatusApplyConfiguration{} diff --git a/client-go/applyconfiguration/jobset/v1alpha2/network.go b/client-go/applyconfiguration/jobset/v1alpha2/network.go index a943b2095..58d3f945a 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/network.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/network.go @@ -14,7 +14,7 @@ limitations under the License. package v1alpha2 -// NetworkApplyConfiguration represents an declarative configuration of the Network type for use +// NetworkApplyConfiguration represents a declarative configuration of the Network type for use // with apply. type NetworkApplyConfiguration struct { EnableDNSHostnames *bool `json:"enableDNSHostnames,omitempty"` @@ -22,7 +22,7 @@ type NetworkApplyConfiguration struct { PublishNotReadyAddresses *bool `json:"publishNotReadyAddresses,omitempty"` } -// NetworkApplyConfiguration constructs an declarative configuration of the Network type for use with +// NetworkApplyConfiguration constructs a declarative configuration of the Network type for use with // apply. func Network() *NetworkApplyConfiguration { return &NetworkApplyConfiguration{} diff --git a/client-go/applyconfiguration/jobset/v1alpha2/replicatedjob.go b/client-go/applyconfiguration/jobset/v1alpha2/replicatedjob.go index 50211be84..56c007875 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/replicatedjob.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/replicatedjob.go @@ -18,7 +18,7 @@ import ( v1 "k8s.io/api/batch/v1" ) -// ReplicatedJobApplyConfiguration represents an declarative configuration of the ReplicatedJob type for use +// ReplicatedJobApplyConfiguration represents a declarative configuration of the ReplicatedJob type for use // with apply. type ReplicatedJobApplyConfiguration struct { Name *string `json:"name,omitempty"` @@ -26,7 +26,7 @@ type ReplicatedJobApplyConfiguration struct { Replicas *int32 `json:"replicas,omitempty"` } -// ReplicatedJobApplyConfiguration constructs an declarative configuration of the ReplicatedJob type for use with +// ReplicatedJobApplyConfiguration constructs a declarative configuration of the ReplicatedJob type for use with // apply. func ReplicatedJob() *ReplicatedJobApplyConfiguration { return &ReplicatedJobApplyConfiguration{} diff --git a/client-go/applyconfiguration/jobset/v1alpha2/replicatedjobstatus.go b/client-go/applyconfiguration/jobset/v1alpha2/replicatedjobstatus.go index 20294b6b8..0f950368e 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/replicatedjobstatus.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/replicatedjobstatus.go @@ -14,7 +14,7 @@ limitations under the License. package v1alpha2 -// ReplicatedJobStatusApplyConfiguration represents an declarative configuration of the ReplicatedJobStatus type for use +// ReplicatedJobStatusApplyConfiguration represents a declarative configuration of the ReplicatedJobStatus type for use // with apply. type ReplicatedJobStatusApplyConfiguration struct { Name *string `json:"name,omitempty"` @@ -25,7 +25,7 @@ type ReplicatedJobStatusApplyConfiguration struct { Suspended *int32 `json:"suspended,omitempty"` } -// ReplicatedJobStatusApplyConfiguration constructs an declarative configuration of the ReplicatedJobStatus type for use with +// ReplicatedJobStatusApplyConfiguration constructs a declarative configuration of the ReplicatedJobStatus type for use with // apply. func ReplicatedJobStatus() *ReplicatedJobStatusApplyConfiguration { return &ReplicatedJobStatusApplyConfiguration{} diff --git a/client-go/applyconfiguration/jobset/v1alpha2/startuppolicy.go b/client-go/applyconfiguration/jobset/v1alpha2/startuppolicy.go index 9cdcbb414..b8e83dcb6 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/startuppolicy.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/startuppolicy.go @@ -18,13 +18,13 @@ import ( v1alpha2 "sigs.k8s.io/jobset/api/jobset/v1alpha2" ) -// StartupPolicyApplyConfiguration represents an declarative configuration of the StartupPolicy type for use +// StartupPolicyApplyConfiguration represents a declarative configuration of the StartupPolicy type for use // with apply. type StartupPolicyApplyConfiguration struct { StartupPolicyOrder *v1alpha2.StartupPolicyOptions `json:"startupPolicyOrder,omitempty"` } -// StartupPolicyApplyConfiguration constructs an declarative configuration of the StartupPolicy type for use with +// StartupPolicyApplyConfiguration constructs a declarative configuration of the StartupPolicy type for use with // apply. func StartupPolicy() *StartupPolicyApplyConfiguration { return &StartupPolicyApplyConfiguration{} diff --git a/client-go/applyconfiguration/jobset/v1alpha2/successpolicy.go b/client-go/applyconfiguration/jobset/v1alpha2/successpolicy.go index dc22b0a52..4ce4a5ef8 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/successpolicy.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/successpolicy.go @@ -18,14 +18,14 @@ import ( v1alpha2 "sigs.k8s.io/jobset/api/jobset/v1alpha2" ) -// SuccessPolicyApplyConfiguration represents an declarative configuration of the SuccessPolicy type for use +// SuccessPolicyApplyConfiguration represents a declarative configuration of the SuccessPolicy type for use // with apply. type SuccessPolicyApplyConfiguration struct { Operator *v1alpha2.Operator `json:"operator,omitempty"` TargetReplicatedJobs []string `json:"targetReplicatedJobs,omitempty"` } -// SuccessPolicyApplyConfiguration constructs an declarative configuration of the SuccessPolicy type for use with +// SuccessPolicyApplyConfiguration constructs a declarative configuration of the SuccessPolicy type for use with // apply. func SuccessPolicy() *SuccessPolicyApplyConfiguration { return &SuccessPolicyApplyConfiguration{} diff --git a/client-go/applyconfiguration/utils.go b/client-go/applyconfiguration/utils.go index 0477589dc..130894b0b 100644 --- a/client-go/applyconfiguration/utils.go +++ b/client-go/applyconfiguration/utils.go @@ -15,8 +15,11 @@ limitations under the License. package applyconfiguration import ( + runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" v1alpha2 "sigs.k8s.io/jobset/api/jobset/v1alpha2" + internal "sigs.k8s.io/jobset/client-go/applyconfiguration/internal" jobsetv1alpha2 "sigs.k8s.io/jobset/client-go/applyconfiguration/jobset/v1alpha2" ) @@ -51,3 +54,7 @@ func ForKind(kind schema.GroupVersionKind) interface{} { } return nil } + +func NewTypeConverter(scheme *runtime.Scheme) *testing.TypeConverter { + return &testing.TypeConverter{Scheme: scheme, TypeResolver: internal.Parser()} +} diff --git a/client-go/clientset/versioned/fake/clientset_generated.go b/client-go/clientset/versioned/fake/clientset_generated.go index 5b31d2d5f..765e3ac84 100644 --- a/client-go/clientset/versioned/fake/clientset_generated.go +++ b/client-go/clientset/versioned/fake/clientset_generated.go @@ -20,6 +20,7 @@ import ( "k8s.io/client-go/discovery" fakediscovery "k8s.io/client-go/discovery/fake" "k8s.io/client-go/testing" + applyconfiguration "sigs.k8s.io/jobset/client-go/applyconfiguration" clientset "sigs.k8s.io/jobset/client-go/clientset/versioned" jobsetv1alpha2 "sigs.k8s.io/jobset/client-go/clientset/versioned/typed/jobset/v1alpha2" fakejobsetv1alpha2 "sigs.k8s.io/jobset/client-go/clientset/versioned/typed/jobset/v1alpha2/fake" @@ -27,8 +28,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { @@ -70,6 +75,38 @@ func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } +// NewClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewClientset(objects ...runtime.Object) *Clientset { + o := testing.NewFieldManagedObjectTracker( + scheme, + codecs.UniversalDecoder(), + applyconfiguration.NewTypeConverter(scheme), + ) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + var ( _ clientset.Interface = &Clientset{} _ testing.FakeClient = &Clientset{} diff --git a/client-go/clientset/versioned/typed/jobset/v1alpha2/fake/fake_jobset.go b/client-go/clientset/versioned/typed/jobset/v1alpha2/fake/fake_jobset.go index b7c3aab2e..acc954117 100644 --- a/client-go/clientset/versioned/typed/jobset/v1alpha2/fake/fake_jobset.go +++ b/client-go/clientset/versioned/typed/jobset/v1alpha2/fake/fake_jobset.go @@ -40,22 +40,24 @@ var jobsetsKind = v1alpha2.SchemeGroupVersion.WithKind("JobSet") // Get takes name of the jobSet, and returns the corresponding jobSet object, and an error if there is any. func (c *FakeJobSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.JobSet, err error) { + emptyResult := &v1alpha2.JobSet{} obj, err := c.Fake. - Invokes(testing.NewGetAction(jobsetsResource, c.ns, name), &v1alpha2.JobSet{}) + Invokes(testing.NewGetActionWithOptions(jobsetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.JobSet), err } // List takes label and field selectors, and returns the list of JobSets that match those selectors. func (c *FakeJobSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.JobSetList, err error) { + emptyResult := &v1alpha2.JobSetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(jobsetsResource, jobsetsKind, c.ns, opts), &v1alpha2.JobSetList{}) + Invokes(testing.NewListActionWithOptions(jobsetsResource, jobsetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -74,40 +76,43 @@ func (c *FakeJobSets) List(ctx context.Context, opts v1.ListOptions) (result *v1 // Watch returns a watch.Interface that watches the requested jobSets. func (c *FakeJobSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(jobsetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(jobsetsResource, c.ns, opts)) } // Create takes the representation of a jobSet and creates it. Returns the server's representation of the jobSet, and an error, if there is any. func (c *FakeJobSets) Create(ctx context.Context, jobSet *v1alpha2.JobSet, opts v1.CreateOptions) (result *v1alpha2.JobSet, err error) { + emptyResult := &v1alpha2.JobSet{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(jobsetsResource, c.ns, jobSet), &v1alpha2.JobSet{}) + Invokes(testing.NewCreateActionWithOptions(jobsetsResource, c.ns, jobSet, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.JobSet), err } // Update takes the representation of a jobSet and updates it. Returns the server's representation of the jobSet, and an error, if there is any. func (c *FakeJobSets) Update(ctx context.Context, jobSet *v1alpha2.JobSet, opts v1.UpdateOptions) (result *v1alpha2.JobSet, err error) { + emptyResult := &v1alpha2.JobSet{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(jobsetsResource, c.ns, jobSet), &v1alpha2.JobSet{}) + Invokes(testing.NewUpdateActionWithOptions(jobsetsResource, c.ns, jobSet, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.JobSet), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeJobSets) UpdateStatus(ctx context.Context, jobSet *v1alpha2.JobSet, opts v1.UpdateOptions) (*v1alpha2.JobSet, error) { +func (c *FakeJobSets) UpdateStatus(ctx context.Context, jobSet *v1alpha2.JobSet, opts v1.UpdateOptions) (result *v1alpha2.JobSet, err error) { + emptyResult := &v1alpha2.JobSet{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(jobsetsResource, "status", c.ns, jobSet), &v1alpha2.JobSet{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(jobsetsResource, "status", c.ns, jobSet, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.JobSet), err } @@ -122,7 +127,7 @@ func (c *FakeJobSets) Delete(ctx context.Context, name string, opts v1.DeleteOpt // DeleteCollection deletes a collection of objects. func (c *FakeJobSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(jobsetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(jobsetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.JobSetList{}) return err @@ -130,11 +135,12 @@ func (c *FakeJobSets) DeleteCollection(ctx context.Context, opts v1.DeleteOption // Patch applies the patch and returns the patched jobSet. func (c *FakeJobSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.JobSet, err error) { + emptyResult := &v1alpha2.JobSet{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(jobsetsResource, c.ns, name, pt, data, subresources...), &v1alpha2.JobSet{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(jobsetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.JobSet), err } @@ -152,11 +158,12 @@ func (c *FakeJobSets) Apply(ctx context.Context, jobSet *jobsetv1alpha2.JobSetAp if name == nil { return nil, fmt.Errorf("jobSet.Name must be provided to Apply") } + emptyResult := &v1alpha2.JobSet{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(jobsetsResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha2.JobSet{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(jobsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.JobSet), err } @@ -175,11 +182,12 @@ func (c *FakeJobSets) ApplyStatus(ctx context.Context, jobSet *jobsetv1alpha2.Jo if name == nil { return nil, fmt.Errorf("jobSet.Name must be provided to Apply") } + emptyResult := &v1alpha2.JobSet{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(jobsetsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha2.JobSet{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(jobsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.JobSet), err } diff --git a/client-go/clientset/versioned/typed/jobset/v1alpha2/jobset.go b/client-go/clientset/versioned/typed/jobset/v1alpha2/jobset.go index 87b5cc539..b3f465670 100644 --- a/client-go/clientset/versioned/typed/jobset/v1alpha2/jobset.go +++ b/client-go/clientset/versioned/typed/jobset/v1alpha2/jobset.go @@ -16,14 +16,11 @@ package v1alpha2 import ( "context" - json "encoding/json" - "fmt" - "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" v1alpha2 "sigs.k8s.io/jobset/api/jobset/v1alpha2" jobsetv1alpha2 "sigs.k8s.io/jobset/client-go/applyconfiguration/jobset/v1alpha2" scheme "sigs.k8s.io/jobset/client-go/clientset/versioned/scheme" @@ -39,6 +36,7 @@ type JobSetsGetter interface { type JobSetInterface interface { Create(ctx context.Context, jobSet *v1alpha2.JobSet, opts v1.CreateOptions) (*v1alpha2.JobSet, error) Update(ctx context.Context, jobSet *v1alpha2.JobSet, opts v1.UpdateOptions) (*v1alpha2.JobSet, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, jobSet *v1alpha2.JobSet, opts v1.UpdateOptions) (*v1alpha2.JobSet, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -47,206 +45,25 @@ type JobSetInterface interface { Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.JobSet, err error) Apply(ctx context.Context, jobSet *jobsetv1alpha2.JobSetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.JobSet, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, jobSet *jobsetv1alpha2.JobSetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.JobSet, err error) JobSetExpansion } // jobSets implements JobSetInterface type jobSets struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1alpha2.JobSet, *v1alpha2.JobSetList, *jobsetv1alpha2.JobSetApplyConfiguration] } // newJobSets returns a JobSets func newJobSets(c *JobsetV1alpha2Client, namespace string) *jobSets { return &jobSets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1alpha2.JobSet, *v1alpha2.JobSetList, *jobsetv1alpha2.JobSetApplyConfiguration]( + "jobsets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.JobSet { return &v1alpha2.JobSet{} }, + func() *v1alpha2.JobSetList { return &v1alpha2.JobSetList{} }), } } - -// Get takes name of the jobSet, and returns the corresponding jobSet object, and an error if there is any. -func (c *jobSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.JobSet, err error) { - result = &v1alpha2.JobSet{} - err = c.client.Get(). - Namespace(c.ns). - Resource("jobsets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of JobSets that match those selectors. -func (c *jobSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.JobSetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.JobSetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("jobsets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested jobSets. -func (c *jobSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("jobsets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a jobSet and creates it. Returns the server's representation of the jobSet, and an error, if there is any. -func (c *jobSets) Create(ctx context.Context, jobSet *v1alpha2.JobSet, opts v1.CreateOptions) (result *v1alpha2.JobSet, err error) { - result = &v1alpha2.JobSet{} - err = c.client.Post(). - Namespace(c.ns). - Resource("jobsets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(jobSet). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a jobSet and updates it. Returns the server's representation of the jobSet, and an error, if there is any. -func (c *jobSets) Update(ctx context.Context, jobSet *v1alpha2.JobSet, opts v1.UpdateOptions) (result *v1alpha2.JobSet, err error) { - result = &v1alpha2.JobSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("jobsets"). - Name(jobSet.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(jobSet). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *jobSets) UpdateStatus(ctx context.Context, jobSet *v1alpha2.JobSet, opts v1.UpdateOptions) (result *v1alpha2.JobSet, err error) { - result = &v1alpha2.JobSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("jobsets"). - Name(jobSet.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(jobSet). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the jobSet and deletes it. Returns an error if one occurs. -func (c *jobSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("jobsets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *jobSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("jobsets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched jobSet. -func (c *jobSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.JobSet, err error) { - result = &v1alpha2.JobSet{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("jobsets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied jobSet. -func (c *jobSets) Apply(ctx context.Context, jobSet *jobsetv1alpha2.JobSetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.JobSet, err error) { - if jobSet == nil { - return nil, fmt.Errorf("jobSet provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(jobSet) - if err != nil { - return nil, err - } - name := jobSet.Name - if name == nil { - return nil, fmt.Errorf("jobSet.Name must be provided to Apply") - } - result = &v1alpha2.JobSet{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("jobsets"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *jobSets) ApplyStatus(ctx context.Context, jobSet *jobsetv1alpha2.JobSetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.JobSet, err error) { - if jobSet == nil { - return nil, fmt.Errorf("jobSet provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(jobSet) - if err != nil { - return nil, err - } - - name := jobSet.Name - if name == nil { - return nil, fmt.Errorf("jobSet.Name must be provided to Apply") - } - - result = &v1alpha2.JobSet{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("jobsets"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/client-go/informers/externalversions/factory.go b/client-go/informers/externalversions/factory.go index 21f043c3c..793a51676 100644 --- a/client-go/informers/externalversions/factory.go +++ b/client-go/informers/externalversions/factory.go @@ -224,6 +224,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new diff --git a/client-go/listers/jobset/v1alpha2/jobset.go b/client-go/listers/jobset/v1alpha2/jobset.go index cda6673cc..81b46f80d 100644 --- a/client-go/listers/jobset/v1alpha2/jobset.go +++ b/client-go/listers/jobset/v1alpha2/jobset.go @@ -15,8 +15,8 @@ limitations under the License. package v1alpha2 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha2 "sigs.k8s.io/jobset/api/jobset/v1alpha2" ) @@ -34,25 +34,17 @@ type JobSetLister interface { // jobSetLister implements the JobSetLister interface. type jobSetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.JobSet] } // NewJobSetLister returns a new JobSetLister. func NewJobSetLister(indexer cache.Indexer) JobSetLister { - return &jobSetLister{indexer: indexer} -} - -// List lists all JobSets in the indexer. -func (s *jobSetLister) List(selector labels.Selector) (ret []*v1alpha2.JobSet, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.JobSet)) - }) - return ret, err + return &jobSetLister{listers.New[*v1alpha2.JobSet](indexer, v1alpha2.Resource("jobset"))} } // JobSets returns an object that can list and get JobSets. func (s *jobSetLister) JobSets(namespace string) JobSetNamespaceLister { - return jobSetNamespaceLister{indexer: s.indexer, namespace: namespace} + return jobSetNamespaceLister{listers.NewNamespaced[*v1alpha2.JobSet](s.ResourceIndexer, namespace)} } // JobSetNamespaceLister helps list and get JobSets. @@ -70,26 +62,5 @@ type JobSetNamespaceLister interface { // jobSetNamespaceLister implements the JobSetNamespaceLister // interface. type jobSetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all JobSets in the indexer for a given namespace. -func (s jobSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.JobSet, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.JobSet)) - }) - return ret, err -} - -// Get retrieves the JobSet from the indexer for a given namespace and name. -func (s jobSetNamespaceLister) Get(name string) (*v1alpha2.JobSet, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("jobset"), name) - } - return obj.(*v1alpha2.JobSet), nil + listers.ResourceIndexer[*v1alpha2.JobSet] } diff --git a/config/components/crd/bases/jobset.x-k8s.io_jobsets.yaml b/config/components/crd/bases/jobset.x-k8s.io_jobsets.yaml index 672d48813..d0d2b0825 100644 --- a/config/components/crd/bases/jobset.x-k8s.io_jobsets.yaml +++ b/config/components/crd/bases/jobset.x-k8s.io_jobsets.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.2 name: jobsets.jobset.x-k8s.io spec: group: jobset.x-k8s.io @@ -156,7 +156,6 @@ spec: `jobset.sigs.k8s.io/jobset-controller`, but skips reconciling JobSets with a custom value for this field. - The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first "/" must be a valid subdomain as defined by RFC 1123. All characters trailing the first "/" must be valid HTTP Path @@ -267,12 +266,10 @@ spec: completionMode specifies how Pod completions are tracked. It can be `NonIndexed` (default) or `Indexed`. - `NonIndexed` means that the Job is considered complete when there have been .spec.completions successfully completed Pods. Each Pod completion is homologous to each other. - `Indexed` means that the Pods of a Job get an associated completion index from 0 to (.spec.completions - 1), available in the annotation batch.kubernetes.io/job-completion-index. @@ -284,7 +281,6 @@ spec: `$(job-name)-$(index)-$(random-string)`, the Pod hostname takes the form `$(job-name)-$(index)`. - More completion modes can be added in the future. If the Job controller observes a mode that it doesn't recognize, which is possible during upgrades due to version skew, the controller @@ -309,8 +305,8 @@ spec: The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first "/" must be a valid subdomain as defined by RFC 1123. All characters trailing the first "/" must be valid HTTP Path - characters as defined by RFC 3986. The value cannot exceed 64 characters. - + characters as defined by RFC 3986. The value cannot exceed 63 characters. + This field is immutable. This field is alpha-level. The job controller accepts setting the field when the feature gate JobManagedBy is enabled (disabled by default). @@ -360,10 +356,6 @@ spec: represented by the jobs's .status.failed field, is incremented and it is checked against the backoffLimit. This field cannot be used in combination with restartPolicy=OnFailure. - - - This field is beta-level. It can be used when the `JobPodFailurePolicy` - feature gate is enabled (enabled by default). properties: rules: description: |- @@ -382,7 +374,6 @@ spec: Specifies the action taken on a pod failure when the requirements are satisfied. Possible values are: - - FailJob: indicates that the pod's job is marked as Failed and all running pods are terminated. - FailIndex: indicates that the pod's index is marked as Failed and will @@ -413,7 +404,6 @@ spec: specified values. Containers completed with success (exit code 0) are excluded from the requirement check. Possible values are: - - In: the requirement is satisfied if at least one container exit code (might be multiple if there are multiple containers not restricted by the 'containerName' field) is in the set of specified values. @@ -483,7 +473,6 @@ spec: - Failed means to wait until a previously created Pod is fully terminated (has phase Failed or Succeeded) before creating a replacement Pod. - When using podFailurePolicy, Failed is the the only allowed value. TerminatingOrFailed and Failed are allowed values when podFailurePolicy is not in use. This is an beta field. To use this, enable the JobPodReplacementPolicy feature toggle. @@ -546,9 +535,8 @@ spec: When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated. - - This field is alpha-level. To use this field, you must enable the - `JobSuccessPolicy` feature gate (disabled by default). + This field is beta-level. To use this field, you must enable the + `JobSuccessPolicy` feature gate (enabled by default). properties: rules: description: |- @@ -951,7 +939,7 @@ spec: pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. - This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). items: type: string type: array @@ -966,7 +954,7 @@ spec: pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). items: type: string type: array @@ -1139,7 +1127,7 @@ spec: pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. - This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). items: type: string type: array @@ -1154,7 +1142,7 @@ spec: pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). items: type: string type: array @@ -1328,7 +1316,7 @@ spec: pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. - This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). items: type: string type: array @@ -1343,7 +1331,7 @@ spec: pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). items: type: string type: array @@ -1516,7 +1504,7 @@ spec: pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. - This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). items: type: string type: array @@ -1531,7 +1519,7 @@ spec: pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). items: type: string type: array @@ -1703,9 +1691,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -1780,9 +1766,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -1824,9 +1808,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -1850,9 +1832,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -2157,11 +2137,11 @@ spec: format: int32 type: integer service: + default: "" description: |- Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC. type: string required: @@ -2379,11 +2359,11 @@ spec: format: int32 type: integer service: + default: "" description: |- Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC. type: string required: @@ -2538,11 +2518,9 @@ spec: Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers. items: description: ResourceClaim references @@ -2554,6 +2532,12 @@ spec: the Pod where this field is used. It makes that resource available inside a container. type: string + request: + description: |- + Request is the name chosen for a request in the referenced claim. + If empty, everything from the claim is made available, otherwise + only the result of this request. + type: string required: - name type: object @@ -2677,7 +2661,7 @@ spec: procMount: description: |- procMount denotes the type of proc mount to use for the containers. - The default is DefaultProcMount which uses the container runtime defaults for + The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows. @@ -2763,7 +2747,6 @@ spec: type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied. @@ -2848,11 +2831,11 @@ spec: format: int32 type: integer service: + default: "" description: |- Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC. type: string required: @@ -3076,10 +3059,8 @@ spec: RecursiveReadOnly specifies whether read-only mounts should be handled recursively. - If ReadOnly is false, this field has no meaning and must be unspecified. - If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this @@ -3087,11 +3068,9 @@ spec: supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. - If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). - If this field is not specified, it is treated as an equivalent of Disabled. type: string subPath: @@ -3200,7 +3179,6 @@ spec: removed or restarted. The kubelet may evict a Pod if an ephemeral container causes the Pod to exceed its resource allocation. - To add an ephemeral container, use the ephemeralcontainers subresource of an existing Pod. Ephemeral containers may not be removed or restarted. properties: @@ -3276,9 +3254,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -3353,9 +3329,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -3397,9 +3371,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -3423,9 +3395,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -3724,11 +3694,11 @@ spec: format: int32 type: integer service: + default: "" description: |- Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC. type: string required: @@ -3936,11 +3906,11 @@ spec: format: int32 type: integer service: + default: "" description: |- Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC. type: string required: @@ -4094,11 +4064,9 @@ spec: Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers. items: description: ResourceClaim references @@ -4110,6 +4078,12 @@ spec: the Pod where this field is used. It makes that resource available inside a container. type: string + request: + description: |- + Request is the name chosen for a request in the referenced claim. + If empty, everything from the claim is made available, otherwise + only the result of this request. + type: string required: - name type: object @@ -4221,7 +4195,7 @@ spec: procMount: description: |- procMount denotes the type of proc mount to use for the containers. - The default is DefaultProcMount which uses the container runtime defaults for + The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows. @@ -4307,7 +4281,6 @@ spec: type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied. @@ -4386,11 +4359,11 @@ spec: format: int32 type: integer service: + default: "" description: |- Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC. type: string required: @@ -4533,7 +4506,6 @@ spec: The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container. If not set then the ephemeral container uses the namespaces configured in the Pod spec. - The container runtime must implement support for this feature. If the runtime does not support namespace targeting then the result of setting this field is undefined. type: string @@ -4624,10 +4596,8 @@ spec: RecursiveReadOnly specifies whether read-only mounts should be handled recursively. - If ReadOnly is false, this field has no meaning and must be unspecified. - If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this @@ -4635,11 +4605,9 @@ spec: supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. - If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). - If this field is not specified, it is treated as an equivalent of Disabled. type: string subPath: @@ -4753,9 +4721,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string type: object x-kubernetes-map-type: atomic @@ -4854,9 +4820,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -4931,9 +4895,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -4975,9 +4937,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -5001,9 +4961,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: Specify whether @@ -5308,11 +5266,11 @@ spec: format: int32 type: integer service: + default: "" description: |- Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC. type: string required: @@ -5530,11 +5488,11 @@ spec: format: int32 type: integer service: + default: "" description: |- Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC. type: string required: @@ -5689,11 +5647,9 @@ spec: Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers. items: description: ResourceClaim references @@ -5705,6 +5661,12 @@ spec: the Pod where this field is used. It makes that resource available inside a container. type: string + request: + description: |- + Request is the name chosen for a request in the referenced claim. + If empty, everything from the claim is made available, otherwise + only the result of this request. + type: string required: - name type: object @@ -5828,7 +5790,7 @@ spec: procMount: description: |- procMount denotes the type of proc mount to use for the containers. - The default is DefaultProcMount which uses the container runtime defaults for + The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows. @@ -5914,7 +5876,6 @@ spec: type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied. @@ -5999,11 +5960,11 @@ spec: format: int32 type: integer service: + default: "" description: |- Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC. type: string required: @@ -6227,10 +6188,8 @@ spec: RecursiveReadOnly specifies whether read-only mounts should be handled recursively. - If ReadOnly is false, this field has no meaning and must be unspecified. - If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this @@ -6238,11 +6197,9 @@ spec: supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. - If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). - If this field is not specified, it is treated as an equivalent of Disabled. type: string subPath: @@ -6281,9 +6238,11 @@ spec: x-kubernetes-list-type: map nodeName: description: |- - NodeName is a request to schedule this pod onto a specific node. If it is non-empty, - the scheduler simply schedules this pod onto that node, assuming that it fits resource - requirements. + NodeName indicates in which node this pod is scheduled. + If empty, this pod is a candidate for scheduling by the scheduler defined in schedulerName. + Once this field is set, the kubelet for this node becomes responsible for the lifecycle of this pod. + This field should not be used to express a desire for the pod to be scheduled on a specific node. + https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodename type: string nodeSelector: additionalProperties: @@ -6299,11 +6258,9 @@ spec: Specifies the OS of the containers in the pod. Some pod and container fields are restricted if this is set. - If the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptions - If the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC @@ -6318,6 +6275,7 @@ spec: - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups + - spec.securityContext.supplementalGroupsPolicy - spec.containers[*].securityContext.appArmorProfile - spec.containers[*].securityContext.seLinuxOptions - spec.containers[*].securityContext.seccompProfile @@ -6406,15 +6364,16 @@ spec: will be made available to those containers which consume them by name. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. items: description: |- - PodResourceClaim references exactly one ResourceClaim through a ClaimSource. + PodResourceClaim references exactly one ResourceClaim, either directly + or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim + for the pod. + It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. Containers that need access to the ResourceClaim reference it with this name. properties: @@ -6423,33 +6382,32 @@ spec: Name uniquely identifies this resource claim inside the pod. This must be a DNS_LABEL. type: string - source: - description: Source describes where to - find the ResourceClaim. - properties: - resourceClaimName: - description: |- - ResourceClaimName is the name of a ResourceClaim object in the same - namespace as this pod. - type: string - resourceClaimTemplateName: - description: |- - ResourceClaimTemplateName is the name of a ResourceClaimTemplate - object in the same namespace as this pod. + resourceClaimName: + description: |- + ResourceClaimName is the name of a ResourceClaim object in the same + namespace as this pod. + Exactly one of ResourceClaimName and ResourceClaimTemplateName must + be set. + type: string + resourceClaimTemplateName: + description: |- + ResourceClaimTemplateName is the name of a ResourceClaimTemplate + object in the same namespace as this pod. - The template will be used to create a new ResourceClaim, which will - be bound to this pod. When this pod is deleted, the ResourceClaim - will also be deleted. The pod name and resource name, along with a - generated component, will be used to form a unique name for the - ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses. + The template will be used to create a new ResourceClaim, which will + be bound to this pod. When this pod is deleted, the ResourceClaim + will also be deleted. The pod name and resource name, along with a + generated component, will be used to form a unique name for the + ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses. + This field is immutable and no changes will be made to the + corresponding ResourceClaim by the control plane after creating the + ResourceClaim. - This field is immutable and no changes will be made to the - corresponding ResourceClaim by the control plane after creating the - ResourceClaim. - type: string - type: object + Exactly one of ResourceClaimName and ResourceClaimTemplateName must + be set. + type: string required: - name type: object @@ -6483,7 +6441,6 @@ spec: If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the scheduler will not attempt to schedule the pod. - SchedulingGates can only be set at pod creation time, and be removed only afterwards. items: description: PodSchedulingGate is associated @@ -6535,12 +6492,10 @@ spec: Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod: - 1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw---- - If unset, the Kubelet will not modify the ownership and permissions of any volume. Note that this field cannot be set when spec.os.name is windows. format: int64 @@ -6627,7 +6582,6 @@ spec: type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied. @@ -6637,18 +6591,28 @@ spec: type: object supplementalGroups: description: |- - A list of groups applied to the first process run in each container, in addition - to the container's primary GID, the fsGroup (if specified), and group memberships - defined in the container image for the uid of the container process. If unspecified, - no additional groups are added to any container. Note that group memberships - defined in the container image for the uid of the container process are still effective, - even if they are not included in this list. + A list of groups applied to the first process run in each container, in + addition to the container's primary GID and fsGroup (if specified). If + the SupplementalGroupsPolicy feature is enabled, the + supplementalGroupsPolicy field determines whether these are in addition + to or instead of any group memberships defined in the container image. + If unspecified, no additional groups are added, though group memberships + defined in the container image may still be used, depending on the + supplementalGroupsPolicy field. Note that this field cannot be set when spec.os.name is windows. items: format: int64 type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + description: |- + Defines how supplemental groups of the first container processes are calculated. + Valid values are "Merge" and "Strict". If not specified, "Merge" is used. + (Alpha) Using the field requires the SupplementalGroupsPolicy feature gate to be enabled + and the container runtime must implement support for this feature. + Note that this field cannot be set when spec.os.name is windows. + type: string sysctls: description: |- Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported @@ -6861,7 +6825,6 @@ spec: Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. - This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default). items: type: string @@ -6901,7 +6864,6 @@ spec: Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule. - For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | @@ -6919,7 +6881,6 @@ spec: - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. - If this value is nil, the behavior is equivalent to the Honor policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string @@ -6931,7 +6892,6 @@ spec: has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. - If this value is nil, the behavior is equivalent to the Ignore policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string @@ -7000,7 +6960,6 @@ spec: Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore - TODO: how do we prevent errors in the filesystem from compromising the machine type: string partition: description: |- @@ -7042,6 +7001,7 @@ spec: data disk in the blob storage type: string fsType: + default: ext4 description: |- fsType is Filesystem type to mount. Must be a filesystem type supported by the host operating system. @@ -7057,6 +7017,7 @@ spec: to shared' type: string readOnly: + default: false description: |- readOnly Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. @@ -7129,9 +7090,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string type: object x-kubernetes-map-type: atomic @@ -7173,9 +7132,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string type: object x-kubernetes-map-type: atomic @@ -7249,9 +7206,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: optional specify whether @@ -7292,9 +7247,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string type: object x-kubernetes-map-type: atomic @@ -7445,7 +7398,6 @@ spec: The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed. - Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity @@ -7456,17 +7408,14 @@ spec: information on the connection between this volume type and PersistentVolumeClaim). - Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod. - Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information. - A pod can use both types of ephemeral volumes and persistent volumes at the same time. properties: @@ -7480,7 +7429,6 @@ spec: entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long). - An existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until @@ -7490,11 +7438,9 @@ spec: this should not be necessary, but it may be useful when manually reconstructing a broken cluster. - This field is read-only and no changes will be made by Kubernetes to the PVC after it has been created. - Required, must not be nil. properties: metadata: @@ -7722,7 +7668,7 @@ spec: set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ - (Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled. + (Beta) Using this field requires the VolumeAttributesClass feature gate to be enabled (off by default). type: string volumeMode: description: |- @@ -7751,7 +7697,6 @@ spec: fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - TODO: how do we prevent errors in the filesystem from compromising the machine type: string lun: description: 'lun is Optional: FC @@ -7821,9 +7766,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string type: object x-kubernetes-map-type: atomic @@ -7859,7 +7802,6 @@ spec: Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk - TODO: how do we prevent errors in the filesystem from compromising the machine type: string partition: description: |- @@ -7940,9 +7882,6 @@ spec: used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath - --- - TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not - mount host directories as read/write. properties: path: description: |- @@ -7959,6 +7898,41 @@ spec: required: - path type: object + image: + description: |- + image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. + The volume is resolved at pod startup depending on which PullPolicy value is provided: + + - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. + - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. + - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + + The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. + A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. + The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. + The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. + The volume will be mounted read-only (ro) and non-executable files (noexec). + Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath). + The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type. + properties: + pullPolicy: + description: |- + Policy for pulling OCI objects. Possible values are: + Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. + Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. + IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + type: string + reference: + description: |- + Required: Image or artifact reference to be used. + Behaves in the same way as pod.spec.containers[*].image. + Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. + More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management to default or override + container images in workload controllers like Deployments and StatefulSets. + type: string + type: object iscsi: description: |- iscsi represents an ISCSI Disk resource that is attached to a @@ -7981,7 +7955,6 @@ spec: Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi - TODO: how do we prevent errors in the filesystem from compromising the machine type: string initiatorName: description: |- @@ -7994,6 +7967,7 @@ spec: Qualified Name. type: string iscsiInterface: + default: default description: |- iscsiInterface is the interface Name that uses an iSCSI transport. Defaults to 'default' (tcp). @@ -8028,9 +8002,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string type: object x-kubernetes-map-type: atomic @@ -8151,26 +8123,24 @@ spec: format: int32 type: integer sources: - description: sources is the list of - volume projections + description: |- + sources is the list of volume projections. Each entry in this list + handles one source. items: - description: Projection that may - be projected along with other - supported volume types + description: |- + Projection that may be projected along with other supported volume types. + Exactly one of these fields must be set. properties: clusterTrustBundle: description: |- ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field of ClusterTrustBundle objects in an auto-updating file. - Alpha, gated by the ClusterTrustBundleProjection feature gate. - ClusterTrustBundle objects can either be selected by name, or by the combination of signer name and a label selector. - Kubelet performs aggressive normalization of the PEM contents written into the pod filesystem. Esoteric PEM features such as inter-block comments and block headers are stripped. Certificates are deduplicated. @@ -8313,9 +8283,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: optional specify @@ -8479,9 +8447,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string optional: description: optional field @@ -8575,7 +8541,6 @@ spec: Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd - TODO: how do we prevent errors in the filesystem from compromising the machine type: string image: description: |- @@ -8583,6 +8548,7 @@ spec: More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string keyring: + default: /etc/ceph/keyring description: |- keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. @@ -8597,6 +8563,7 @@ spec: type: array x-kubernetes-list-type: atomic pool: + default: rbd description: |- pool is the rados pool name. Default is rbd. @@ -8622,13 +8589,12 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string type: object x-kubernetes-map-type: atomic user: + default: admin description: |- user is the rados user name. Default is admin. @@ -8644,6 +8610,7 @@ spec: on Kubernetes nodes. properties: fsType: + default: xfs description: |- fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. @@ -8676,9 +8643,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string type: object x-kubernetes-map-type: atomic @@ -8688,6 +8653,7 @@ spec: default false type: boolean storageMode: + default: ThinProvisioned description: |- storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned. @@ -8807,9 +8773,7 @@ spec: This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. type: string type: object x-kubernetes-map-type: atomic @@ -8960,16 +8924,8 @@ spec: properties: conditions: items: - description: "Condition contains details for one aspect of the current - state of this API Resource.\n---\nThis struct is intended for - direct use as an array at the field path .status.conditions. For - example,\n\n\n\ttype FooStatus struct{\n\t // Represents the - observations of a foo's current state.\n\t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // - +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t - \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t - \ // other fields\n\t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- @@ -9010,12 +8966,7 @@ spec: - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: type of condition in CamelCase or in foo.example.com/CamelCase. maxLength: 316 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])$ type: string diff --git a/config/components/rbac/role.yaml b/config/components/rbac/role.yaml index 31e1bd4ea..429348e0f 100644 --- a/config/components/rbac/role.yaml +++ b/config/components/rbac/role.yaml @@ -16,62 +16,47 @@ rules: - apiGroups: - "" resources: - - secrets + - nodes verbs: - get - list - - update - watch - apiGroups: - - admissionregistration.k8s.io + - "" resources: - - mutatingwebhookconfigurations + - pods + - services verbs: + - create + - delete - get - list + - patch - update - watch - apiGroups: - - admissionregistration.k8s.io + - "" resources: - - validatingwebhookconfigurations + - secrets verbs: - get - list - update - watch - apiGroups: - - batch + - admissionregistration.k8s.io resources: - - jobs + - mutatingwebhookconfigurations + - validatingwebhookconfigurations verbs: - - create - - delete - get - list - - patch - update - watch - apiGroups: - batch resources: - - jobs/status - verbs: - - get - - patch - - update -- apiGroups: - - "" - resources: - - nodes - verbs: - - get - - list - - watch -- apiGroups: - - "" - resources: - - pods + - jobs verbs: - create - delete @@ -81,17 +66,13 @@ rules: - update - watch - apiGroups: - - "" + - batch resources: - - services + - jobs/status verbs: - - create - - delete - get - - list - patch - update - - watch - apiGroups: - jobset.x-k8s.io resources: diff --git a/go.mod b/go.mod index 98ce2d013..ac65c6651 100644 --- a/go.mod +++ b/go.mod @@ -10,17 +10,17 @@ require ( github.com/prometheus/client_golang v1.20.2 github.com/stretchr/testify v1.9.0 golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 - k8s.io/api v0.30.4 - k8s.io/apimachinery v0.30.4 - k8s.io/apiserver v0.30.4 - k8s.io/client-go v0.30.4 - k8s.io/code-generator v0.30.4 - k8s.io/component-base v0.30.4 + k8s.io/api v0.31.0 + k8s.io/apimachinery v0.31.0 + k8s.io/apiserver v0.31.0 + k8s.io/client-go v0.31.0 + k8s.io/code-generator v0.31.0 + k8s.io/component-base v0.31.0 k8s.io/klog v1.0.0 - k8s.io/klog/v2 v2.120.1 + k8s.io/klog/v2 v2.130.1 k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f - k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 - sigs.k8s.io/controller-runtime v0.18.4 + k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 + sigs.k8s.io/controller-runtime v0.19.0 sigs.k8s.io/structured-merge-diff/v4 v4.4.1 ) @@ -28,11 +28,12 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.12.0 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/zapr v1.3.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect @@ -56,11 +57,12 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/x448/float16 v0.8.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect @@ -75,10 +77,11 @@ require ( golang.org/x/tools v0.24.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.30.4 // indirect + k8s.io/apiextensions-apiserver v0.31.0 // indirect k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/yaml v1.4.0 // indirect diff --git a/go.sum b/go.sum index ac8ff5f1b..cf42517ab 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,9 @@ github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2y github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/go-restful/v3 v3.12.0 h1:y2DdzBAURM29NFF94q6RaY4vjIH1rtwDapwQtU84iWk= github.com/emicklei/go-restful/v3 v3.12.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= @@ -15,6 +16,8 @@ github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0 github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -81,8 +84,9 @@ github.com/open-policy-agent/frameworks/constraint v0.0.0-20230822235116-f0b62fe github.com/open-policy-agent/frameworks/constraint v0.0.0-20230822235116-f0b62fe1e4c4/go.mod h1:54/KzLMvA5ndBVpm7B1OjLeV0cUtTLTz2bZ2OtydLpU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= @@ -91,14 +95,16 @@ github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -161,6 +167,8 @@ google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWn gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -168,34 +176,34 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.30.4 h1:XASIELmW8w8q0i1Y4124LqPoWMycLjyQti/fdYHYjCs= -k8s.io/api v0.30.4/go.mod h1:ZqniWRKu7WIeLijbbzetF4U9qZ03cg5IRwl8YVs8mX0= -k8s.io/apiextensions-apiserver v0.30.4 h1:FwOMIk/rzZvM/Gx0IOz0+biZ+dlnlCeyfXW17uzV1qE= -k8s.io/apiextensions-apiserver v0.30.4/go.mod h1:m8cAkJ9PVU8Olb4cPW4hrUDBZGvoSJ0kY0G0CfdGQac= -k8s.io/apimachinery v0.30.4 h1:5QHQI2tInzr8LsT4kU/2+fSeibH1eIHswNx480cqIoY= -k8s.io/apimachinery v0.30.4/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/apiserver v0.30.4 h1:rHkGJhxd+m4jILrgkenwSmG4X0QXk6ecGuybzS/PQak= -k8s.io/apiserver v0.30.4/go.mod h1:oyGAj9B9/0+I9huJyf4/8SMBF2mNh2bTMlu7703dkH8= -k8s.io/client-go v0.30.4 h1:eculUe+HPQoPbixfwmaSZGsKcOf7D288tH6hDAdd+wY= -k8s.io/client-go v0.30.4/go.mod h1:IBS0R/Mt0LHkNHF4E6n+SUDPG7+m2po6RZU7YHeOpzc= -k8s.io/code-generator v0.30.4 h1:1J2AcpPNBGh/NH9+m4TDh8Yj+mSbM+JyQhH0QdIMwmE= -k8s.io/code-generator v0.30.4/go.mod h1:Dd8gxOr5ieh9yHCLKnIkKDmk1H2glH8nYCAqwFogD2M= -k8s.io/component-base v0.30.4 h1:FlgKqazIkIIxpLA4wFXsiPiDllJn9fhsN3G4TeX7T7U= -k8s.io/component-base v0.30.4/go.mod h1:Qd3h+OJxV/LrnriXG/E15ZK83dzd306qJHW9+87S5ls= +k8s.io/api v0.31.0 h1:b9LiSjR2ym/SzTOlfMHm1tr7/21aD7fSkqgD/CVJBCo= +k8s.io/api v0.31.0/go.mod h1:0YiFF+JfFxMM6+1hQei8FY8M7s1Mth+z/q7eF1aJkTE= +k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk= +k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk= +k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= +k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/apiserver v0.31.0 h1:p+2dgJjy+bk+B1Csz+mc2wl5gHwvNkC9QJV+w55LVrY= +k8s.io/apiserver v0.31.0/go.mod h1:KI9ox5Yu902iBnnyMmy7ajonhKnkeZYJhTZ/YI+WEMk= +k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= +k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU= +k8s.io/code-generator v0.31.0 h1:w607nrMi1KeDKB3/F/J4lIoOgAwc+gV9ZKew4XRfMp8= +k8s.io/code-generator v0.31.0/go.mod h1:84y4w3es8rOJOUUP1rLsIiGlO1JuEaPFXQPA9e/K6U0= +k8s.io/component-base v0.31.0 h1:/KIzGM5EvPNQcYgwq5NwoQBaOlVFrghoVGr8lG6vNRs= +k8s.io/component-base v0.31.0/go.mod h1:TYVuzI1QmN4L5ItVdMSXKvH7/DtvIuas5/mm8YT3rTo= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1X/TByhmAoILTarmzo= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= -k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= -k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-aggregator v0.30.3 h1:hy5zfQ7p6BuJgc/XtGp3GBh2MPfOj6b1n3raKKMHOQE= k8s.io/kube-aggregator v0.30.3/go.mod h1:2SP0IckvQoOwwZN8lmtWUnTZTgIpwOWvidWtxyqLwuk= k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f h1:0LQagt0gDpKqvIkAMPaRGcXawNMouPECM1+F9BVxEaM= k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f/go.mod h1:S9tOR0FxgyusSNR+MboCuiDpVWkAifZvaYI1Q2ubgro= -k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 h1:jgGTlFYnhF1PM1Ax/lAlxUPE+KfCIXHaathvJg1C3ak= -k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= -sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q= +sigs.k8s.io/controller-runtime v0.19.0/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/pkg/features/features.go b/pkg/features/features.go index b4019f5f6..10b7dd14c 100644 --- a/pkg/features/features.go +++ b/pkg/features/features.go @@ -51,8 +51,8 @@ var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{ // Example: {Default: true, PreRelease: featuregate.Beta}, } -func SetFeatureGateDuringTest(tb testing.TB, f featuregate.Feature, value bool) func() { - return featuregatetesting.SetFeatureGateDuringTest(tb, utilfeature.DefaultFeatureGate, f, value) +func SetFeatureGateDuringTest(tb testing.TB, f featuregate.Feature, value bool) { + featuregatetesting.SetFeatureGateDuringTest(tb, utilfeature.DefaultFeatureGate, f, value) } // Enabled is helper for `utilfeature.DefaultFeatureGate.Enabled()` diff --git a/pkg/webhooks/jobset_webhook.go b/pkg/webhooks/jobset_webhook.go index 8c7588def..aaf9d26f6 100644 --- a/pkg/webhooks/jobset_webhook.go +++ b/pkg/webhooks/jobset_webhook.go @@ -167,7 +167,7 @@ func (j *jobSetWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) // This can return 1 or 2 errors, validating max length and format for _, errMessage := range validation.IsDNS1123Subdomain(js.Spec.Network.Subdomain) { - allErrs = append(allErrs, fmt.Errorf(errMessage)) + allErrs = append(allErrs, errors.New(errMessage)) } // Since subdomain name is also used as service name, it must adhere to RFC 1035 as well. @@ -175,7 +175,7 @@ func (j *jobSetWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) if strings.Contains(errMessage, dns1035MaxLengthExceededErrorMsg) { errMessage = subdomainTooLongErrMsg } - allErrs = append(allErrs, fmt.Errorf(errMessage)) + allErrs = append(allErrs, errors.New(errMessage)) } } @@ -208,7 +208,7 @@ func (j *jobSetWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) if strings.Contains(errMessage, dns1035MaxLengthExceededErrorMsg) { errMessage = jobNameTooLongErrorMsg } - allErrs = append(allErrs, fmt.Errorf(errMessage)) + allErrs = append(allErrs, errors.New(errMessage)) } // Check that the generated pod names for the replicated job is DNS 1035 compliant. isIndexedJob := rjob.Template.Spec.CompletionMode != nil && *rjob.Template.Spec.CompletionMode == batchv1.IndexedCompletion @@ -221,7 +221,7 @@ func (j *jobSetWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) if strings.Contains(errMessage, dns1035MaxLengthExceededErrorMsg) { errMessage = podNameTooLongErrorMsg } - allErrs = append(allErrs, fmt.Errorf(errMessage)) + allErrs = append(allErrs, errors.New(errMessage)) } } } diff --git a/pkg/webhooks/jobset_webhook_test.go b/pkg/webhooks/jobset_webhook_test.go index e86a6e4ae..210b7934e 100644 --- a/pkg/webhooks/jobset_webhook_test.go +++ b/pkg/webhooks/jobset_webhook_test.go @@ -915,7 +915,7 @@ func TestValidateCreate(t *testing.T) { }, }, want: errors.Join( - fmt.Errorf(subdomainTooLongErrMsg), + errors.New(subdomainTooLongErrMsg), ), }, { @@ -975,7 +975,7 @@ func TestValidateCreate(t *testing.T) { }, }, want: errors.Join( - fmt.Errorf(jobNameTooLongErrorMsg), + errors.New(jobNameTooLongErrorMsg), ), }, { @@ -1009,7 +1009,7 @@ func TestValidateCreate(t *testing.T) { }, }, want: errors.Join( - fmt.Errorf(podNameTooLongErrorMsg), + errors.New(podNameTooLongErrorMsg), ), }, } diff --git a/site/content/en/docs/reference/jobset.v1alpha2.md b/site/content/en/docs/reference/jobset.v1alpha2.md index 17a53a0f6..fc1f31491 100644 --- a/site/content/en/docs/reference/jobset.v1alpha2.md +++ b/site/content/en/docs/reference/jobset.v1alpha2.md @@ -46,6 +46,48 @@ description: Generated API reference documentation for jobset.x-k8s.io/v1alpha2. +## `Coordinator` {#jobset-x-k8s-io-v1alpha2-Coordinator} + + +**Appears in:** + +- [JobSetSpec](#jobset-x-k8s-io-v1alpha2-JobSetSpec) + + +

Coordinator defines which pod can be marked as the coordinator for the JobSet workload.

+ + + + + + + + + + + + + + + + + +
FieldDescription
replicatedJob [Required]
+string +
+

ReplicatedJob is the name of the ReplicatedJob which contains +the coordinator pod.

+
jobIndex [Required]
+int +
+

JobIndex is the index of Job which contains the coordinator pod +(i.e., for a ReplicatedJob with N replicas, there are Job indexes 0 to N-1).

+
podIndex [Required]
+int +
+

PodIndex is the Job completion index of the coordinator pod.

+
+ ## `FailurePolicy` {#jobset-x-k8s-io-v1alpha2-FailurePolicy} @@ -215,6 +257,17 @@ finished with status failed.

Suspend suspends all running child Jobs when set to true.

+coordinator
+Coordinator + + +

Coordinator can be used to assign a specific pod as the coordinator for +the JobSet. If defined, an annotation will be added to all Jobs and pods with +coordinator pod, which contains the stable network endpoint where the +coordinator pod can be reached. +jobset.sigs.k8s.io/coordinator=.

+ + managedBy
string