Skip to content

Commit 61bab68

Browse files
committed
Reduce logging
1 parent 06a0636 commit 61bab68

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/main/java/oracle/kubernetes/operator/helpers/SecretHelper.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,18 @@ public Map<String, byte[]> getSecretData(SecretType secretType, String secretNam
8181
throw new IllegalArgumentException("Invalid secret name");
8282
}
8383

84-
LOGGER.info(MessageKeys.RETRIEVING_SECRET, secretName);
84+
LOGGER.fine(MessageKeys.RETRIEVING_SECRET, secretName);
8585

8686
V1Secret secret = client.callBuilder().readSecret(secretName, namespace);
8787
if (secret == null || secret.getData() == null) {
88-
LOGGER.info(MessageKeys.SECRET_NOT_FOUND, secretName);
88+
LOGGER.warning(MessageKeys.SECRET_NOT_FOUND, secretName);
8989
LOGGER.exiting(null);
9090
return null;
9191
}
9292

9393
return harvestAdminSecretData(secret);
9494
} catch (Throwable e) {
95-
LOGGER.warning(MessageKeys.EXCEPTION, e);
95+
LOGGER.severe(MessageKeys.EXCEPTION, e);
9696
return null;
9797
} finally {
9898
LOGGER.exiting();
@@ -131,17 +131,16 @@ public NextAction apply(Packet packet) {
131131
throw new IllegalArgumentException("Invalid secret name");
132132
}
133133

134-
LOGGER.info(MessageKeys.RETRIEVING_SECRET, secretName);
134+
LOGGER.fine(MessageKeys.RETRIEVING_SECRET, secretName);
135135
Step read = CallBuilder.create().readSecretAsync(secretName, namespace, new ResponseStep<V1Secret>(next) {
136136
@Override
137137
public NextAction onFailure(Packet packet, ApiException e, int statusCode,
138138
Map<String, List<String>> responseHeaders) {
139-
NextAction nextAction = super.onFailure(packet, e, statusCode, responseHeaders);
140-
if (nextAction.getNext() == null) {
141-
// no further retries
142-
LOGGER.info(MessageKeys.SECRET_NOT_FOUND, secretName);
139+
if (statusCode == CallBuilder.NOT_FOUND) {
140+
LOGGER.warning(MessageKeys.SECRET_NOT_FOUND, secretName);
141+
return doNext(packet);
143142
}
144-
return nextAction;
143+
return super.onFailure(packet, e, statusCode, responseHeaders);
145144
}
146145

147146
@Override
@@ -164,13 +163,13 @@ private static Map<String, byte[]> harvestAdminSecretData(V1Secret secret) {
164163
if (usernameBytes != null) {
165164
secretData.put(ADMIN_SERVER_CREDENTIALS_USERNAME, usernameBytes);
166165
} else {
167-
LOGGER.info(MessageKeys.SECRET_DATA_NOT_FOUND, ADMIN_SERVER_CREDENTIALS_USERNAME);
166+
LOGGER.warning(MessageKeys.SECRET_DATA_NOT_FOUND, ADMIN_SERVER_CREDENTIALS_USERNAME);
168167
}
169168

170169
if (passwordBytes != null) {
171170
secretData.put(ADMIN_SERVER_CREDENTIALS_PASSWORD, passwordBytes);
172171
} else {
173-
LOGGER.info(MessageKeys.SECRET_DATA_NOT_FOUND, ADMIN_SERVER_CREDENTIALS_PASSWORD);
172+
LOGGER.warning(MessageKeys.SECRET_DATA_NOT_FOUND, ADMIN_SERVER_CREDENTIALS_PASSWORD);
174173
}
175174
return secretData;
176175
}

0 commit comments

Comments
 (0)