Skip to content

Commit 85cab62

Browse files
committed
clean up
1 parent 52640cf commit 85cab62

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
/** Annotates pods, services with details about the Domain instance and checks these annotations. */
1414
public class AnnotationHelper {
15-
private static final boolean DEBUG = true;
15+
private static final boolean DEBUG = false;
1616
static final String SHA256_ANNOTATION = "weblogic.sha256";
1717
private static final String HASHED_STRING = "hashedString";
1818
private static Function<V1Pod, String> HASH_FUNCTION =
@@ -34,9 +34,18 @@ static void annotateForPrometheus(V1ObjectMeta meta, int httpPort) {
3434
}
3535

3636
static V1Pod withSha256Hash(V1Pod pod) {
37+
return DEBUG ? addHashAndDebug(pod) : addHash(pod);
38+
}
39+
40+
private static V1Pod addHashAndDebug(V1Pod pod) {
3741
String dump = Yaml.dump(pod);
42+
addHash(pod);
43+
pod.getMetadata().putAnnotationsItem(HASHED_STRING, dump);
44+
return pod;
45+
}
46+
47+
private static V1Pod addHash(V1Pod pod) {
3848
pod.getMetadata().putAnnotationsItem(SHA256_ANNOTATION, HASH_FUNCTION.apply(pod));
39-
if (DEBUG) pod.getMetadata().putAnnotationsItem(HASHED_STRING, dump);
4049
return pod;
4150
}
4251

operator/src/test/java/oracle/kubernetes/operator/helpers/AdminPodHelperTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,4 +458,6 @@ List<String> createStartCommand() {
458458
protected ServerConfigurator configureServer(DomainConfigurator configurator, String serverName) {
459459
return configurator.configureAdminServer();
460460
}
461+
462+
// todo test that changing the cert in tuning parameters does not change the hash
461463
}

operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,8 @@ public void whenDomainPresenceInfoLacksImageName_createdPodUsesDefaultImage() {
922922
assertThat(getCreatedPodSpecContainer().getImage(), equalTo(DEFAULT_IMAGE));
923923
}
924924

925+
// todo test that changing a label or annotation does not change the hash
926+
925927
interface PodMutator {
926928
void mutate(V1Pod pod);
927929
}

0 commit comments

Comments
 (0)