github.com/oam-dev/kubevela@v1.9.11/pkg/controller/core.oam.dev/oamruntime_controller.go (about) 1 /* 2 Copyright 2021 The KubeVela Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package core_oam_dev 18 19 import ( 20 "github.com/spf13/pflag" 21 22 "github.com/kubevela/workflow/pkg/cue/packages" 23 ) 24 25 // Args args used by controller 26 type Args struct { 27 28 // RevisionLimit is the maximum number of revisions that will be maintained. 29 // The default value is 50. 30 RevisionLimit int 31 32 // AppRevisionLimit is the maximum number of application revisions that will be maintained. 33 // The default value is 10. 34 AppRevisionLimit int 35 36 // DefRevisionLimit is the maximum number of component/trait definition revisions that will be maintained. 37 // The default value is 20. 38 DefRevisionLimit int 39 40 // PackageDiscover used for CRD discovery in CUE packages, a K8s client is contained in it. 41 PackageDiscover *packages.PackageDiscover 42 43 // ConcurrentReconciles is the concurrent reconcile number of the controller 44 ConcurrentReconciles int 45 46 // AutoGenWorkloadDefinition indicates whether automatic generated workloadDefinition which componentDefinition refers to 47 AutoGenWorkloadDefinition bool 48 49 // IgnoreAppWithoutControllerRequirement indicates that application controller will not process the app without 'app.oam.dev/controller-version-require' annotation. 50 IgnoreAppWithoutControllerRequirement bool 51 52 // IgnoreDefinitionWithoutControllerRequirement indicates that trait/component/workflowstep definition controller will not process the definition without 'definition.oam.dev/controller-version-require' annotation. 53 IgnoreDefinitionWithoutControllerRequirement bool 54 } 55 56 // AddFlags adds flags to the specified FlagSet 57 func (a *Args) AddFlags(fs *pflag.FlagSet, c *Args) { 58 fs.IntVar(&a.RevisionLimit, "revision-limit", c.RevisionLimit, 59 "RevisionLimit is the maximum number of revisions that will be maintained. The default value is 50.") 60 fs.IntVar(&a.AppRevisionLimit, "application-revision-limit", c.AppRevisionLimit, 61 "application-revision-limit is the maximum number of application useless revisions that will be maintained, if the useless revisions exceed this number, older ones will be GCed first.The default value is 10.") 62 fs.IntVar(&a.DefRevisionLimit, "definition-revision-limit", c.DefRevisionLimit, 63 "definition-revision-limit is the maximum number of component/trait definition useless revisions that will be maintained, if the useless revisions exceed this number, older ones will be GCed first.The default value is 20.") 64 fs.BoolVar(&a.AutoGenWorkloadDefinition, "autogen-workload-definition", c.AutoGenWorkloadDefinition, "Automatic generated workloadDefinition which componentDefinition refers to.") 65 fs.IntVar(&a.ConcurrentReconciles, "concurrent-reconciles", c.ConcurrentReconciles, "concurrent-reconciles is the concurrent reconcile number of the controller. The default value is 4") 66 fs.BoolVar(&a.IgnoreAppWithoutControllerRequirement, "ignore-app-without-controller-version", c.IgnoreAppWithoutControllerRequirement, "If true, application controller will not process the app without 'app.oam.dev/controller-version-require' annotation") 67 fs.BoolVar(&a.IgnoreDefinitionWithoutControllerRequirement, "ignore-definition-without-controller-version", c.IgnoreDefinitionWithoutControllerRequirement, "If true, trait/component/workflowstep definition controller will not process the definition without 'definition.oam.dev/controller-version-require' annotation") 68 }