Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package kr.co.mcmp.softwarecatalog.kubernetes.config;

import io.fabric8.kubernetes.client.Config;
import kr.co.mcmp.ape.cbtumblebug.dto.K8sClusterDto;
import org.springframework.stereotype.Component;

@Component
public class AlibabaConfigProvider implements KubeConfigProvider {
@Override
public Config buildConfig(K8sClusterDto dto) {
String yaml = dto.getAccessInfo().getKubeconfig();
Config cfg = Config.fromKubeconfig(yaml);
cfg.setTrustCerts(true);
cfg.setConnectionTimeout(30_000);
cfg.setRequestTimeout(30_000);
return cfg;
}

@Override
public boolean supports(String providerName) {
return "alibaba".equalsIgnoreCase(providerName);
}

@Override
public String getOriginalKubeconfigYaml(K8sClusterDto dto) {
if (dto == null) {
throw new IllegalArgumentException("K8sClusterDto cannot be null");
}

if (dto.getAccessInfo() == null) {
throw new IllegalStateException("AccessInfo is null for Azure cluster: " + dto.getName());
}

String kubeconfig = dto.getAccessInfo().getKubeconfig();
if (kubeconfig == null || kubeconfig.trim().isEmpty()) {
throw new IllegalStateException("Kubeconfig is null or empty for Azure cluster: " + dto.getName());
}

return kubeconfig;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ private void installMetricsServer(KubernetesClient client) throws IOException {

private String downloadMetricsServerYaml() throws IOException, InterruptedException {
String url = "https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml";
Process process = Runtime.getRuntime().exec("curl -s " + url);
Process process = Runtime.getRuntime().exec("curl -s -L " + url);
process.waitFor();
return new String(process.getInputStream().readAllBytes());
}
Expand Down
Loading