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);
}
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);
}
Aggregations