Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hotfix] k8s helm support using the default Kubernetes client configuration #3250

Merged
merged 1 commit into from
Oct 14, 2024
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
Expand Up @@ -31,6 +31,7 @@
import io.fabric8.kubernetes.api.model.apps.DeploymentBuilder;
import io.fabric8.kubernetes.api.model.apps.DeploymentSpec;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.ConfigBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
import org.apache.amoro.resource.Resource;
Expand All @@ -51,6 +52,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

/** Kubernetes Optimizer Container with Standalone Optimizer */
Expand All @@ -77,8 +79,12 @@ public class KubernetesOptimizerContainer extends AbstractResourceContainer {
public void init(String name, Map<String, String> containerProperties) {
super.init(name, containerProperties);
// start k8s job using k8s client
String kubeConfigPath = checkAndGetProperty(containerProperties, KUBE_CONFIG_PATH);
Config config = Config.fromKubeconfig(getKubeConfigContent(kubeConfigPath));
Optional<String> kubeConfigPath =
Optional.ofNullable(containerProperties.get(KUBE_CONFIG_PATH));
Config config =
kubeConfigPath
.map(path -> Config.fromKubeconfig(getKubeConfigContent(path)))
.orElseGet(() -> new ConfigBuilder().build());
this.client = new KubernetesClientBuilder().withConfig(config).build();
}

Expand Down
3 changes: 2 additions & 1 deletion charts/amoro/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ optimizer:
enabled: true
properties:
namespace: "default"
kube-config-path: "~/.kube/config"
# if service account rbac not have, need kube config set in optimizer deployment
#kube-config-path: "~/.kube/config"
image: "apache/amoro:latest"
pullPolicy: "IfNotPresent"
extra: []
Expand Down
Loading