Skip to content

Commit 2569ce4

Browse files
committed
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernetes-operator into feature/java-integration-tests
2 parents 04a8b57 + 0848a59 commit 2569ce4

File tree

16 files changed

+1191
-650
lines changed

16 files changed

+1191
-650
lines changed

docs/charts/index.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apiVersion: v1
22
entries:
33
weblogic-operator:
4-
- created: 2019-02-14T14:24:39.055209-05:00
4+
- created: 2019-02-19T16:57:25.809580117-05:00
55
description: Helm chart for configuring the WebLogic operator.
6-
digest: b3d5d765758da69dc6020dd47e84d532ba9464630c010aafbbf97e9c38495aec
6+
digest: 155ebf001218919a6b478bbf82068301736cfdaa1be6bb86ac49fb91a859be28
77
name: weblogic-operator
88
urls:
99
- https://oracle.github.io/weblogic-kubernetes-operator/charts/weblogic-operator-2.1.tgz
1010
version: "2.1"
11-
generated: 2019-02-14T14:24:39.053451-05:00
11+
generated: 2019-02-19T16:57:25.805229234-05:00

docs/charts/weblogic-operator-2.1.tgz

-1.37 KB
Binary file not shown.

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/DomainV2Configurator.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public DomainConfigurator createFor(Domain domain) {
2828

2929
public DomainV2Configurator() {}
3030

31-
public DomainV2Configurator(@Nonnull Domain domain) {
31+
DomainV2Configurator(@Nonnull Domain domain) {
3232
super(domain);
3333
setApiVersion(domain);
3434
}
@@ -93,26 +93,20 @@ public DomainConfigurator withConfigOverrides(String configMapName) {
9393
}
9494

9595
@Override
96-
/**
97-
* Sets the WebLogic configuration overrides secret names for the domain
98-
*
99-
* @param secretNames a list of secret names
100-
* @return this object
101-
*/
10296
public DomainConfigurator withConfigOverrideSecrets(String... secretNames) {
10397
getDomainSpec().setConfigOverrideSecrets(Arrays.asList(secretNames));
10498
return this;
10599
}
106100

107101
@Override
108102
public DomainConfigurator withPodLabel(String name, String value) {
109-
((BaseConfiguration) getDomainSpec()).addPodLabel(name, value);
103+
getDomainSpec().addPodLabel(name, value);
110104
return this;
111105
}
112106

113107
@Override
114108
public DomainConfigurator withPodAnnotation(String name, String value) {
115-
((BaseConfiguration) getDomainSpec()).addPodAnnotation(name, value);
109+
getDomainSpec().addPodAnnotation(name, value);
116110
return this;
117111
}
118112

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1-
// Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

55
package oracle.kubernetes.operator.helpers;
66

77
import io.kubernetes.client.models.V1ObjectMeta;
8+
import io.kubernetes.client.models.V1Pod;
9+
import io.kubernetes.client.util.Yaml;
10+
import java.util.function.Function;
11+
import org.apache.commons.codec.digest.DigestUtils;
812

913
/** Annotates pods, services with details about the Domain instance and checks these annotations. */
1014
public class AnnotationHelper {
15+
private static final boolean DEBUG = false;
16+
static final String SHA256_ANNOTATION = "weblogic.sha256";
17+
private static final String HASHED_STRING = "hashedString";
18+
private static Function<V1Pod, String> HASH_FUNCTION =
19+
pod -> DigestUtils.sha256Hex(Yaml.dump(pod));
20+
1121
/**
1222
* Marks metadata with annotations that let Prometheus know how to retrieve metrics from the
1323
* wls-exporter web-app. The specified httpPort should be the listen port of the WebLogic server
@@ -16,10 +26,34 @@ public class AnnotationHelper {
1626
* @param meta Metadata
1727
* @param httpPort HTTP listen port
1828
*/
19-
public static void annotateForPrometheus(V1ObjectMeta meta, int httpPort) {
29+
static void annotateForPrometheus(V1ObjectMeta meta, int httpPort) {
2030
meta.putAnnotationsItem(
2131
"prometheus.io/port", "" + httpPort); // should be the ListenPort of the server in the pod
2232
meta.putAnnotationsItem("prometheus.io/path", "/wls-exporter/metrics");
2333
meta.putAnnotationsItem("prometheus.io/scrape", "true");
2434
}
35+
36+
static V1Pod withSha256Hash(V1Pod pod) {
37+
return DEBUG ? addHashAndDebug(pod) : addHash(pod);
38+
}
39+
40+
private static V1Pod addHashAndDebug(V1Pod pod) {
41+
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) {
48+
pod.getMetadata().putAnnotationsItem(SHA256_ANNOTATION, HASH_FUNCTION.apply(pod));
49+
return pod;
50+
}
51+
52+
static String getHash(V1Pod pod) {
53+
return pod.getMetadata().getAnnotations().get(SHA256_ANNOTATION);
54+
}
55+
56+
static String getDebugString(V1Pod pod) {
57+
return pod.getMetadata().getAnnotations().get(HASHED_STRING);
58+
}
2559
}

0 commit comments

Comments
 (0)