github.com/oam-dev/kubevela@v1.9.11/pkg/features/controller_features.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 features 18 19 import ( 20 "k8s.io/apimachinery/pkg/util/runtime" 21 "k8s.io/apiserver/pkg/util/feature" 22 "k8s.io/component-base/featuregate" 23 ) 24 25 const ( 26 // Compatibility Features 27 28 // DeprecatedPolicySpec enable the use of deprecated policy spec 29 DeprecatedPolicySpec featuregate.Feature = "DeprecatedPolicySpec" 30 // LegacyObjectTypeIdentifier enable the use of legacy object type identifier for selecting ref-object 31 LegacyObjectTypeIdentifier featuregate.Feature = "LegacyObjectTypeIdentifier" 32 // DeprecatedObjectLabelSelector enable the use of deprecated object label selector for selecting ref-object 33 DeprecatedObjectLabelSelector featuregate.Feature = "DeprecatedObjectLabelSelector" 34 // LegacyResourceTrackerGC enable the gc of legacy resource tracker in managed clusters 35 LegacyResourceTrackerGC featuregate.Feature = "LegacyResourceTrackerGC" 36 // LegacyResourceOwnerValidation if enabled, the resource dispatch will allow existing resource not to have owner 37 // application and the current application will take over it 38 LegacyResourceOwnerValidation featuregate.Feature = "LegacyResourceOwnerValidation" 39 // DisableReferObjectsFromURL if set, the url ref objects will be disallowed 40 DisableReferObjectsFromURL featuregate.Feature = "DisableReferObjectsFromURL" 41 42 // ApplyResourceByReplace enforces the modification of resource through PUT requests. 43 // If not set, the resource modification will use patch requests (three-way-strategy-merge-patch). 44 // The side effect of enabling this feature is that the request traffic will increase due to 45 // the increase of bytes transferred and the more frequent resource mutation failure due to the 46 // potential conflicts. 47 // If set, KubeVela controller will enforce strong restriction on the managed resource that external 48 // system would be unable to make modifications to the KubeVela managed resource. In other words, 49 // no merge for modifications from multiple sources. Only KubeVela keeps the Source-of-Truth for the 50 // resource. 51 ApplyResourceByReplace featuregate.Feature = "ApplyResourceByReplace" 52 53 // Edge Features 54 55 // AuthenticateApplication enable the authentication for application 56 AuthenticateApplication featuregate.Feature = "AuthenticateApplication" 57 // GzipResourceTracker enables the gzip compression for ResourceTracker. It can be useful if you have large 58 // application that needs to dispatch lots of resources or large resources (like CRD or huge ConfigMap), 59 // which at the cost of slower processing speed due to the extra overhead for compression and decompression. 60 GzipResourceTracker featuregate.Feature = "GzipResourceTracker" 61 // ZstdResourceTracker enables the zstd compression for ResourceTracker. 62 // Refer to GzipResourceTracker for its use-cases. It is much faster and more 63 // efficient than gzip, about 2x faster and compresses to smaller size. 64 // If you are dealing with very large ResourceTrackers (1MB or so), it should 65 // have almost NO performance penalties compared to no compression at all. 66 // If dealing with smaller ResourceTrackers (10KB - 1MB), the performance 67 // penalties are minimal. 68 ZstdResourceTracker featuregate.Feature = "ZstdResourceTracker" 69 70 // GzipApplicationRevision serves the same purpose as GzipResourceTracker, 71 // but for ApplicationRevision. 72 GzipApplicationRevision featuregate.Feature = "GzipApplicationRevision" 73 // ZstdApplicationRevision serves the same purpose as ZstdResourceTracker, 74 // but for ApplicationRevision. 75 ZstdApplicationRevision featuregate.Feature = "ZstdApplicationRevision" 76 77 // ApplyOnce enable the apply-once feature for all applications 78 // If enabled, no StateKeep will be run, ResourceTracker will also disable the storage of all resource data, only 79 // metadata will be kept 80 ApplyOnce featuregate.Feature = "ApplyOnce" 81 82 // MultiStageComponentApply enable multi-stage feature for component 83 // If enabled, the dispatch of manifests is performed in batches according to the stage 84 MultiStageComponentApply featuregate.Feature = "MultiStageComponentApply" 85 86 // PreDispatchDryRun enable dryrun before dispatching resources 87 // Enable this flag can help prevent unsuccessful dispatch resources entering resourcetracker and improve the 88 // user experiences of gc but at the cost of increasing network requests. 89 PreDispatchDryRun featuregate.Feature = "PreDispatchDryRun" 90 91 // ValidateComponentWhenSharding validate component in sharding mode 92 // In sharding mode, since ApplicationRevision will not be cached for webhook, the validation of component 93 // need to call Kubernetes APIServer which can be slow and take up some network traffic. So by default, the 94 // validation of component will be disabled. 95 ValidateComponentWhenSharding = "ValidateComponentWhenSharding" 96 97 // DisableWebhookAutoSchedule disable auto schedule for application mutating webhook when sharding enabled 98 // If set to true, the webhook will not make auto schedule for applications and users can make customized 99 // scheduler for assigning shards to applications 100 DisableWebhookAutoSchedule = "DisableWebhookAutoSchedule" 101 102 // DisableBootstrapClusterInfo disable the cluster info bootstrap at the starting of the controller 103 DisableBootstrapClusterInfo = "DisableBootstrapClusterInfo" 104 105 // InformerCacheFilterUnnecessaryFields filter unnecessary fields for informer cache 106 InformerCacheFilterUnnecessaryFields = "InformerCacheFilterUnnecessaryFields" 107 108 // SharedDefinitionStorageForApplicationRevision use definition cache to reduce duplicated definition storage 109 // for application revision, must be used with InformerCacheFilterUnnecessaryFields 110 SharedDefinitionStorageForApplicationRevision = "SharedDefinitionStorageForApplicationRevision" 111 112 // DisableWorkflowContextConfigMapCache disable the workflow context's configmap informer cache 113 DisableWorkflowContextConfigMapCache = "DisableWorkflowContextConfigMapCache" 114 ) 115 116 var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{ 117 DeprecatedPolicySpec: {Default: false, PreRelease: featuregate.Alpha}, 118 LegacyObjectTypeIdentifier: {Default: false, PreRelease: featuregate.Alpha}, 119 DeprecatedObjectLabelSelector: {Default: false, PreRelease: featuregate.Alpha}, 120 LegacyResourceTrackerGC: {Default: false, PreRelease: featuregate.Beta}, 121 LegacyResourceOwnerValidation: {Default: false, PreRelease: featuregate.Alpha}, 122 DisableReferObjectsFromURL: {Default: false, PreRelease: featuregate.Alpha}, 123 ApplyResourceByReplace: {Default: false, PreRelease: featuregate.Alpha}, 124 AuthenticateApplication: {Default: false, PreRelease: featuregate.Alpha}, 125 GzipResourceTracker: {Default: false, PreRelease: featuregate.Alpha}, 126 ZstdResourceTracker: {Default: false, PreRelease: featuregate.Alpha}, 127 ApplyOnce: {Default: false, PreRelease: featuregate.Alpha}, 128 MultiStageComponentApply: {Default: false, PreRelease: featuregate.Alpha}, 129 GzipApplicationRevision: {Default: false, PreRelease: featuregate.Alpha}, 130 ZstdApplicationRevision: {Default: false, PreRelease: featuregate.Alpha}, 131 PreDispatchDryRun: {Default: true, PreRelease: featuregate.Alpha}, 132 ValidateComponentWhenSharding: {Default: false, PreRelease: featuregate.Alpha}, 133 DisableWebhookAutoSchedule: {Default: false, PreRelease: featuregate.Alpha}, 134 DisableBootstrapClusterInfo: {Default: false, PreRelease: featuregate.Alpha}, 135 InformerCacheFilterUnnecessaryFields: {Default: true, PreRelease: featuregate.Alpha}, 136 SharedDefinitionStorageForApplicationRevision: {Default: true, PreRelease: featuregate.Alpha}, 137 DisableWorkflowContextConfigMapCache: {Default: true, PreRelease: featuregate.Alpha}, 138 } 139 140 func init() { 141 runtime.Must(feature.DefaultMutableFeatureGate.Add(defaultFeatureGates)) 142 }