Skip to content

Commit

Permalink
Use manage to specify resources
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Sep 3, 2024
1 parent f840dce commit bf7e65d
Show file tree
Hide file tree
Showing 14 changed files with 1,055 additions and 155 deletions.
7 changes: 7 additions & 0 deletions pkg/apis/config/v1alpha1/kwok_configuration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ type KwokConfigurationOptions struct {
// is the default value for flag --tls-private-key-file
TLSPrivateKeyFile string `json:"tlsPrivateKeyFile,omitempty"`

// Manages is the option to manage an resources
Manages ManagesSelectors `json:"manages,omitempty"`

// ManageSingleNode is the option to manage a single node name.
// is the default value for flag --manage-single-node
// Note: when `manage-all-nodes` is specified as true or
// `manage-nodes-with-label-selector` or `manage-nodes-with-annotation-selector` is specified,
// this is a no-op.
// Deprecated: use Manages instead
ManageSingleNode string `json:"manageSingleNode,omitempty"`

// Default option to manage (i.e., maintain heartbeat/liveness of) all Nodes or not.
Expand All @@ -83,20 +87,23 @@ type KwokConfigurationOptions struct {
// `manage-nodes-with-label-selector` or `manage-nodes-with-annotation-selector` is specified,
// this is a no-op.
// +default=false
// Deprecated: use Manages instead
ManageAllNodes *bool `json:"manageAllNodes,omitempty"`

// Default annotations specified on Nodes to demand manage.
// is the default value for flag --manage-nodes-with-annotation-selector
// Note: when `all-node-manage` is specified as true or
// `manage-single-node` is specified,
// this is a no-op.
// Deprecated: use Manages instead
ManageNodesWithAnnotationSelector string `json:"manageNodesWithAnnotationSelector,omitempty"`

// Default labels specified on Nodes to demand manage.
// is the default value for flag --manage-nodes-with-label-selector
// Note: when `all-node-manage` is specified as true or
// `manage-single-node` is specified,
// this is a no-op.
// Deprecated: use Manages instead
ManageNodesWithLabelSelector string `json:"manageNodesWithLabelSelector,omitempty"`

// If a Node/Pod is on a managed Node and has this annotation status will not be modified
Expand Down
38 changes: 38 additions & 0 deletions pkg/apis/config/v1alpha1/kwok_manage_selector_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Copyright 2024 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

// ManagesSelectors holds information about the manages selectors.
type ManagesSelectors []ManagesSelector

// ManagesSelector holds information about the manages selector.
type ManagesSelector struct {
// Kind of the referent.
Kind string `json:"kind"`
// Group of the referent.
Group string `json:"group,omitempty"`
// Version of the referent.
Version string `json:"version,omitempty"`
// Namespace of the referent. only valid if it is a namespaced.
Namespace string `json:"namespace,omitempty"`
// Name of the referent. specify only this one.
Name string `json:"name,omitempty"`
// Labels of the referent. specify matched with labels.
Labels map[string]string `json:"labels,omitempty"`
// Annotations of the referent. specify matched with annotations.
Annotations map[string]string `json:"annotations,omitempty"`
}
59 changes: 59 additions & 0 deletions pkg/apis/config/v1alpha1/zz_generated.deepcopy.go

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

7 changes: 7 additions & 0 deletions pkg/apis/internalversion/kwok_configuration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,23 @@ type KwokConfigurationOptions struct {
// TLSPrivateKeyFile is the ile containing x509 private key
TLSPrivateKeyFile string

// Manages is the option to manage the resource
Manages ManagesSelectors

// ManageSingleNode is the option to manage a single node name
// Deprecated: use Manages instead
ManageSingleNode string

// Default option to manage (i.e., maintain heartbeat/liveness of) all Nodes or not.
// Deprecated: use Manages instead
ManageAllNodes bool

// Default annotations specified on Nodes to demand manage.
// Deprecated: use Manages instead
ManageNodesWithAnnotationSelector string

// Default labels specified on Nodes to demand manage.
// Deprecated: use Manages instead
ManageNodesWithLabelSelector string

// If a Node/Pod is on a managed Node and has this annotation status will not be modified
Expand Down
Loading

0 comments on commit bf7e65d

Please sign in to comment.