Skip to content

Commit 6c701b4

Browse files
authored
Merge pull request #10 from appuio/feat/install-es-operator-clusterscoped
Deploy elasticsearch-operator cluster-scoped
2 parents 56271b6 + 2fb4e92 commit 6c701b4

File tree

2 files changed

+48
-13
lines changed

2 files changed

+48
-13
lines changed

component/main.jsonnet

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local kap = import 'lib/kapitan.libjsonnet';
22
local kube = import 'lib/kube.libjsonnet';
3+
local operatorlib = import 'lib/openshift4-operators.libsonnet';
34
local inv = kap.inventory();
45
local params = inv.parameters.openshift4_logging;
56

@@ -17,7 +18,7 @@ local clusterLoggingGroupVersion = 'logging.openshift.io/v1';
1718
},
1819
},
1920
},
20-
'10_operator_group': kube._Object(group + 'v1', 'OperatorGroup', 'cluster-logging') {
21+
'10_operator_group': operatorlib.OperatorGroup('cluster-logging') {
2122
metadata+: {
2223
namespace: params.namespace,
2324
},
@@ -27,18 +28,19 @@ local clusterLoggingGroupVersion = 'logging.openshift.io/v1';
2728
],
2829
},
2930
},
30-
'20_subscriptions': [ kube._Object(group + 'v1alpha1', 'Subscription', name) {
31-
metadata+: {
32-
namespace: params.namespace,
33-
},
34-
spec: {
35-
channel: params.channel,
36-
installPlanApproval: 'Automatic',
37-
name: name,
38-
source: 'redhat-operators',
39-
sourceNamespace: 'openshift-marketplace',
40-
},
41-
} for name in [ 'elasticsearch-operator', 'cluster-logging' ] ],
31+
'20_subscriptions': [
32+
operatorlib.managedSubscription(
33+
'openshift-operators-redhat',
34+
'elasticsearch-operator',
35+
params.channel
36+
),
37+
operatorlib.namespacedSubscription(
38+
params.namespace,
39+
'cluster-logging',
40+
params.channel,
41+
'redhat-operators'
42+
),
43+
],
4244
'30_cluster_logging': kube._Object(clusterLoggingGroupVersion, 'ClusterLogging', 'instance') {
4345
metadata+: {
4446
namespace: params.namespace,
@@ -81,4 +83,36 @@ local clusterLoggingGroupVersion = 'logging.openshift.io/v1';
8183
},
8284
},
8385
} for role in [ 'master', 'worker' ] ],
86+
'50_networkpolicy':
87+
// Allow cluster-scoped ES operator to access ES pods in openshift-logging
88+
kube._Object('networking.k8s.io/v1', 'NetworkPolicy', 'allow-from-openshift-operators-redhat')
89+
{
90+
metadata+: {
91+
namespace: params.namespace,
92+
},
93+
spec: {
94+
ingress: [
95+
{
96+
from: [
97+
{
98+
namespaceSelector: {
99+
matchLabels: {
100+
name: 'openshift-operators-redhat',
101+
},
102+
},
103+
},
104+
{
105+
podSelector: {
106+
matchLabels: {
107+
name: 'elasticsearch-operator',
108+
},
109+
},
110+
},
111+
],
112+
},
113+
],
114+
podSelector: {},
115+
policyTypes: [ 'Ingress' ],
116+
},
117+
},
84118
}

docs/modules/ROOT/pages/index.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
openshift4-logging is a Commodore component to manage OpenShift4 Logging.
44
It installs the https://github.com/openshift/cluster-logging-operator[cluster logging operator] and the corresponding `ClusterLogging` instance.
55

6+
The component depends on component xref:openshift4-operators:ROOT:index.adoc[openshift4-operators] to manage the cluster-scoped subscription for the official RedHat Elasticsearch Operator.
67

78
See the xref:references/parameters.adoc[parameters] reference for further details.
89

0 commit comments

Comments
 (0)