Skip to content

Commit bde6053

Browse files
authored
Enhance Coherence site and rack configuration (#534)
- Change the default Node label used to assign the rack name to a Coherence Pod to be `oci.oraclecloud.com/fault-domain` - Allow the Node labels to use for the Coherence Pod's site and rack name to be configured for individual Coherence deployments. - Change the default Coherence Pod anti-affinitiy to include both the site and rack labels
1 parent e38c482 commit bde6053

25 files changed

+654
-101
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,6 @@ jobs:
125125
shell: bash
126126
run: make e2e-test
127127

128-
- name: E2E Elasticsearch Tests
129-
shell: bash
130-
run: |
131-
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.6.2
132-
docker pull docker.elastic.co/kibana/kibana:7.6.2
133-
kind load docker-image --name operator docker.elastic.co/elasticsearch/elasticsearch:7.6.2
134-
kind load docker-image --name operator docker.elastic.co/kibana/kibana:7.6.2
135-
make e2e-elastic-test
136-
137-
- name: E2E Prometheus Tests
138-
shell: bash
139-
run: |
140-
make e2e-prometheus-test
141-
142128
- name: Helm Chart Tests
143129
shell: bash
144130
run: |

.github/workflows/compatibility-tests.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,31 @@ jobs:
4444
include:
4545
- compatibilityVersion: 3.2.6
4646
compatibilitySelector: control-plane=coherence
47+
k8s: kindest/node:v1.24.0@sha256:0866296e693efe1fed79d5e6c7af8df71fc73ae45e3679af05342239cdc5bc8e
4748
- compatibilityVersion: 3.2.5
4849
compatibilitySelector: control-plane=coherence
50+
k8s: kindest/node:v1.24.0@sha256:0866296e693efe1fed79d5e6c7af8df71fc73ae45e3679af05342239cdc5bc8e
4951
- compatibilityVersion: 3.2.4
5052
compatibilitySelector: control-plane=coherence
53+
k8s: kindest/node:v1.24.0@sha256:0866296e693efe1fed79d5e6c7af8df71fc73ae45e3679af05342239cdc5bc8e
5154
- compatibilityVersion: 3.2.3
5255
compatibilitySelector: control-plane=coherence
56+
k8s: kindest/node:v1.23.4@sha256:0e34f0d0fd448aa2f2819cfd74e99fe5793a6e4938b328f657c8e3f81ee0dfb9
5357
- compatibilityVersion: 3.2.2
5458
compatibilitySelector: control-plane=coherence
59+
k8s: kindest/node:v1.23.4@sha256:0e34f0d0fd448aa2f2819cfd74e99fe5793a6e4938b328f657c8e3f81ee0dfb9
5560
- compatibilityVersion: 3.2.1
5661
compatibilitySelector: control-plane=coherence
62+
k8s: kindest/node:v1.23.4@sha256:0e34f0d0fd448aa2f2819cfd74e99fe5793a6e4938b328f657c8e3f81ee0dfb9
5763
- compatibilityVersion: 3.1.5
5864
compatibilitySelector: control-plane=coherence
65+
k8s: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
5966
- compatibilityVersion: 3.1.4
6067
compatibilitySelector: control-plane=coherence
68+
k8s: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
6169
- compatibilityVersion: 3.0.2
6270
compatibilitySelector: component=coherence-operator
71+
k8s: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
6372

6473
steps:
6574
- uses: actions/checkout@v2
@@ -122,6 +131,7 @@ jobs:
122131
# Start a KinD K8s cluster with single worker node
123132
shell: bash
124133
run: |
134+
export KIND_IMAGE=${{ matrix.k8s }}
125135
make kind
126136
kubectl version
127137
kubectl get nodes
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Copyright 2019, 2022, Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at
3+
# http://oss.oracle.com/licenses/upl.
4+
5+
# ---------------------------------------------------------------------------
6+
# Coherence Operator GitHub Actions CI build.
7+
# ---------------------------------------------------------------------------
8+
name: ElasticSearch Tests
9+
10+
on:
11+
workflow_dispatch:
12+
push:
13+
branches-ignore:
14+
- gh-pages
15+
- 1.0.0
16+
- 2.x
17+
pull_request:
18+
types:
19+
- opened
20+
- synchronize
21+
- committed
22+
branches-ignore:
23+
- gh-pages
24+
- 1.0.0
25+
- 2.x
26+
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
31+
# Checkout the source, we need a depth of zero to fetch all the history otherwise
32+
# the copyright check cannot work out the date of the files from Git.
33+
steps:
34+
- uses: actions/checkout@v2
35+
with:
36+
fetch-depth: 0
37+
38+
# This step will free up disc space on the runner by removing
39+
# lots of things that we do not need.
40+
- name: disc
41+
shell: bash
42+
run: |
43+
echo "Listing 100 largest packages"
44+
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
45+
df -h
46+
echo "Removing large packages"
47+
sudo apt-get remove -y '^dotnet-.*'
48+
sudo apt-get remove -y '^llvm-.*'
49+
sudo apt-get remove -y 'monodoc-http'
50+
sudo apt-get remove -y 'php.*'
51+
sudo apt-get remove -y azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel
52+
sudo apt-get autoremove -y
53+
sudo apt-get clean
54+
df -h
55+
echo "Removing large directories"
56+
rm -rf /usr/share/dotnet/
57+
df -h
58+
59+
- name: Set up JDK
60+
uses: actions/setup-java@v1
61+
with:
62+
java-version: '11'
63+
64+
- name: Cache Go Modules
65+
uses: actions/cache@v1
66+
with:
67+
path: ~/go/pkg/mod
68+
key: ${{ runner.os }}-go-mods-${{ hashFiles('**/go.sum') }}
69+
restore-keys: |
70+
${{ runner.os }}-go-mods-
71+
72+
- name: Cache Maven packages
73+
uses: actions/cache@v1
74+
with:
75+
path: ~/.m2
76+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
77+
restore-keys: ${{ runner.os }}-m2
78+
79+
- name: Set up Go
80+
uses: actions/setup-go@v2
81+
with:
82+
go-version: 1.17.x
83+
84+
- name: Edit DNS Resolve
85+
shell: bash
86+
run: |
87+
sudo chown -R runner:runner /run/systemd/resolve/stub-resolv.conf
88+
sudo echo nameserver 8.8.8.8 > /run/systemd/resolve/stub-resolv.conf
89+
90+
- name: Start KinD Cluster
91+
shell: bash
92+
run: |
93+
make kind-single-worker
94+
kubectl version
95+
kubectl get nodes
96+
docker pull gcr.io/distroless/java
97+
docker pull gcr.io/distroless/java11
98+
docker pull gcr.io/distroless/java17
99+
100+
- name: E2E Elasticsearch Tests
101+
shell: bash
102+
run: |
103+
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.6.2
104+
docker pull docker.elastic.co/kibana/kibana:7.6.2
105+
kind load docker-image --name operator docker.elastic.co/elasticsearch/elasticsearch:7.6.2
106+
kind load docker-image --name operator docker.elastic.co/kibana/kibana:7.6.2
107+
make all
108+
make kind-load
109+
make e2e-elastic-test
110+
111+
- uses: actions/upload-artifact@v1
112+
if: failure()
113+
with:
114+
name: test-output
115+
path: build/_output/test-logs
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Copyright 2019, 2022, Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at
3+
# http://oss.oracle.com/licenses/upl.
4+
5+
# ---------------------------------------------------------------------------
6+
# Coherence Operator GitHub Actions CI build.
7+
# ---------------------------------------------------------------------------
8+
name: Prometheus Tests
9+
10+
on:
11+
workflow_dispatch:
12+
push:
13+
branches-ignore:
14+
- gh-pages
15+
- 1.0.0
16+
- 2.x
17+
pull_request:
18+
types:
19+
- opened
20+
- synchronize
21+
- committed
22+
branches-ignore:
23+
- gh-pages
24+
- 1.0.0
25+
- 2.x
26+
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
31+
# Checkout the source, we need a depth of zero to fetch all the history otherwise
32+
# the copyright check cannot work out the date of the files from Git.
33+
steps:
34+
- uses: actions/checkout@v2
35+
with:
36+
fetch-depth: 0
37+
38+
# This step will free up disc space on the runner by removing
39+
# lots of things that we do not need.
40+
- name: disc
41+
shell: bash
42+
run: |
43+
echo "Listing 100 largest packages"
44+
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
45+
df -h
46+
echo "Removing large packages"
47+
sudo apt-get remove -y '^dotnet-.*'
48+
sudo apt-get remove -y '^llvm-.*'
49+
sudo apt-get remove -y 'monodoc-http'
50+
sudo apt-get remove -y 'php.*'
51+
sudo apt-get remove -y azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel
52+
sudo apt-get autoremove -y
53+
sudo apt-get clean
54+
df -h
55+
echo "Removing large directories"
56+
rm -rf /usr/share/dotnet/
57+
df -h
58+
59+
- name: Set up JDK
60+
uses: actions/setup-java@v1
61+
with:
62+
java-version: '11'
63+
64+
- name: Cache Go Modules
65+
uses: actions/cache@v1
66+
with:
67+
path: ~/go/pkg/mod
68+
key: ${{ runner.os }}-go-mods-${{ hashFiles('**/go.sum') }}
69+
restore-keys: |
70+
${{ runner.os }}-go-mods-
71+
72+
- name: Cache Maven packages
73+
uses: actions/cache@v1
74+
with:
75+
path: ~/.m2
76+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
77+
restore-keys: ${{ runner.os }}-m2
78+
79+
- name: Set up Go
80+
uses: actions/setup-go@v2
81+
with:
82+
go-version: 1.17.x
83+
84+
- name: Edit DNS Resolve
85+
shell: bash
86+
run: |
87+
sudo chown -R runner:runner /run/systemd/resolve/stub-resolv.conf
88+
sudo echo nameserver 8.8.8.8 > /run/systemd/resolve/stub-resolv.conf
89+
90+
- name: Start KinD Cluster
91+
shell: bash
92+
run: |
93+
make kind
94+
kubectl version
95+
kubectl get nodes
96+
docker pull gcr.io/distroless/java
97+
docker pull gcr.io/distroless/java11
98+
docker pull gcr.io/distroless/java17
99+
100+
- name: E2E Prometheus Tests
101+
shell: bash
102+
run: |
103+
make all
104+
make kind-load
105+
make e2e-prometheus-test
106+
107+
- uses: actions/upload-artifact@v1
108+
if: failure()
109+
with:
110+
name: test-output
111+
path: build/_output/test-logs

Makefile

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,17 +1244,22 @@ uninstall-crds: $(BUILD_TARGETS)/manifests ## Uninstall the CRDs
12441244
.PHONY: deploy-and-wait
12451245
deploy-and-wait: deploy wait-for-deploy ## Deploy the Coherence Operator and wait for the Operator Pod to be ready
12461246

1247+
OPERATOR_HA ?= false
1248+
12471249
.PHONY: deploy
12481250
deploy: prepare-deploy create-namespace kustomize ## Deploy the Coherence Operator
12491251
ifneq (,$(WATCH_NAMESPACE))
12501252
cd $(BUILD_DEPLOY)/manager && $(KUSTOMIZE) edit add configmap env-vars --from-literal WATCH_NAMESPACE=$(WATCH_NAMESPACE)
1253+
endif
1254+
ifeq (true,$(OPERATOR_HA))
1255+
cd $(BUILD_DEPLOY)/manager && $(KUSTOMIZE) edit add patch --kind Deployment --name controller-manager --path ha-patch.yaml
12511256
endif
12521257
kubectl -n $(OPERATOR_NAMESPACE) create secret generic coherence-webhook-server-cert || true
12531258
$(KUSTOMIZE) build $(BUILD_DEPLOY)/default | kubectl apply -f -
12541259
sleep 5
12551260

12561261
.PHONY: just-deploy
1257-
just-deploy:
1262+
just-deploy: ## Deploy the Coherence Operator without rebuilding anything
12581263
$(call prepare_deploy,$(OPERATOR_IMAGE),$(OPERATOR_NAMESPACE),$(UTILS_IMAGE))
12591264
$(KUSTOMIZE) build $(BUILD_DEPLOY)/default | kubectl apply -f -
12601265

@@ -1362,6 +1367,8 @@ ifeq ($(CREATE_OPERATOR_NAMESPACE),true)
13621367
kubectl get ns $(OPERATOR_NAMESPACE) -o name > /dev/null 2>&1 || kubectl create namespace $(OPERATOR_NAMESPACE)
13631368
kubectl get ns $(OPERATOR_NAMESPACE_CLIENT) -o name > /dev/null 2>&1 || kubectl create namespace $(OPERATOR_NAMESPACE_CLIENT)
13641369
endif
1370+
kubectl label namespace $(OPERATOR_NAMESPACE) coherence.oracle.com/test=true --overwrite
1371+
kubectl label namespace $(OPERATOR_NAMESPACE_CLIENT) coherence.oracle.com/test=true --overwrite
13651372

13661373
# ----------------------------------------------------------------------------------------------------------------------
13671374
# Delete and re-create the test namespace
@@ -1452,17 +1459,37 @@ create-ssl-secrets: $(BUILD_OUTPUT)/certs
14521459
##@ KinD
14531460

14541461
KIND_CLUSTER ?= operator
1455-
KIND_IMAGE ?= "kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6"
1462+
KIND_IMAGE ?= "kindest/node:v1.24.0@sha256:0866296e693efe1fed79d5e6c7af8df71fc73ae45e3679af05342239cdc5bc8e"
14561463

14571464
# ----------------------------------------------------------------------------------------------------------------------
14581465
# Start a Kind cluster
14591466
# ----------------------------------------------------------------------------------------------------------------------
14601467
.PHONY: kind
14611468
kind: ## Run a default KinD cluster
1469+
./hack/kind.sh --wait 10m --image $(KIND_IMAGE)
1470+
./hack/kind-label-node.sh
1471+
1472+
# ----------------------------------------------------------------------------------------------------------------------
1473+
# Start a Kind cluster
1474+
# ----------------------------------------------------------------------------------------------------------------------
1475+
.PHONY: kind-single-worker
1476+
kind-single-worker: export KIND_CONFIG=./hack/kind-config-single.yaml
1477+
kind-single-worker: ## Run a KinD cluster with a single worker node
1478+
./hack/kind.sh --wait 10m --image $(KIND_IMAGE)
1479+
./hack/kind-label-node.sh
1480+
1481+
# ----------------------------------------------------------------------------------------------------------------------
1482+
# Start a Kind cluster with Calico
1483+
# ----------------------------------------------------------------------------------------------------------------------
1484+
.PHONY: kind-calico
1485+
kind-calico: export KIND_CONFIG=./hack/kind-config-calico.yaml
1486+
kind-calico: ## Run a KinD cluster with Calico
14621487
./hack/kind.sh --image $(KIND_IMAGE)
14631488
./hack/kind-label-node.sh
1464-
docker pull $(COHERENCE_IMAGE)
1465-
kind load docker-image --name $(KIND_CLUSTER) $(COHERENCE_IMAGE)
1489+
curl -sL https://docs.projectcalico.org/manifests/calico.yaml | kubectl apply -f -
1490+
kubectl -n kube-system set env daemonset/calico-node FELIX_IGNORELOOSERPF=true
1491+
kubectl -n kube-system wait --for condition=ready --timeout=300s -l k8s-app=calico-node pod
1492+
kubectl -n kube-system wait --for condition=ready --timeout=300s -l k8s-app=kube-dns pod
14661493

14671494
# ----------------------------------------------------------------------------------------------------------------------
14681495
# Stop and delete the Kind cluster
@@ -1475,7 +1502,7 @@ kind-stop: ## Stop and delete the KinD cluster named "$(KIND_CLUSTER)"
14751502
# Load images into Kind
14761503
# ----------------------------------------------------------------------------------------------------------------------
14771504
.PHONY: kind-load
1478-
kind-load: kind-load-operator ## Load all images into the KinD cluster
1505+
kind-load: kind-load-operator kind-load-coherence ## Load all images into the KinD cluster
14791506
kind load docker-image --name $(KIND_CLUSTER) $(TEST_APPLICATION_IMAGE) || true
14801507
kind load docker-image --name $(KIND_CLUSTER) $(TEST_APPLICATION_IMAGE_CLIENT) || true
14811508
kind load docker-image --name $(KIND_CLUSTER) $(TEST_APPLICATION_IMAGE_HELIDON) || true
@@ -1486,6 +1513,11 @@ kind-load: kind-load-operator ## Load all images into the KinD cluster
14861513
kind load docker-image --name $(KIND_CLUSTER) docker.elastic.co/elasticsearch/elasticsearch:7.6.2 || true
14871514
kind load docker-image --name $(KIND_CLUSTER) docker.elastic.co/kibana/kibana:7.6.2 || true
14881515

1516+
.PHONY: kind-load-coherence
1517+
kind-load-coherence: ## Load the Coherence image into the KinD cluster
1518+
docker pull $(COHERENCE_IMAGE)
1519+
kind load docker-image --name $(KIND_CLUSTER) $(COHERENCE_IMAGE)
1520+
14891521
.PHONY: kind-load-operator
14901522
kind-load-operator: ## Load the Operator images into the KinD cluster
14911523
kind load docker-image --name $(KIND_CLUSTER) $(OPERATOR_IMAGE) || true

0 commit comments

Comments
 (0)