Skip to content

Commit 54c9b9e

Browse files
committed
make istio object in Domain yaml work
1 parent a460b59 commit 54c9b9e

File tree

10 files changed

+68
-25
lines changed

10 files changed

+68
-25
lines changed

kubernetes/samples/scripts/common/domain-template.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ spec:
4747
value: "%JAVA_OPTIONS%"
4848
- name: USER_MEM_ARGS
4949
value: "-XX:+UseContainerSupport -Djava.security.egd=file:/dev/./urandom "
50-
- name: ISTIO_ENABLED
51-
value: "%ISTIO_ENABLED%"
5250
%LOG_HOME_ON_PV_PREFIX%volumes:
5351
%LOG_HOME_ON_PV_PREFIX%- name: weblogic-domain-storage-volume
5452
%LOG_HOME_ON_PV_PREFIX% persistentVolumeClaim:
@@ -78,4 +76,7 @@ spec:
7876
# The number of managed servers to start for unlisted clusters
7977
# replicas: 1
8078
#
81-
istioEnabled: %ISTIO_ENABLED%
79+
experimental:
80+
istio:
81+
enabled: %ISTIO_ENABLED%
82+
readinessPort: %ISTIO_READINESS_PORT%

kubernetes/samples/scripts/common/utility.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ function createFiles {
369369
sed -i -e "s|%CUSTOM_CONNECTION_STRING%|${rcuDatabaseURL}|g" ${createJobOutput}
370370
sed -i -e "s:%EXPOSE_T3_CHANNEL_PREFIX%:${exposeAdminT3Channel}:g" ${createJobOutput}
371371
sed -i -e "s|%ISTIO_ENABLED%|${istioEnabled}|g" ${createJobOutput}
372+
sed -i -e "s|%ISTIO_READINESS_PORT%|${istioReadinessPort}|g" ${createJobOutput}
372373

373374
# Generate the yaml to create the kubernetes job that will delete the weblogic domain_home folder
374375
echo Generating ${deleteJobOutput}
@@ -425,6 +426,7 @@ function createFiles {
425426
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${dcrOutput}
426427
sed -i -e "s:%INITIAL_MANAGED_SERVER_REPLICAS%:${initialManagedServerReplicas}:g" ${dcrOutput}
427428
sed -i -e "s:%ISTIO_ENABLED%:${istioEnabled}:g" ${dcrOutput}
429+
sed -i -e "s:%ISTIO_READINESS_PORT%:${istioReadinessPort}:g" ${dcrOutput}
428430

429431
if [ "${domainHomeInImage}" == "true" ]; then
430432

kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-inputs.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,7 @@ createDomainScriptName: create-domain-job.sh
136136
createDomainFilesDir: wlst
137137

138138
# istioEnabled specifies whether or not it is deployed under Istio.
139-
istioEnabled: false
139+
istioEnabled: true
140+
141+
# istioReadinessPort specifies the WebLogic port for readiness probe which is used under Istio.
142+
istioReadinessPort: 8777

kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-job-template.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ spec:
7373
value: "%DOMAIN_ROOT_DIR%/logs/%DOMAIN_UID%"
7474
- name: ISTIO_ENABLED
7575
value: "%ISTIO_ENABLED%"
76+
- name: ISTIO_READINESS_PORT
77+
value: "%ISTIO_READINESS_PORT%"
7678
volumes:
7779
- name: create-weblogic-sample-domain-job-cm-volume
7880
configMap:

kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/wlst/create-domain-script.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ export DOMAIN_HOME=${DOMAIN_HOME_DIR}
1010
# Create the domain
1111
wlst.sh -skipWLSModuleScanning ${CREATE_DOMAIN_SCRIPT_DIR}/create-domain.py
1212

13-
echo "###### ISTIO_ENABLED=${ISTIO_ENABLED}"
14-
1513
if [ "${ISTIO_ENABLED}" == "true" ]; then
1614
wlst.sh -skipWLSModuleScanning ${CREATE_DOMAIN_SCRIPT_DIR}/istio-fix-domain.py
1715
fi

kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/wlst/istio-fix-domain.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def getEnvVar(var):
2424
managed_server_name_base_svc = getEnvVar("MANAGED_SERVER_NAME_BASE_SVC")
2525
domain_logs = getEnvVar("DOMAIN_LOGS_DIR")
2626
script_dir = getEnvVar("CREATE_DOMAIN_SCRIPT_DIR")
27+
istio_readiness_port = int(getEnvVar("ISTIO_READINESS_PORT"))
2728

2829
# Update Domain for Istio
2930
readDomain(domain_path)
@@ -34,7 +35,7 @@ def getEnvVar(var):
3435
set('Protocol', 'http')
3536
set('ListenAddress', '127.0.0.1')
3637
set('PublicAddress', domain_uid + '-' + admin_server_name)
37-
set('ListenPort', 8888)
38+
set('ListenPort', istio_readiness_port)
3839
set('HttpEnabledForThisProtocol', true)
3940
set('TunnelingEnabled', false)
4041
set('OutboundEnabled', false)
@@ -79,7 +80,7 @@ def getEnvVar(var):
7980
set('Protocol', 'http')
8081
set('ListenAddress', '127.0.0.1')
8182
set('PublicAddress', domain_uid + '-' + managed_server_name_base + '${id}')
82-
set('ListenPort', 8888)
83+
set('ListenPort', istio_readiness_port)
8384
set('HttpEnabledForThisProtocol', true)
8485
set('TunnelingEnabled', false)
8586
set('OutboundEnabled', false)

model/src/main/java/oracle/kubernetes/weblogic/domain/model/Domain.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ public boolean istioEnabled() {
369369
return spec.istioEnabled();
370370
}
371371

372+
public int getIstioReadinessPort() {
373+
return spec.getIstioReadinessPort();
374+
}
375+
372376
/**
373377
* Returns the domain home.
374378
*

model/src/main/java/oracle/kubernetes/weblogic/domain/model/DomainSpec.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,15 @@ public void setConfigOverrideSecrets(@Nullable List<String> overridesSecretNames
508508
boolean istioEnabled() {
509509
return Optional.ofNullable(experimental)
510510
.map(e -> e.getIstio())
511-
.map(i -> i.getIstioEnabled()).orElse(false);
511+
.map(i -> i.getEnabled())
512+
.orElse(false);
513+
}
514+
515+
int getIstioReadinessPort() {
516+
return Optional.ofNullable(experimental)
517+
.map(e -> e.getIstio())
518+
.map(i -> i.getReadinessPort())
519+
.orElse(8888);
512520
}
513521

514522
@Override

model/src/main/java/oracle/kubernetes/weblogic/domain/model/Istio.java

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,47 @@
1111

1212
public class Istio {
1313

14-
@Description("True, if this domain is deployed under an Istio service mesh. Defaults to true. Not required.")
15-
private Boolean istioEnabled = true;
14+
@Description(
15+
"True, if this domain is deployed under an Istio service mesh. Defaults to true. Not required.")
16+
private Boolean enabled = true;
17+
18+
@Description("The WebLogic readiness port for Istio. Defaults to 8888. Not required.")
19+
private Integer readinessPort = 8666;
1620

1721
/**
1822
* True, if this domain is deployed under an Istio service mesh.
1923
*
2024
* @return True, if this domain is deployed under an Istio service mesh.
2125
*/
22-
public Boolean getIstioEnabled() {
23-
return this.istioEnabled;
26+
public Boolean getEnabled() {
27+
return this.enabled;
2428
}
2529

2630
/**
2731
* Sets the Istio enabled status.
2832
*
29-
* @param istioEnabled True, if this domain is deployed under an Istio service mesh.
33+
* @param enabled True, if this domain is deployed under an Istio service mesh.
34+
*/
35+
public void setEnabled(Boolean enabled) {
36+
this.enabled = enabled;
37+
}
38+
39+
/**
40+
* Get the readyness port.
41+
*
42+
* @return the readiness port.
3043
*/
31-
public void setIstioEnabled(Boolean istioEnabled) {
32-
this.istioEnabled = istioEnabled;
44+
public Integer getReadinessPort() {
45+
return this.readinessPort;
46+
}
47+
48+
/**
49+
* Sets the Istio readiness port.
50+
*
51+
* @param readinessPort the Istio readiness port.
52+
*/
53+
public void setReadinessPort(Integer readinessPort) {
54+
this.readinessPort = readinessPort;
3355
}
3456

3557
/**
@@ -39,25 +61,23 @@ public void setIstioEnabled(Boolean istioEnabled) {
3961
* @return this
4062
*/
4163
public Istio withIstioEnabled(Boolean istioEnabled) {
42-
this.istioEnabled = istioEnabled;
64+
this.enabled = istioEnabled;
4365
return this;
4466
}
4567

46-
4768
@Override
4869
public String toString() {
4970
ToStringBuilder builder =
5071
new ToStringBuilder(this)
51-
.append("istioEnabled", istioEnabled);
72+
.append("enabled", enabled)
73+
.append("readinessPort", readinessPort);
5274

5375
return builder.toString();
5476
}
5577

5678
@Override
5779
public int hashCode() {
58-
HashCodeBuilder builder =
59-
new HashCodeBuilder()
60-
.append(istioEnabled);
80+
HashCodeBuilder builder = new HashCodeBuilder().append(enabled).append(readinessPort);
6181

6282
return builder.toHashCode();
6383
}
@@ -74,7 +94,9 @@ public boolean equals(Object other) {
7494
Istio rhs = ((Istio) other);
7595
EqualsBuilder builder =
7696
new EqualsBuilder()
77-
.append(istioEnabled, rhs.istioEnabled);
97+
.append(enabled, rhs.enabled)
98+
.append("readinessPort", rhs.readinessPort);
99+
;
78100

79101
return builder.isEquals();
80102
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,11 @@ private V1Probe createReadinessProbe(TuningParameters.PodTuning tuning) {
626626
.periodSeconds(getReadinessProbePeriodSeconds(tuning))
627627
.failureThreshold(FAILURE_THRESHOLD);
628628
try {
629-
boolean istioEnabled = Boolean.valueOf(System.getenv("ISTIO_ENABLED"));
629+
boolean istioEnabled = getDomain().istioEnabled();
630630
if (istioEnabled) {
631-
readinessProbe = readinessProbe.httpGet(httpGetAction(READINESS_PATH, 8888, false));
631+
int istioReadinessPort = getDomain().getIstioReadinessPort();
632+
readinessProbe =
633+
readinessProbe.httpGet(httpGetAction(READINESS_PATH, istioReadinessPort, false));
632634
} else {
633635
readinessProbe =
634636
readinessProbe.httpGet(

0 commit comments

Comments
 (0)