Skip to content

Commit

Permalink
perf: Job 切换 GSE2.0 支持灰度策略 TencentBlueKing#2461
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu096 committed Oct 7, 2023
1 parent 0030ce2 commit f4985e1
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,16 @@

import com.tencent.bk.job.common.util.feature.FeatureStore;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
* 特性开关配置加载 ApplicationRunner
*/
@Component
@Slf4j
public class FeatureLoadApplicationRunner implements ApplicationRunner {
private final FeatureStore featureStore;

@Autowired
public FeatureLoadApplicationRunner(FeatureStore featureStore) {
this.featureStore = featureStore;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available.
*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
*
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License.
*
* License for BK-JOB蓝鲸智云作业平台:
* --------------------------------------------------------------------
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

package com.tencent.bk.job.common.service.feature;

import com.tencent.bk.job.common.util.feature.FeatureStore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
public class FeatureToggleAutoConfiguration {

@Bean
public FeatureStore featureStore() {
return new InMemoryFeatureStore();
}

@Bean
public FeatureLoadApplicationRunner featureLoadApplicationRunner(FeatureStore featureStore) {
return new FeatureLoadApplicationRunner(featureStore);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import com.tencent.bk.job.common.util.feature.ToggleStrategy;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -50,7 +49,6 @@
* 特性开关配置存储实现
*/
@Slf4j
@Component
public class InMemoryFeatureStore implements FeatureStore {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# AutoConfiguration
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.bk.job.common.service.lb.JobLoadBalancerClientAutoConfiguration, \
com.tencent.bk.job.common.service.deploy.DeployAutoConfiguration
com.tencent.bk.job.common.service.deploy.DeployAutoConfiguration, \
com.tencent.bk.job.common.service.feature.FeatureToggleAutoConfiguration

0 comments on commit f4985e1

Please sign in to comment.