Browse Source

kubesphere配置bug修改

Rgx 1 year ago
parent
commit
c55496bd26

+ 8 - 1
src/main/java/io/renren/modules/kubesphere/config/KubeSphereConfig.java

@@ -14,15 +14,22 @@ import org.springframework.web.client.RestTemplate;
 @Configuration
 public class KubeSphereConfig {
     public static String kubesphereUrl;
+    public static String host;
 
     @Value("${kubesphereUrl}")
     public void setKubesphereUrl(String kubesphereUrl) {
         KubeSphereConfig.kubesphereUrl = kubesphereUrl;
     }
 
+    @Value("${kubesphereUrl}")
+    public void setHost(String host) {
+        KubeSphereConfig.host = host;
+    }
+
     public static class URL {
 
-        private static final String host = "http://42.192.195.253:30881";
+
+        //private static final String host = "http://43.143.237.223:30881";
         // s2i相关url
         public static final String S2I_BUILDER_URL = host + "/apis/devops.kubesphere.io/v1alpha1/namespaces/mkcloud/s2ibuilders";
         public static final String S2I_CREATE_BINARY_QUERY_URL = host + "/apis/devops.kubesphere.io/v1alpha1/namespaces/mkcloud/s2ibinaries";

+ 2 - 1
src/main/java/io/renren/modules/kubesphere/service/OauthTokenService.java

@@ -33,8 +33,9 @@ public class OauthTokenService {
         HttpHeaders headers = new HttpHeaders();
         headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
         LinkedMultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
+        // 这里是为了登陆kubesphere,要向kuberphere发送token
         params.add("grant_type", "password");
-        params.add("username", username);
+        params.add("username", "admin");
         params.add("password", "MKcloud123");
         HttpEntity<LinkedMultiValueMap<String, Object>> request = new HttpEntity<>(params, headers);
         // 泛型为接口返回数据的类型