-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
880 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
Copyright 2024 The OpenYurt 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 options | ||
|
||
import ( | ||
"github.com/spf13/pflag" | ||
|
||
"github.com/openyurtio/openyurt/pkg/yurtmanager/controller/autonomy/config" | ||
) | ||
|
||
type AutonomyControllerOptions struct { | ||
*config.AutonomyControllerConfiguration | ||
} | ||
|
||
func NewAutonomyControllerOptions() *AutonomyControllerOptions { | ||
return &AutonomyControllerOptions{ | ||
&config.AutonomyControllerConfiguration{ | ||
ConcurrentAutonomyWorkers: 3, | ||
}, | ||
} | ||
} | ||
|
||
// AddFlags adds flags related to autonomy manager to the specified FlagSet. | ||
func (o *AutonomyControllerOptions) AddFlags(fs *pflag.FlagSet) { | ||
if o == nil { | ||
return | ||
} | ||
|
||
fs.Int32Var(&o.ConcurrentAutonomyWorkers, "concurrent-autonomy-workers", o.ConcurrentAutonomyWorkers, "The number of autonomy controller that are allowed to reconcile concurrently. Larger number = more responsive autonomy controller, but more CPU (and network) load") | ||
} | ||
|
||
func (o *AutonomyControllerOptions) ApplyTo(cfg *config.AutonomyControllerConfiguration) error { | ||
if o == nil { | ||
return nil | ||
} | ||
cfg.ConcurrentAutonomyWorkers = o.ConcurrentAutonomyWorkers | ||
return nil | ||
} | ||
|
||
func (o *AutonomyControllerOptions) Validate() []error { | ||
if o == nil { | ||
return nil | ||
} | ||
var errs []error | ||
return errs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
Copyright 2024 The OpenYurt 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 v1beta1 | ||
|
||
import v1 "k8s.io/api/core/v1" | ||
|
||
const ( | ||
NodeAutonomy v1.NodeConditionType = "Autonomy" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.