Skip to content

Commit c6db7ac

Browse files
committed
Correct create-weblogic-operator-inputs property names
1 parent bcb71af commit c6db7ac

8 files changed

+72
-78
lines changed

kubernetes/create-weblogic-operator-inputs.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ namespace: weblogic-operator
1717
targetNamespaces: default
1818

1919
# The docker image containing the operator code.
20-
image: container-registry.oracle.com/middleware/weblogic-kubernetes-operator:latest
20+
weblogicOperatorImage: container-registry.oracle.com/middleware/weblogic-kubernetes-operator:latest
2121

2222
# The image pull policy for the operator docker image.
23-
imagePullPolicy: IfNotPresent
23+
weblogicOperatorImagePullPolicy: IfNotPresent
2424

2525
# Name of the Kubernetes secret to access the registry containing the operator Docker image
2626
# The presence of the secret will be validated when this parameter is enabled.
27-
#imagePullSecretName:
27+
#weblogicOperatorImagePullSecretName:
2828

2929
# Options for externally exposing the operator REST https interface
3030
# (i.e. outside of the Kubernetes cluster). Valid values are:

kubernetes/internal/create-weblogic-operator.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function initialize {
117117
# Parse the common inputs file
118118
parseCommonInputs
119119

120-
validateInputParamsSpecified serviceAccount namespace targetNamespaces image
120+
validateInputParamsSpecified serviceAccount namespace targetNamespaces weblogicOperatorImage
121121

122122
validateBooleanInputParamsSpecified elkIntegrationEnabled
123123

@@ -161,13 +161,13 @@ function initAndValidateOutputDir {
161161
# Function to validate the image pull secret name
162162
#
163163
function validateImagePullSecretName {
164-
if [ ! -z "${imagePullSecretName}" ]; then
165-
validateLowerCase imagePullSecretName ${imagePullSecretName}
164+
if [ ! -z "${weblogicOperatorImagePullSecretName}" ]; then
165+
validateLowerCase weblogicOperatorImagePullSecretName ${weblogicOperatorImagePullSecretName}
166166
imagePullSecretPrefix=""
167167
validateImagePullSecret
168168
else
169169
# Set name blank when not specified, and comment out the yaml
170-
imagePullSecretName=""
170+
weblogicOperatorImagePullSecretName=""
171171
imagePullSecretPrefix="#"
172172
fi
173173
}
@@ -178,7 +178,7 @@ function validateImagePullSecretName {
178178
function validateImagePullSecret {
179179
# The kubernetes secret for pulling images from the docker store is optional.
180180
# If it was specified, make sure it exists.
181-
validateSecretExists ${imagePullSecretName} ${namespace}
181+
validateSecretExists ${weblogicOperatorImagePullSecretName} ${namespace}
182182
failIfValidationErrors
183183
}
184184

@@ -188,17 +188,17 @@ function validateImagePullSecret {
188188
function validateImagePullPolicy {
189189

190190
# Validate that imagePullPolicy was specified
191-
validateInputParamsSpecified imagePullPolicy
191+
validateInputParamsSpecified weblogicOperatorImagePullPolicy
192192

193193
# And validate that it's one of the allowed logging levels
194-
if [ ! -z "${imagePullPolicy}" ]; then
194+
if [ ! -z "${weblogicOperatorImagePullPolicy}" ]; then
195195
IF_NOT_PRESENT="IfNotPresent"
196196
ALWAYS="Always"
197197
NEVER="Never"
198-
if [ $imagePullPolicy != $IF_NOT_PRESENT ] && \
199-
[ $imagePullPolicy != $ALWAYS ] && \
200-
[ $imagePullPolicy != $NEVER ]; then
201-
validationError "Invalid imagePullPolicy: \"${imagePullPolicy}\". Valid values are $IF_NOT_PRESENT, $ALWAYS and $NEVER."
198+
if [ $weblogicOperatorImagePullPolicy != $IF_NOT_PRESENT ] && \
199+
[ $weblogicOperatorImagePullPolicy != $ALWAYS ] && \
200+
[ $weblogicOperatorImagePullPolicy != $NEVER ]; then
201+
validationError "Invalid weblogicOperatorImagePullPolicy: \"${weblogicOperatorImagePullPolicy}\". Valid values are $IF_NOT_PRESENT, $ALWAYS and $NEVER."
202202
fi
203203
fi
204204
}
@@ -389,9 +389,9 @@ function createYamlFiles {
389389
sed -i -e "s|%NAMESPACE%|$namespace|g" ${oprOutput}
390390
sed -i -e "s|%TARGET_NAMESPACES%|$targetNamespaces|g" ${oprOutput}
391391
sed -i -e "s|%ACCOUNT_NAME%|$serviceAccount|g" ${oprOutput}
392-
sed -i -e "s|%IMAGE%|$image|g" ${oprOutput}
393-
sed -i -e "s|%IMAGE_PULL_POLICY%|$imagePullPolicy|g" ${oprOutput}
394-
sed -i -e "s|%DOCKER_REGISTRY_SECRET%|${imagePullSecretName}|g" ${oprOutput}
392+
sed -i -e "s|%IMAGE%|$weblogicOperatorImage|g" ${oprOutput}
393+
sed -i -e "s|%IMAGE_PULL_POLICY%|$weblogicOperatorImagePullPolicy|g" ${oprOutput}
394+
sed -i -e "s|%DOCKER_REGISTRY_SECRET%|${weblogicOperatorImagePullSecretName}|g" ${oprOutput}
395395
sed -i -e "s|%IMAGE_PULL_SECRET_PREFIX%|${imagePullSecretPrefix}|g" ${oprOutput}
396396
sed -i -e "s|%EXTERNAL_OPERATOR_SERVICE_PREFIX%|$externalOperatorServicePrefix|g" ${oprOutput}
397397
sed -i -e "s|%EXTERNAL_REST_HTTPS_PORT%|$externalRestHttpsPort|g" ${oprOutput}

src/integration-tests/bash/run.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,10 @@ function deploy_operator {
557557
cp $PROJECT_ROOT/kubernetes/create-weblogic-operator-inputs.yaml $inputs
558558

559559
trace 'customize the inputs yaml file to use our pre-built docker image'
560-
sed -i -e "s|\(imagePullPolicy:\).*|\1${IMAGE_PULL_POLICY_OPERATOR}|g" $inputs
561-
sed -i -e "s|\(image:\).*|\1${IMAGE_NAME_OPERATOR}:${IMAGE_TAG_OPERATOR}|g" $inputs
560+
sed -i -e "s|\(weblogicOperatorImagePullPolicy:\).*|\1${IMAGE_PULL_POLICY_OPERATOR}|g" $inputs
561+
sed -i -e "s|\(weblogicOperatorImage:\).*|\1${IMAGE_NAME_OPERATOR}:${IMAGE_TAG_OPERATOR}|g" $inputs
562562
if [ -n "${IMAGE_PULL_SECRET_OPERATOR}" ]; then
563-
sed -i -e "s|#imagePullSecretName:.*|imagePullSecretName: ${IMAGE_PULL_SECRET_OPERATOR}|g" $inputs
563+
sed -i -e "s|#weblogicOperatorImagePullSecretName:.*|weblogicOperatorImagePullSecretName: ${IMAGE_PULL_SECRET_OPERATOR}|g" $inputs
564564
fi
565565
trace 'customize the inputs yaml file to generate a self-signed cert for the external Operator REST https port'
566566
sed -i -e "s|\(externalRestOption:\).*|\1self-signed-cert|g" $inputs

src/test/java/oracle/kubernetes/operator/create/CreateOperatorGeneratedFilesBaseTest.java

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
// Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
22
package oracle.kubernetes.operator.create;
33

4-
import static java.util.Arrays.asList;
4+
import io.kubernetes.client.models.*;
5+
import org.apache.commons.codec.binary.Base64;
6+
import org.junit.AfterClass;
7+
import org.junit.Test;
58

6-
import io.kubernetes.client.models.ExtensionsV1beta1Deployment;
7-
import io.kubernetes.client.models.V1beta1ClusterRole;
8-
import io.kubernetes.client.models.V1beta1ClusterRoleBinding;
9-
import io.kubernetes.client.models.V1beta1RoleBinding;
10-
import io.kubernetes.client.models.V1ConfigMap;
11-
import io.kubernetes.client.models.V1Namespace;
12-
import io.kubernetes.client.models.V1Secret;
13-
import io.kubernetes.client.models.V1Service;
14-
import io.kubernetes.client.models.V1ServiceAccount;
15-
import io.kubernetes.client.models.V1ServiceSpec;
9+
import static java.util.Arrays.asList;
1610
import static oracle.kubernetes.operator.create.CreateOperatorInputs.readInputsYamlFile;
1711
import static oracle.kubernetes.operator.create.KubernetesArtifactUtils.*;
1812
import static oracle.kubernetes.operator.create.YamlUtils.yamlEqualTo;
19-
import org.apache.commons.codec.binary.Base64;
2013
import static org.hamcrest.MatcherAssert.assertThat;
21-
import static org.hamcrest.Matchers.*;
22-
import org.junit.AfterClass;
23-
import org.junit.Test;
14+
import static org.hamcrest.Matchers.is;
15+
import static org.hamcrest.Matchers.nullValue;
2416

2517
/**
2618
* Base class for testing that the all artifacts in the yaml files that
@@ -155,8 +147,8 @@ protected ExtensionsV1beta1Deployment getExpectedWeblogicOperatorDeployment() {
155147
.serviceAccountName(getInputs().getServiceAccount())
156148
.addContainersItem(newContainer()
157149
.name("weblogic-operator")
158-
.image(getInputs().getImage())
159-
.imagePullPolicy(getInputs().getImagePullPolicy())
150+
.image(getInputs().getWeblogicOperatorImage())
151+
.imagePullPolicy(getInputs().getWeblogicOperatorImagePullPolicy())
160152
.addCommandItem("bash")
161153
.addArgsItem("/operator/operator.sh")
162154
.addEnvItem(newEnvVar()

src/test/java/oracle/kubernetes/operator/create/CreateOperatorGeneratedFilesOptionalFeaturesEnabledTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static void setup() throws Exception {
2424
.setupExternalRestSelfSignedCert()
2525
.enableDebugging()
2626
.elkIntegrationEnabled("true")
27-
.imagePullSecretName("test-operator-image-pull-secret-name")
27+
.weblogicOperatorImagePullSecretName("test-operator-image-pull-secret-name")
2828
);
2929
}
3030

@@ -75,7 +75,7 @@ public ExtensionsV1beta1Deployment getExpectedWeblogicOperatorDeployment() {
7575
.emptyDir(newEmptyDirVolumeSource()
7676
.medium("Memory")))
7777
.addImagePullSecretsItem(newLocalObjectReference()
78-
.name(getInputs().getImagePullSecretName()));
78+
.name(getInputs().getWeblogicOperatorImagePullSecretName()));
7979
return expected;
8080
}
8181
}

src/test/java/oracle/kubernetes/operator/create/CreateOperatorInputs.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
// Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
22
package oracle.kubernetes.operator.create;
33

4-
import java.io.*;
4+
import org.apache.commons.codec.binary.Base64;
5+
6+
import java.io.Reader;
57
import java.nio.charset.Charset;
6-
import java.nio.file.Files;
78
import java.nio.file.FileSystems;
9+
import java.nio.file.Files;
810
import java.nio.file.Path;
911
import java.util.Objects;
1012

1113
import static oracle.kubernetes.operator.create.YamlUtils.newYaml;
12-
import org.apache.commons.codec.binary.Base64;
1314

1415
/**
1516
* Class that mirrors create-weblogic-operator-inputs.yaml
@@ -50,8 +51,8 @@ public static CreateOperatorInputs newInputs() throws Exception {
5051
.namespace("test-operator-namespace")
5152
.serviceAccount("test-operator-service-account")
5253
.targetNamespaces("test-target-namespace1,test-target-namespace2")
53-
.image("test-operator-image")
54-
.imagePullPolicy("Never")
54+
.weblogicOperatorImage("test-operator-image")
55+
.weblogicOperatorImagePullPolicy("Never")
5556
.javaLoggingLevel("FINEST");
5657
}
5758

@@ -160,20 +161,20 @@ private String internalSans() {
160161
public void setTargetNamespaces(String val) { targetNamespaces = convertNullToEmptyString(val); }
161162
public CreateOperatorInputs targetNamespaces(String val) { setTargetNamespaces(val); return this; }
162163

163-
private String image = "";
164-
public String getImage() { return image; }
165-
public void setImage(String val) { image = convertNullToEmptyString(val); }
166-
public CreateOperatorInputs image(String val) { setImage(val); return this; }
164+
private String weblogicOperatorImage = "";
165+
public String getWeblogicOperatorImage() { return weblogicOperatorImage; }
166+
public void setWeblogicOperatorImage(String val) { weblogicOperatorImage = convertNullToEmptyString(val); }
167+
public CreateOperatorInputs weblogicOperatorImage(String val) { setWeblogicOperatorImage(val); return this; }
167168

168-
private String imagePullPolicy = "";
169-
public String getImagePullPolicy() { return imagePullPolicy; }
170-
public void setImagePullPolicy(String val) { imagePullPolicy = convertNullToEmptyString(val); }
171-
public CreateOperatorInputs imagePullPolicy(String val) { setImagePullPolicy(val); return this; }
169+
private String weblogicOperatorImagePullPolicy = "";
170+
public String getWeblogicOperatorImagePullPolicy() { return weblogicOperatorImagePullPolicy; }
171+
public void setWeblogicOperatorImagePullPolicy(String val) { weblogicOperatorImagePullPolicy = convertNullToEmptyString(val); }
172+
public CreateOperatorInputs weblogicOperatorImagePullPolicy(String val) { setWeblogicOperatorImagePullPolicy(val); return this; }
172173

173-
private String imagePullSecretName = "";
174-
public String getImagePullSecretName() { return imagePullSecretName; }
175-
public void setImagePullSecretName(String val) { imagePullSecretName = convertNullToEmptyString(val); }
176-
public CreateOperatorInputs imagePullSecretName(String val) { setImagePullSecretName(val); return this; }
174+
private String weblogicOperatorImagePullSecretName = "";
175+
public String getWeblogicOperatorImagePullSecretName() { return weblogicOperatorImagePullSecretName; }
176+
public void setWeblogicOperatorImagePullSecretName(String val) { weblogicOperatorImagePullSecretName = convertNullToEmptyString(val); }
177+
public CreateOperatorInputs weblogicOperatorImagePullSecretName(String val) { setWeblogicOperatorImagePullSecretName(val); return this; }
177178

178179
private String externalRestOption = "";
179180
public String getExternalRestOption() { return externalRestOption; }

src/test/java/oracle/kubernetes/operator/create/CreateOperatorInputsFileTest.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
// Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
22
package oracle.kubernetes.operator.create;
33

4-
import java.nio.file.Path;
5-
import java.nio.file.Files;
6-
import java.util.List;
7-
84
import org.junit.After;
95
import org.junit.Before;
106
import org.junit.Test;
7+
8+
import java.nio.file.Files;
9+
import java.nio.file.Path;
10+
import java.util.List;
11+
1112
import static oracle.kubernetes.operator.create.CreateOperatorInputs.*;
12-
import static oracle.kubernetes.operator.create.ExecCreateOperator.*;
13-
import static oracle.kubernetes.operator.create.ExecResultMatcher.*;
14-
import static oracle.kubernetes.operator.create.YamlUtils.*;
13+
import static oracle.kubernetes.operator.create.ExecCreateOperator.execCreateOperator;
14+
import static oracle.kubernetes.operator.create.ExecResultMatcher.succeedsAndPrints;
15+
import static oracle.kubernetes.operator.create.YamlUtils.yamlEqualTo;
1516
import static org.hamcrest.MatcherAssert.assertThat;
16-
import static org.hamcrest.Matchers.*;
17+
import static org.hamcrest.Matchers.containsInAnyOrder;
18+
import static org.hamcrest.Matchers.is;
1719

1820
/**
1921
* Tests that:
@@ -50,9 +52,9 @@ public void defaultInputsFile_hasCorrectContents() throws Exception {
5052
.externalRestHttpsPort("31001")
5153
.externalSans("")
5254
.remoteDebugNodePortEnabled("false")
53-
.image("container-registry.oracle.com/middleware/weblogic-kubernetes-operator:latest")
54-
.imagePullPolicy("IfNotPresent")
55-
.imagePullSecretName("")
55+
.weblogicOperatorImage("container-registry.oracle.com/middleware/weblogic-kubernetes-operator:latest")
56+
.weblogicOperatorImagePullPolicy("IfNotPresent")
57+
.weblogicOperatorImagePullSecretName("")
5658
.internalDebugHttpPort("30999")
5759
.javaLoggingLevel(JAVA_LOGGING_LEVEL_INFO)
5860
.namespace("weblogic-operator")

src/test/java/oracle/kubernetes/operator/create/CreateOperatorInputsValidationTest.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import static oracle.kubernetes.operator.create.ExecResultMatcher.errorRegexp;
99
import static oracle.kubernetes.operator.create.ExecResultMatcher.failsAndPrints;
1010
import static org.hamcrest.MatcherAssert.assertThat;
11-
import static org.hamcrest.Matchers.*;
1211

1312
import static oracle.kubernetes.operator.create.CreateOperatorInputs.*;
1413

@@ -35,9 +34,9 @@ public void tearDown() throws Exception {
3534
private static final String PARAM_SERVICE_ACCOUNT = "serviceAccount";
3635
private static final String PARAM_NAMESPACE = "namespace";
3736
private static final String PARAM_TARGET_NAMESPACES = "targetNamespaces";
38-
private static final String PARAM_IMAGE = "image";
39-
private static final String PARAM_IMAGE_PULL_POLICY = "imagePullPolicy";
40-
private static final String PARAM_IMAGE_PULL_SECRET_NAME = "imagePullSecretName";
37+
private static final String PARAM_WEBLOGIC_OPERATOR_IMAGE = "weblogicOperatorImage";
38+
private static final String PARAM_IMAGE_PULL_POLICY = "weblogicOperatorImagePullPolicy";
39+
private static final String PARAM_IMAGE_PULL_SECRET_NAME = "weblogicOperatorImagePullSecretName";
4140
private static final String PARAM_EXTERNAL_REST_OPTION = "externalRestOption";
4241
private static final String PARAM_EXTERNAL_REST_HTTPS_PORT = "externalRestHttpsPort";
4342
private static final String PARAM_EXTERNAL_SANS = "externalSans";
@@ -95,24 +94,24 @@ public void createOperator_with_upperCaseTargetNamespaces_failsAndReturnsError()
9594
}
9695

9796
@Test
98-
public void createOperator_with_missingImage_failsAndReturnsError() throws Exception {
97+
public void createOperator_with_missingWeblogicOperatorImage_failsAndReturnsError() throws Exception {
9998
assertThat(
100-
execCreateOperator(newInputs().image("")),
101-
failsAndPrints(paramMissingError(PARAM_IMAGE)));
99+
execCreateOperator(newInputs().weblogicOperatorImage("")),
100+
failsAndPrints(paramMissingError(PARAM_WEBLOGIC_OPERATOR_IMAGE)));
102101
}
103102

104103
@Test
105104
public void createOperator_with_missingImagePullPolicy_failsAndReturnsError() throws Exception {
106105
assertThat(
107-
execCreateOperator(newInputs().imagePullPolicy("")),
106+
execCreateOperator(newInputs().weblogicOperatorImagePullPolicy("")),
108107
failsAndPrints(paramMissingError(PARAM_IMAGE_PULL_POLICY)));
109108
}
110109

111110
@Test
112111
public void createOperator_with_invalidImagePullPolicy_failsAndReturnsError() throws Exception {
113112
String val = "invalid-image-pull-policy";
114113
assertThat(
115-
execCreateOperator(newInputs().imagePullPolicy(val)),
114+
execCreateOperator(newInputs().weblogicOperatorImagePullPolicy(val)),
116115
failsAndPrints(invalidEnumParamValueError(PARAM_IMAGE_PULL_POLICY, val)));
117116
}
118117

@@ -135,7 +134,7 @@ public void createOperator_with_ImagePullPolicyNever_succeeds() throws Exception
135134
public void createOperator_with_upperCaseImagePullSecretName_failsAndReturnsError() throws Exception {
136135
String val = "TestImagePullSecretName";
137136
assertThat(
138-
execCreateOperator(newInputs().imagePullSecretName(val)),
137+
execCreateOperator(newInputs().weblogicOperatorImagePullSecretName(val)),
139138
failsAndPrints(paramNotLowercaseError(PARAM_IMAGE_PULL_SECRET_NAME, val)));
140139
}
141140

@@ -336,7 +335,7 @@ private void createOperator_with_validJavaLoggingLevel_succeeds(String level) th
336335
}
337336

338337
private void createOperator_with_validImagePullPolicy_succeeds(String policy) throws Exception {
339-
createOperator_with_validInputs_succeeds(newInputs().imagePullPolicy(policy));
338+
createOperator_with_validInputs_succeeds(newInputs().weblogicOperatorImagePullPolicy(policy));
340339
}
341340

342341
private void createOperator_with_validInputs_succeeds(CreateOperatorInputs inputs) throws Exception {

0 commit comments

Comments
 (0)