Skip to content

Commit fd8afce

Browse files
anpanigrANTARYAMI.PANIGRAHI@ORACLE.COMTom Barnes
authored
Update the Traefik Version to 2.x (#1814)
* Initial check-in for traefik version update * Modified the doc and sample artifacts files * Foramt the document * More doc changes * Renamed setup.sh to setupLoadBalancer.sh to be more specific as per suggestion on OWLS-77806 * Addressed doc comments on PR review * More doc review comments * Minor hypelink name change * More doc changes * Fixed the broken links * Updated copyright inforrmation * Doc review comments * More doc changes * Minor typo * Modified the mii sample wraper scripts * Update Mii Sample script * Resync develop branch. Modified more scripts and yaml files for mii-sample * update MII sample generation/test instructions * Missing modification * Modified traefik ingress syntax * Modifoe md files from docs-source directory * More doc review comment * Fixed the indention issue in inline ingress file * More doc review resolution * Minor doc update * Move the istio istallatiion to RESULTS_ROOT directory Co-authored-by: ANTARYAMI.PANIGRAHI@ORACLE.COM <anpanigr@anpanigr-2.subnet1ad3phx.devweblogicphx.oraclevcn.com> Co-authored-by: Tom Barnes <tom.barnes@oracle.com>
1 parent bee09c1 commit fd8afce

File tree

25 files changed

+398
-330
lines changed

25 files changed

+398
-330
lines changed

docs-source/content/quickstart/cleanup.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ weight: 7
3131
1. Configure the Traefik load balancer to stop managing the ingresses in the domain namespace:
3232

3333
```bash
34-
$ helm upgrade traefik-operator stable/traefik \
34+
$ helm upgrade traefik-operator traefik/traefik \
3535
--namespace traefik \
3636
--reuse-values \
37-
--set "kubernetes.namespaces={traefik}" \
38-
--wait
37+
--set "kubernetes.namespaces={traefik}"
3938
```
4039

4140
1. Configure the operator to stop managing the domain:

docs-source/content/quickstart/install.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ EOF
2929
First, set up Helm:
3030

3131
```bash
32-
$ helm repo add stable https://kubernetes-charts.storage.googleapis.com/
32+
$ helm repo add traefik https://containous.github.io/traefik-helm-chart/
33+
$ helm repo update
3334
```
3435

3536
#### Create a Traefik (ingress-based) load balancer.
@@ -44,11 +45,10 @@ Use the [values.yaml](http://github.com/oracle/weblogic-kubernetes-operator/blob
4445

4546

4647
```bash
47-
$ helm install traefik-operator stable/traefik \
48+
$ helm install traefik-operator traefik/traefik \
4849
--namespace traefik \
4950
--values kubernetes/samples/charts/traefik/values.yaml \
50-
--set "kubernetes.namespaces={traefik}" \
51-
--wait
51+
--set "kubernetes.namespaces={traefik}"
5252
```
5353

5454
#### Install the operator.

docs-source/content/quickstart/prepare.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ weight: 5
2525
1. Configure Traefik to manage ingresses created in this namespace:
2626

2727
```bash
28-
$ helm upgrade traefik-operator stable/traefik \
28+
$ helm upgrade traefik-operator traefik/traefik \
2929
--namespace traefik \
3030
--reuse-values \
31-
--set "kubernetes.namespaces={traefik,sample-domain1-ns}" \
32-
--wait
31+
--set "kubernetes.namespaces={traefik,sample-domain1-ns}"
3332
```
3433

3534
{{% notice note %}}

docs-source/content/samples/simple/domains/model-in-image/cleanup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ To remove the resources you have created in these samples:
2121
2. If you set up the Traefik ingress controller:
2222

2323
```
24-
$ helm delete --purge traefik-operator
24+
$ helm uninstall traefik-operator -n traefik
2525
$ kubectl delete namespace traefik
2626
```
2727

@@ -32,7 +32,7 @@ To remove the resources you have created in these samples:
3232

3333
4. Delete the operator and its namespace:
3434
```
35-
$ helm delete --purge sample-weblogic-operator
35+
$ helm uninstall sample-weblogic-operator -n sample-weblogic-operator-ns
3636
$ kubectl delete namespace sample-weblogic-operator-ns
3737
```
3838

docs-source/content/samples/simple/domains/model-in-image/prerequisites.md

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ weight: 1
5353
- Option 1: To create the ingresses, use the following YAML file to create a file called `/tmp/mii-sample/ingresses/myingresses.yaml` and then call `kubectl apply -f /tmp/mii-sample/ingresses/myingresses.yaml`:
5454

5555
```yaml
56-
apiVersion: networking.k8s.io/v1beta1
57-
kind: Ingress
56+
apiVersion: traefik.containo.us/v1alpha1
57+
kind: IngressRoute
5858
metadata:
5959
name: traefik-ingress-sample-domain1-admin-server
6060
namespace: sample-domain1-ns
@@ -63,17 +63,16 @@ weight: 1
6363
annotations:
6464
kubernetes.io/ingress.class: traefik
6565
spec:
66-
rules:
67-
- host:
68-
http:
69-
paths:
70-
- path: /console
71-
backend:
72-
serviceName: sample-domain1-admin-server
73-
servicePort: 7001
66+
routes:
67+
- kind: Rule
68+
match: PathPrefix(`/console`)
69+
services:
70+
- kind: Service
71+
name: sample-domain1-admin-server
72+
port: 7001
7473
---
75-
apiVersion: networking.k8s.io/v1beta1
76-
kind: Ingress
74+
apiVersion: traefik.containo.us/v1alpha1
75+
kind: IngressRoute
7776
metadata:
7877
name: traefik-ingress-sample-domain1-cluster-cluster-1
7978
namespace: sample-domain1-ns
@@ -82,17 +81,16 @@ weight: 1
8281
annotations:
8382
kubernetes.io/ingress.class: traefik
8483
spec:
85-
rules:
86-
- host: sample-domain1-cluster-cluster-1.mii-sample.org
87-
http:
88-
paths:
89-
- path:
90-
backend:
91-
serviceName: sample-domain1-cluster-cluster-1
92-
servicePort: 8001
84+
routes:
85+
- kind: Rule
86+
match: Host(`sample-domain1-cluster-cluster-1.mii-sample.org`)
87+
services:
88+
- kind: Service
89+
name: sample-domain1-cluster-cluster-1
90+
port: 8001
9391
---
94-
apiVersion: networking.k8s.io/v1beta1
95-
kind: Ingress
92+
apiVersion: traefik.containo.us/v1alpha1
93+
kind: IngressRoute
9694
metadata:
9795
name: traefik-ingress-sample-domain2-cluster-cluster-1
9896
namespace: sample-domain1-ns
@@ -101,14 +99,13 @@ weight: 1
10199
annotations:
102100
kubernetes.io/ingress.class: traefik
103101
spec:
104-
rules:
105-
- host: sample-domain2-cluster-cluster-1.mii-sample.org
106-
http:
107-
paths:
108-
- path:
109-
backend:
110-
serviceName: sample-domain2-cluster-cluster-1
111-
servicePort: 8001
102+
routes:
103+
- kind: Rule
104+
match: Host(`sample-domain2-cluster-cluster-1.mii-sample.org`)
105+
services:
106+
- kind: Service
107+
name: sample-domain2-cluster-cluster-1
108+
port: 8001
112109
```
113110
114111
- Option 2: Run `kubectl apply -f` on each of the ingress YAML files that are already included in the sample source `/tmp/mii-sample/ingresses` directory:

kubernetes/hands-on-lab/tutorials/install.traefik.ocishell.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ kubectl create namespace traefik
1919
Install the Traefik operator in the `traefik` namespace with the provided sample values:
2020
```bash
2121
helm install traefik-operator \
22-
stable/traefik \
22+
traefik/traefik \
2323
--namespace traefik \
2424
--values kubernetes/samples/charts/traefik/values.yaml \
2525
--set "kubernetes.namespaces={traefik}" \

kubernetes/samples/charts/traefik/README.md

Lines changed: 62 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,102 +4,106 @@ This sample demonstrates how to install the Traefik ingress controller to provid
44
load balancing for WebLogic clusters.
55

66
## Install the Traefik operator with a Helm chart
7-
The Traefik Helm chart is located in the official Helm project `charts` directory at https://github.com/helm/charts/tree/master/stable/traefik.
8-
The chart is in the default repository for Helm.
7+
This document is based on Traefik version 2.x with the Helm chart at [Traefik Helm Repository](https://github.com/containous/traefik-helm-chart).
8+
For more information about Traefik, see the [Traefik Official Site](https://traefik.io/).
99

10-
To install the Traefik operator in the `traefik` namespace with default settings:
10+
To install the Traefik operator in the `traefik` namespace with the default settings:
1111
```
12-
$ helm install --name traefik-operator --namespace traefik stable/traefik
12+
$ helm repo add traefik https://containous.github.io/traefik-helm-chart
13+
$ helm repo update
14+
$ kubectl create namespace traefik
15+
$ helm install traefik-operator traefik/traefik --namespace traefik
1316
```
14-
Or, with a given `values.yaml`:
17+
You can also install the Traefik operator with a custom `values.yaml` file. For more detailed information, see the [Traefik GitHub Project](https://github.com/containous/traefik-helm-chart/blob/master/traefik/values.yaml).
1518
```
16-
$ helm install --name traefik-operator --namespace traefik --values values.yaml stable/traefik
17-
```
18-
With the dashboard enabled, you can access the Traefik dashboard with the URL `http://${HOSTNAME}:30305`, with the HTTP host `traefik.example.com`.
19-
```
20-
$ curl -H 'host: traefik.example.com' http://${HOSTNAME}:30305/
21-
```
22-
23-
## Optionally, download the Traefik Helm chart
24-
If you want, you can download the Traefik Helm chart and untar it into a local folder:
25-
```
26-
$ helm fetch stable/traefik --untar
27-
```
28-
29-
## Update the Traefik operator
30-
After the Traefik operator is installed and running, if you want to change some configurations of the operator, use `helm upgrade` to achieve this.
31-
```
32-
$ helm upgrade traefik-operator stable/traefik --values values.yaml
19+
$ helm install traefik-operator traefik/traefik --namespace traefik --values values.yaml
3320
```
3421

35-
## Configure Traefik as a load balancer for WLS domains
36-
In this section we'll demonstrate how to use Traefik to handle traffic to backend WLS domains.
22+
## Configure Traefik as a load balancer for WebLogic domains
23+
This section describes how to use Traefik to handle traffic to backend WebLogic domains.
3724

38-
### 1. Install WLS domains
39-
Now we need to prepare some domains for Traefik load balancing.
25+
### 1. Install WebLogic domains
26+
First, we need to prepare two domains for Traefik load balancing.
4027

41-
Create two WLS domains:
42-
- One domain with name `domain1` under namespace `default`.
43-
- One domain with name `domain2` under namespace `test1`.
28+
Create two WebLogic domains:
29+
- One domain with `domain1` as the domain UID and namespace `weblogic-domain1`.
30+
- One domain with `domain2` as the domain UID and namespace `weblogic-domain2`.
4431
- Each domain has a web application installed with the URL context `testwebapp`.
32+
- Each domain has a WebLogic cluster `cluster-1` where each Managed Server listens on port `8001`.
4533

46-
### 2. Install the Traefik Ingress
47-
#### Install a host-routing Ingress
34+
### 2. Web request routing
35+
The following sections describe how to route an application web request to the WebLogic domain through a Traefik frontend.
36+
37+
#### Host-based routing
38+
This sample demonstrates how to access an application on two WebLogic domains using host-based routing. Install a host-based routing Traefik [IngressRoute](https://docs.traefik.io/routing/providers/kubernetes-crd/#kind-ingressroute).
4839
```
4940
$ kubectl create -f samples/host-routing.yaml
41+
ingressroute.traefik.containo.us/traefik-hostrouting-1 created
42+
ingressroute.traefik.containo.us/traefik-hostrouting-2 created
5043
```
51-
Now you can send requests to different WLS domains with the unique entry point of Traefik with different hostnames.
44+
Now you can send requests to different WebLogic domains with the unique Traefik entry point of different host names as defined in the route section of the `host-routing.yaml` file.
5245
```
53-
$ curl -H 'host: domain1.org' http://${HOSTNAME}:30305/testwebapp/
54-
$ curl -H 'host: domain2.org' http://${HOSTNAME}:30305/testwebapp/
46+
# Get the ingress controller web port
47+
$ export LB_PORT=$(kubectl -n traefik get service traefik-operator -o jsonpath='{.spec.ports[?(@.name=="web")].nodePort}')
48+
$ curl -H 'host: domain1.org' http://${HOSTNAME}:${LB_PORT}/testwebapp/
49+
$ curl -H 'host: domain2.org' http://${HOSTNAME}:${LB_PORT}/testwebapp/
5550
```
56-
#### Install a path-routing Ingress
51+
52+
#### Path-based routing
53+
This sample demonstrates how to access an application on two WebLogic domains using path-based routing. Install a path-based routing Traefik [IngressRoute](https://docs.traefik.io/routing/providers/kubernetes-crd/#kind-ingressroute) and [Middleware](https://docs.traefik.io/middlewares/overview/).
54+
5755
```
5856
$ kubectl create -f samples/path-routing.yaml
57+
ingressroute.traefik.containo.us/traefik-pathrouting-1 created
58+
middleware.traefik.containo.us/middleware-domain1 created
59+
ingressroute.traefik.containo.us/traefik-pathrouting-2 created
60+
middleware.traefik.containo.us/middleware-domain2 created
5961
```
60-
Now you can send requests to different WLS domains with the unique entry point of Traefik with different paths.
62+
Now you can send requests to different WebLogic domains with the unique Traefik entry point of different paths, as defined in the route section of the `path-routing.yaml` file.
6163
```
62-
$ curl http://${HOSTNAME}:30305/domain1/
63-
$ curl http://${HOSTNAME}:30305/domain2/
64+
# Get the ingress controller web port
65+
$ export LB_PORT=$(kubectl -n traefik get service traefik-operator -o jsonpath='{.spec.ports[?(@.name=="web")].nodePort}')
66+
$ curl http://${HOSTNAME}:${LB_PORT}/domain1/
67+
$ curl http://${HOSTNAME}:${LB_PORT}/domain2/
6468
```
65-
#### Install a TLS-enabled Ingress
66-
This sample demonstrates accessing the two WLS domains using an HTTPS endpoint and the WLS domains are protected by different TLS certificates.
67-
68-
To make this sample work, you need to enable the TLS endpoint in the Traefik operator. If you use the `values.yaml` file in the same folder as this README, the TLS endpoint is already enabled.
69+
#### Host-based secured routing
70+
This sample demonstrates how to access an application on two WebLogic domains using an HTTPS endpoint. Install a TLS-enabled Traefik [IngressRoute](https://docs.traefik.io/routing/providers/kubernetes-crd/#kind-ingressroute).
6971

70-
First, you need to create two secrets with TLS certificates, one with the common name `domain1.org`, the other with the common name `domain2.org`. We use `openssl` to generate self-signed certificates for demonstration purposes. Note that the TLS secret needs to be in the same namespace as the WLS domain.
72+
First, you need to create two secrets with TLS certificates, one with the common name `domain1.org`, the other with the common name `domain2.org`. We use `openssl` to generate self-signed certificates for demonstration purposes. Note that the TLS secret needs to be in the same namespace as the WebLogic domain.
7173
```
7274
# create a TLS secret for domain1
7375
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /tmp/tls1.key -out /tmp/tls1.crt -subj "/CN=domain1.org"
74-
$ kubectl create secret tls domain1-tls-cert --key /tmp/tls1.key --cert /tmp/tls1.crt
75-
76+
$ kubectl -n weblogic-domain1 create secret tls domain1-tls-cert --key /tmp/tls1.key --cert /tmp/tls1.crt
7677
# create a TLS secret for domain2
7778
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /tmp/tls2.key -out /tmp/tls2.crt -subj "/CN=domain2.org"
78-
$ kubectl -n test1 create secret tls domain2-tls-cert --key /tmp/tls2.key --cert /tmp/tls2.crt
79-
```
80-
Then deploy the TLS Ingress.
81-
```
79+
$ kubectl -n weblogic-domain2 create secret tls domain2-tls-cert --key /tmp/tls2.key --cert /tmp/tls2.crt
80+
81+
# Deploy a TLS IngressRoute.
8282
$ kubectl create -f samples/tls.yaml
83+
ingressroute.traefik.containo.us/traefik-tls-1 created
84+
ingressroute.traefik.containo.us/traefik-tls-2 created
8385
```
84-
Now you can access the two WLS domains with different hostnames using the HTTPS endpoint.
86+
Now you can access the application on the WebLogic domain with the host name in the HTTP header.
87+
The ingress controller secure port can be obtained dynamically from the `traefik-operator` service in the `traefik` namespace.
8588
```
86-
$ curl -k -H 'host: domain1.org' https://${HOSTNAME}:30443/testwebapp/
87-
$ curl -k -H 'host: domain2.org' https://${HOSTNAME}:30443/testwebapp/
89+
# Get the ingress controller secure web port
90+
TLS_PORT=`kubectl -n traefik get service traefik-operator -o jsonpath='{.spec.ports[?(@.name=="websecure")].nodePort}'`
91+
$ curl -k -H 'host: domain1.org' https://${HOSTNAME}:${TLS_PORT}/testwebapp/
8892
```
8993

9094
## Uninstall the Traefik operator
91-
After removing all the Ingress resources, uninstall the Traefik operator:
95+
After removing all the ingress resources, uninstall the Traefik operator:
9296
```
93-
$ helm delete --purge traefik-operator
97+
$ helm uninstall traefik-operator --namespace traefik --keep-history
9498
```
95-
## Install and uninstall the Traefik operator with setup.sh
96-
Alternatively, you can run the helper script `setup.sh`, under the `kubernetes/samples/charts/util` folder, to install and uninstall Traefik.
99+
## Install and uninstall the Traefik operator with setupLoadBalancer.sh
100+
Alternatively, you can run the helper script `setupLoadBalancer.sh`, under the `kubernetes/samples/charts/util` folder, to install and uninstall Traefik.
97101

98102
To install Traefik:
99103
```
100-
$ ./setup.sh create traefik
104+
$ ./setupLoadBalancer.sh create traefik
101105
```
102106
To uninstall Traefik:
103107
```
104-
$ ./setup.sh delete traefik
108+
$ ./setupLoadBalancer.sh delete traefik
105109
```
Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
1-
apiVersion: networking.k8s.io/v1beta1
2-
kind: Ingress
1+
# Copyright (c) 2018, 2020, Oracle Corporation and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
apiVersion: traefik.containo.us/v1alpha1
5+
kind: IngressRoute
36
metadata:
47
annotations:
58
kubernetes.io/ingress.class: traefik
69
name: traefik-hostrouting-1
7-
namespace: default
10+
namespace: weblogic-domain1
811
spec:
9-
rules:
10-
- host: domain1.org
11-
http:
12-
paths:
13-
- path:
14-
backend:
15-
serviceName: domain1-cluster-cluster-1
16-
servicePort: 8001
17-
12+
routes:
13+
- kind: Rule
14+
match: Host(`domain1.org`)
15+
services:
16+
- kind: Service
17+
name: domain1-cluster-cluster-1
18+
port: 8001
1819
---
19-
apiVersion: networking.k8s.io/v1beta1
20-
kind: Ingress
20+
apiVersion: traefik.containo.us/v1alpha1
21+
kind: IngressRoute
2122
metadata:
2223
annotations:
2324
kubernetes.io/ingress.class: traefik
2425
name: traefik-hostrouting-2
25-
namespace: test1
26+
namespace: weblogic-domain2
2627
spec:
27-
rules:
28-
- host: domain2.org
29-
http:
30-
paths:
31-
- path:
32-
backend:
33-
serviceName: domain2-cluster-cluster-1
34-
servicePort: 8001
35-
28+
routes:
29+
- kind: Rule
30+
match: Host(`domain2.org`)
31+
services:
32+
- kind: Service
33+
name: domain2-cluster-cluster-1
34+
port: 8001

0 commit comments

Comments
 (0)