
io.kubernetes.client.util.KubeConfig Maven / Gradle / Ivy
The newest version!
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package io.kubernetes.client.util;
import io.kubernetes.client.util.authenticators.Authenticator;
import org.apache.log4j.Logger;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* KubeConfig represents a kubernetes client configuration
*/
public class KubeConfig {
// Defaults for where to find a kubeconfig file
public static final String ENV_HOME = "HOME";
public static final String KUBEDIR = ".kube";
public static final String KUBECONFIG = "config";
private static Map authenticators = new HashMap<>();
// Note to the reader: I considered creating a Config object
// and parsing into that instead of using Maps, but honestly
// this seemed cleaner than a bunch of boilerplate classes
private ArrayList
© 2015 - 2025 Weber Informatics LLC | Privacy Policy