Search in sources :

Example 1 with SecretHelper

use of oracle.kubernetes.operator.helpers.SecretHelper in project weblogic-kubernetes-operator by oracle.

the class SecretHelperTest method setUp.

@Before
public void setUp() throws Exception {
    CallBuilderFactory factory = new CallBuilderFactory(null);
    // Determine if 1.8 since some bugs with kubernetes-client / java and secrets
    VersionInfo verInfo = factory.create().readVersionCode();
    if ("1".equals(verInfo.getMajor()) && "8".equals(verInfo.getMinor())) {
        isVersion18 = true;
    }
    createNamespace(UNIT_NAMESPACE);
    createSecret(SECRET_NAME, UNIT_NAMESPACE);
    createInvalidSecret(INVALID_SECRET_NAME, UNIT_NAMESPACE);
    createSecret(SECRET_NAME, "default");
    defaultSecretHelper = new SecretHelper("default");
    unitSecretHelper = new SecretHelper(UNIT_NAMESPACE);
}
Also used : VersionInfo(io.kubernetes.client.models.VersionInfo) SecretHelper(oracle.kubernetes.operator.helpers.SecretHelper) CallBuilderFactory(oracle.kubernetes.operator.helpers.CallBuilderFactory) Before(org.junit.Before)

Example 2 with SecretHelper

use of oracle.kubernetes.operator.helpers.SecretHelper in project weblogic-kubernetes-operator by oracle.

the class HttpClient method createAuthenticatedClientForServer.

/**
 * Create authenticated client specifically targeted at an admin server
 * @param principal Principal
 * @param namespace Namespace
 * @param adminSecretName Admin secret name
 * @return authenticated client
 */
public static HttpClient createAuthenticatedClientForServer(String principal, String namespace, String adminSecretName) {
    SecretHelper secretHelper = new SecretHelper(namespace);
    Map<String, byte[]> secretData = secretHelper.getSecretData(SecretHelper.SecretType.AdminCredentials, adminSecretName);
    byte[] username = null;
    byte[] password = null;
    if (secretData != null) {
        username = secretData.get(SecretHelper.ADMIN_SERVER_CREDENTIALS_USERNAME);
        password = secretData.get(SecretHelper.ADMIN_SERVER_CREDENTIALS_PASSWORD);
    }
    return createAuthenticatedClient(principal, username, password);
}
Also used : SecretHelper(oracle.kubernetes.operator.helpers.SecretHelper)

Aggregations

SecretHelper (oracle.kubernetes.operator.helpers.SecretHelper)2 VersionInfo (io.kubernetes.client.models.VersionInfo)1 CallBuilderFactory (oracle.kubernetes.operator.helpers.CallBuilderFactory)1 Before (org.junit.Before)1