Skip to content

Commit f51ab78

Browse files
committed
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernetes-operator into server-discovery-tests
fix a typo
2 parents 2ebca5b + 8e677e1 commit f51ab78

File tree

19 files changed

+413
-694
lines changed

19 files changed

+413
-694
lines changed

docs-source/content/developerguide/branching.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The `develop` branch is protected and contains source for the latest completed f
1111

1212
Because we want to balance separating destabilizing work into feature branches against the possibility of later difficult merges, we encourage developers working on features to pull out any necessary refactoring or improvements that are general purpose into their own shorter-lived branches and create pull requests to `develop` when these smaller work items are completed.
1313

14-
All commits to `develop` must pass the [integration test suite]({{< relref "/developerguide/integration-tests.md" >}}). Please run these tests locally before submitting a pull request. Additionally, each push to a branch in our GitHub repository triggers a run of a subset of the integration tests with the results visible [here](https://app.wercker.com/Oracle/weblogic-kubernetes-operator/runs).
14+
All commits to `develop` must pass the [integration test suite]({{< relref "/developerguide/integration-tests.md" >}}). Please run these tests locally before submitting a pull request. Additionally, each push to a branch in our GitHub repository triggers a run of a subset of the integration tests with the results visible [here](http://build.weblogick8s.org:8080/job/weblogic-kubernetes-operator-quicktest/).
1515

1616
Please submit pull requests to the `develop` branch unless you are collaborating on a feature and have another target branch. Please see details on the Oracle Contributor Agreement (OCA) and guidelines for pull requests on the [README]({{< relref "/_index.md#contributing-to-the-oracle-weblogic-server-kubernetes-operator-repository" >}}).
1717

docs-source/themes/hugo-theme-learn/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ This repository contains a theme for [Hugo](https://gohugo.io/), based on great
44

55
Visit the [theme documentation](https://learn.netlify.com/en/) to see what is going on. It is actually built with this theme.
66

7-
[![wercker status](https://app.wercker.com/status/233466a2be73fcea400e7dc02ef6adf9/s/master "wercker status")](https://app.wercker.com/project/byKey/233466a2be73fcea400e7dc02ef6adf9)
7+
8+
[![Build Status](http://build.weblogick8s.org:8080/buildStatus/icon?job=weblogic-kubernetes-operator-quicktest)](http://build.weblogick8s.org:8080/job/weblogic-kubernetes-operator-quicktest/)
89
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmatcornic%2Fhugo-theme-learn.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmatcornic%2Fhugo-theme-learn?ref=badge_shield)
910

1011
## Main features

integration-tests/README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ This documentation describes the functional use cases that are covered in integr
44

55
# Environments
66

7-
The tests currently run in three modes: "Wercker", "Jenkins", and "standalone" Oracle Linux, where the mode is controlled by the `WERCKER` and `JENKINS` environment variables described below. The default is "standalone".
7+
The tests currently run in three modes: "shared cluster", "Jenkins", and "standalone" Oracle Linux, where the mode is controlled by the `SHARED_CLUSTER` and `JENKINS` environment variables described below. The default is "standalone".
88

99
* "Standalone" Oracle Linux, i.e, run the tests manually with the `mvn` command.
10-
* Wercker - https://app.wercker.com/Oracle/weblogic-kubernetes-operator/runs - `integration-test-java` is the pipeline name.
10+
* Shared cluster - http://build.weblogick8s.org:8080/job/weblogic-kubernetes-operator-quicktest/
1111
* Jenkins - http://wls-jenkins.us.oracle.com/view/weblogic-operator/job/weblogic-kubernetes-operator-javatest/ - Jenkins Run is restricted to Oracle Internal development process.
1212

13-
Wercker runs only Quick test use cases, Jenkins runs both Quick and Full test use cases.
13+
Shared cluster runs only Quick test use cases, Jenkins runs both Quick and Full test use cases.
1414

1515
# Use Cases
1616

@@ -129,7 +129,7 @@ Defaults for `RESULT_ROOT` & `PV_ROOT`:
129129
| --- | --- | --- | --- |
130130
| stand-alone | /scratch/$USER/wl_k8s_test_results | /scratch/$USER/wl_k8s_test_results | test defaults |
131131
| Jenkins | /scratch/k8s_dir | /scratch/k8s_dir | jenkins configuration |
132-
| Wercker | /pipeline/output/k8s_dir | /scratch | wercker.yml |
132+
| Shared cluster | /pipeline/output/k8s_dir | /scratch | |
133133

134134

135135
'Physical' subdirectories created by test:
@@ -246,7 +246,7 @@ When the integration test class ITOperator is executed, staticPrepare() method i
246246

247247
staticPrepare() - initializes the application properties from OperatorIT.properties and creates resultRoot, pvRoot, userprojectsDir directories by calling initialize() method from the base class BaseTest.
248248

249-
staticUnPrepare() - releases the cluster lease on wercker env.
249+
staticUnPrepare() - releases the cluster lease.
250250

251251
test methods - testDomainOnPVUsingWLST, testDomainOnPVUsingWDT, testTwoDomainsManagedByTwoOperators, testCreateDomainWithStartPolicyAdminOnly, testCreateDomainPVReclaimPolicyRecycle, testCreateDomainWithDefaultValuesInSampleInputs, testAutoAndCustomSitConfigOverrides, testOperatorRESTIdentityBackwardCompatibility, testOperatorRESTUsingCertificateChain
252252

@@ -299,14 +299,14 @@ The tests accepts optional env var overrides:
299299
| QUICKTEST | When set to "true", limits testing to a subset of the tests. |
300300
| LB_TYPE | The default value is "TRAEFIK". Set to "VOYAGER" if you want to use it as LB. |
301301
| INGRESSPERDOMAIN | The defult value is true. If you want to test creating TRAEFIK LB by kubectl yaml for multiple domains, set it to false. |
302-
| WERCKER | Set to true if invoking from Wercker, set to false or "" if running stand-alone or from Jenkins. Default is "". |
303-
| JENKINS | Set to true if invoking from Jenkins, set to false or "" if running stand-alone or from Wercker. Default is "". |
302+
| SHARED_CLUSTER | Set to true if invoking on shared cluster, set to false or "" if running stand-alone or from Jenkins. Default is "". |
303+
| JENKINS | Set to true if invoking from Jenkins, set to false or "" if running stand-alone or on shared cluster. Default is "". |
304304
| K8S_NODEPORT_HOST | DNS name of a Kubernetes worker node. Default is the local host's hostname. |
305305
| BRANCH_NAME | Git branch name. Default is determined by calling 'git branch'. |
306306
| LEASE_ID | Set to a unique value to (A) periodically renew a lease on the k8s cluster that indicates that no other test run should attempt to use the cluster, and (B) delete this lease when the test completes. |
307307

308308
The following additional overrides are currently only used when
309-
WERCKER=true:
309+
SHARED_CLUSTER=true:
310310

311311
| Variable | Description |
312312
| --- | --- |
@@ -393,8 +393,6 @@ $RESULT_ROOT/acceptance_test_tmp is archived under $RESULT_ROOT/acceptance_test_
393393

394394
$PV_ROOT/acceptance_test_pv is archived under $PV_ROOT/acceptance_test_pv_archive
395395

396-
On Wercker, these logs can be downloaded by clicking "Download artifact" on cleanup and store step.
397-
398396
# How to add a new test
399397

400398
Add a new JUnit test under integration-tests/src/test/java/oracle/kubernetes/operator.

integration-tests/src/test/java/oracle/kubernetes/operator/BaseTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static void initialize(String appPropsFile) throws Exception {
127127
}
128128

129129
// for manual/local run, do cleanup
130-
if (System.getenv("WERCKER") == null && System.getenv("JENKINS") == null) {
130+
if (System.getenv("SHARED_CLUSTER") == null && System.getenv("JENKINS") == null) {
131131

132132
// delete k8s artifacts created if any, delete PV directories
133133
ExecResult clnResult = cleanup();
@@ -176,7 +176,7 @@ public static void initialize(String appPropsFile) throws Exception {
176176
logger.info("Adding file handler, logging to file at " + resultDir + "/java_test_suite.out");
177177

178178
// for manual/local run, create file handler, create PVROOT
179-
if (System.getenv("WERCKER") == null && System.getenv("JENKINS") == null) {
179+
if (System.getenv("SHARED_CLUSTER") == null && System.getenv("JENKINS") == null) {
180180
logger.info("Creating PVROOT " + pvRoot);
181181
Files.createDirectories(Paths.get(pvRoot));
182182
ExecResult result = ExecCommand.exec("chmod 777 " + pvRoot);
@@ -518,7 +518,7 @@ public static ExecResult cleanup() throws Exception {
518518
protected void logTestBegin(String testName) throws Exception {
519519
logger.info("+++++++++++++++++++++++++++++++++---------------------------------+");
520520
logger.info("BEGIN " + testName);
521-
// renew lease at the beginning for every test method, leaseId is set only for Wercker
521+
// renew lease at the beginning for every test method, leaseId is set only for shared cluster
522522
TestUtils.renewK8sClusterLease(getProjectRoot(), getLeaseId());
523523
}
524524

@@ -636,7 +636,7 @@ private void callWebAppAndVerifyScaling(Domain domain, int replicas) throws Exce
636636
*
637637
* @param iTClassName - IT class name to be used in the archive file name
638638
* @throws Exception when errors while running statedump.sh or cleanup.sh scripts or while
639-
* renewing the lease for wercker run
639+
* renewing the lease for shared cluster run
640640
*/
641641
public static void tearDown(String iTClassName) throws Exception {
642642
logger.log(

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Operator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ private void initialize(
493493
}
494494

495495
// customize the inputs yaml file to use our pre-built docker image
496-
// IMAGE_NAME_OPERATOR & IMAGE_TAG_OPERATOR variables are used for wercker
496+
// IMAGE_NAME_OPERATOR & IMAGE_TAG_OPERATOR variables are used for shared cluster
497497
if (System.getenv("IMAGE_NAME_OPERATOR") != null
498498
&& System.getenv("IMAGE_TAG_OPERATOR") != null) {
499499
operatorMap.put(

integration-tests/src/test/resources/setupenv.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ function setup_jenkins {
3737
echo "Helm is configured."
3838
}
3939

40-
function setup_wercker {
41-
echo "Perform setup for running in wercker"
40+
function setup_shared_cluster {
41+
echo "Perform setup for running on shared cluster"
4242
echo "Install tiller"
4343
kubectl create serviceaccount --namespace kube-system tiller
4444
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
@@ -57,7 +57,7 @@ function setup_wercker {
5757
echo "After helm delete, list of installed helm charts is: "
5858
helm ls
5959

60-
echo "Completed setup_wercker"
60+
echo "Completed setup_shared_cluster"
6161
}
6262

6363
function pull_tag_images {
@@ -105,7 +105,7 @@ export PROJECT_ROOT="$SCRIPTPATH/../../../.."
105105
export RESULT_ROOT=${RESULT_ROOT:-/scratch/$USER/wl_k8s_test_results}
106106
export PV_ROOT=${PV_ROOT:-$RESULT_ROOT}
107107
echo "RESULT_ROOT$RESULT_ROOT PV_ROOT$PV_ROOT"
108-
export BRANCH_NAME="${BRANCH_NAME:-$WERCKER_GIT_BRANCH}"
108+
export BRANCH_NAME="${BRANCH_NAME:-$SHARED_CLUSTER_GIT_BRANCH}"
109109
export IMAGE_NAME_WEBLOGIC="${IMAGE_NAME_WEBLOGIC:-store/oracle/weblogic}"
110110
export IMAGE_TAG_WEBLOGIC="${IMAGE_TAG_WEBLOGIC:-12.2.1.3}"
111111

@@ -129,9 +129,9 @@ export JAR_VERSION="`grep -m1 "<version>" pom.xml | cut -f2 -d">" | cut -f1 -d "
129129

130130
echo IMAGE_NAME_OPERATOR $IMAGE_NAME_OPERATOR IMAGE_TAG_OPERATOR $IMAGE_TAG_OPERATOR JAR_VERSION $JAR_VERSION
131131

132-
if [ "$WERCKER" = "true" ]; then
132+
if [ "$SHARED_CLUSTER" = "true" ]; then
133133

134-
echo "Test Suite is running locally on Wercker and k8s is running on remote nodes."
134+
echo "Test Suite is running locally on a shared cluster and k8s is running on remote nodes."
135135

136136
export IMAGE_PULL_SECRET_OPERATOR=$IMAGE_PULL_SECRET_OPERATOR
137137
export IMAGE_PULL_SECRET_WEBLOGIC=$IMAGE_PULL_SECRET_WEBLOGIC
@@ -164,7 +164,7 @@ if [ "$WERCKER" = "true" ]; then
164164
exit 1
165165
fi
166166

167-
setup_wercker
167+
setup_shared_cluster
168168

169169
elif [ "$JENKINS" = "true" ]; then
170170

integration-tests/src/test/resources/statedump.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function state_dump {
9595
echo "Archiving pv directory using a kubernetes job. Look for it on k8s cluster in $PV_ROOT/acceptance_test_pv_archive"
9696
local outfile=${DUMP_DIR}/archive_pv_job.out
9797

98-
if [ "$WERCKER" = "true" ]; then
98+
if [ "$SHARED_CLUSTER" = "true" ]; then
9999
$SCRIPTPATH/job.sh "/scripts/archive.sh /scratch/acceptance_test_pv /scratch/acceptance_test_pv_archive" 2>&1 | tee ${outfile}
100100
if [ "$?" = "0" ]; then
101101
echo Job complete.

operator/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,24 @@
347347
<version>1.3</version>
348348
<scope>test</scope>
349349
</dependency>
350+
<dependency>
351+
<groupId>org.glassfish.jersey.test-framework</groupId>
352+
<artifactId>jersey-test-framework-core</artifactId>
353+
<version>${jersey-version}</version>
354+
<scope>test</scope>
355+
</dependency>
356+
<dependency>
357+
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
358+
<artifactId>jersey-test-framework-provider-grizzly2</artifactId>
359+
<version>${jersey-version}</version>
360+
<scope>test</scope>
361+
</dependency>
362+
<dependency>
363+
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
364+
<artifactId>jersey-test-framework-provider-inmemory</artifactId>
365+
<version>${jersey-version}</version>
366+
<scope>test</scope>
367+
</dependency>
350368
<dependency>
351369
<groupId>org.httpunit</groupId>
352370
<artifactId>httpunit</artifactId>

operator/src/main/java/oracle/kubernetes/operator/rest/AuthenticationFilter.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, 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

@@ -44,8 +44,7 @@ public class AuthenticationFilter extends BaseDebugLoggingFilter implements Cont
4444
@Context private Application application; // TBD - does this work?
4545

4646
public static final String REST_BACKEND_PROPERTY = "RestBackend";
47-
48-
private static final String ACCESS_TOKEN_PREFIX = "Bearer ";
47+
public static final String ACCESS_TOKEN_PREFIX = "Bearer ";
4948

5049
private static LoggingFacade LOGGER = LoggingFactory.getLogger("Operator", "Operator");
5150

@@ -63,12 +62,9 @@ public void filter(ContainerRequestContext req) throws IOException {
6362
String t = getAccessToken(req);
6463
RestBackend be = r.getBackend(t);
6564
req.setProperty(REST_BACKEND_PROPERTY, be);
66-
} catch (RuntimeException re) {
65+
} catch (RuntimeException | Error re) {
6766
authenticationFailure(re);
6867
throw re; // stop the filter chain if we can't authenticate
69-
} catch (Error er) {
70-
authenticationFailure(er);
71-
throw er; // stop the filter chain if we can't authenticate
7268
}
7369
LOGGER.exiting();
7470
}

operator/src/main/java/oracle/kubernetes/operator/rest/RestServer.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
import java.nio.file.Files;
1212
import java.security.SecureRandom;
1313
import java.util.Collection;
14-
import java.util.HashMap;
1514
import java.util.Map;
1615
import java.util.concurrent.Executors;
1716
import java.util.concurrent.ThreadFactory;
1817
import javax.net.ssl.KeyManager;
1918
import javax.net.ssl.SSLContext;
2019
import oracle.kubernetes.operator.logging.LoggingFacade;
2120
import oracle.kubernetes.operator.logging.LoggingFactory;
21+
import oracle.kubernetes.operator.rest.resource.VersionsResource;
2222
import oracle.kubernetes.operator.work.Container;
2323
import oracle.kubernetes.operator.work.ContainerResolver;
2424
import org.apache.commons.codec.binary.Base64;
@@ -323,8 +323,21 @@ private HttpServer createHttpsServer(Container container, SSLContext ssl, String
323323

324324
private ResourceConfig createResourceConfig() {
325325
LOGGER.entering();
326-
// create a resource config that scans for JAX-RS resources and providers
327-
// in oracle.kubernetes.operator.rest package
326+
327+
ResourceConfig rc = createResourceConfig(config);
328+
329+
LOGGER.exiting();
330+
return rc;
331+
}
332+
333+
/**
334+
* Defines a resource configuration that scans for JAX-RS resources and providers in the REST
335+
* package.
336+
*
337+
* @param restConfig the operator REST configuration
338+
* @return a resource configuration
339+
*/
340+
static ResourceConfig createResourceConfig(RestConfig restConfig) {
328341
ResourceConfig rc =
329342
new ResourceConfig()
330343
.register(JacksonFeature.class)
@@ -334,15 +347,8 @@ private ResourceConfig createResourceConfig() {
334347
.register(RequestDebugLoggingFilter.class)
335348
.register(ResponseDebugLoggingFilter.class)
336349
.register(ExceptionMapper.class)
337-
.packages("oracle.kubernetes.operator.rest.resource");
338-
Map<String, Object> extraProps = new HashMap<>();
339-
340-
// attach the rest backend impl to the resource config
341-
// so that the resource impls can find it
342-
extraProps.put(RestConfig.REST_CONFIG_PROPERTY, config);
343-
rc.addProperties(extraProps);
344-
345-
LOGGER.exiting();
350+
.packages(VersionsResource.class.getPackageName());
351+
rc.setProperties(Map.of(RestConfig.REST_CONFIG_PROPERTY, restConfig));
346352
return rc;
347353
}
348354

0 commit comments

Comments
 (0)