Skip to content

Commit

Permalink
Merge pull request #10 from appuio/feat/install-es-operator-clustersc…
Browse files Browse the repository at this point in the history
…oped

Deploy elasticsearch-operator cluster-scoped
  • Loading branch information
simu authored Jul 29, 2021
2 parents 56271b6 + 2fb4e92 commit 6c701b4
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 13 deletions.
60 changes: 47 additions & 13 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local kap = import 'lib/kapitan.libjsonnet';
local kube = import 'lib/kube.libjsonnet';
local operatorlib = import 'lib/openshift4-operators.libsonnet';
local inv = kap.inventory();
local params = inv.parameters.openshift4_logging;

Expand All @@ -17,7 +18,7 @@ local clusterLoggingGroupVersion = 'logging.openshift.io/v1';
},
},
},
'10_operator_group': kube._Object(group + 'v1', 'OperatorGroup', 'cluster-logging') {
'10_operator_group': operatorlib.OperatorGroup('cluster-logging') {
metadata+: {
namespace: params.namespace,
},
Expand All @@ -27,18 +28,19 @@ local clusterLoggingGroupVersion = 'logging.openshift.io/v1';
],
},
},
'20_subscriptions': [ kube._Object(group + 'v1alpha1', 'Subscription', name) {
metadata+: {
namespace: params.namespace,
},
spec: {
channel: params.channel,
installPlanApproval: 'Automatic',
name: name,
source: 'redhat-operators',
sourceNamespace: 'openshift-marketplace',
},
} for name in [ 'elasticsearch-operator', 'cluster-logging' ] ],
'20_subscriptions': [
operatorlib.managedSubscription(
'openshift-operators-redhat',
'elasticsearch-operator',
params.channel
),
operatorlib.namespacedSubscription(
params.namespace,
'cluster-logging',
params.channel,
'redhat-operators'
),
],
'30_cluster_logging': kube._Object(clusterLoggingGroupVersion, 'ClusterLogging', 'instance') {
metadata+: {
namespace: params.namespace,
Expand Down Expand Up @@ -81,4 +83,36 @@ local clusterLoggingGroupVersion = 'logging.openshift.io/v1';
},
},
} for role in [ 'master', 'worker' ] ],
'50_networkpolicy':
// Allow cluster-scoped ES operator to access ES pods in openshift-logging
kube._Object('networking.k8s.io/v1', 'NetworkPolicy', 'allow-from-openshift-operators-redhat')
{
metadata+: {
namespace: params.namespace,
},
spec: {
ingress: [
{
from: [
{
namespaceSelector: {
matchLabels: {
name: 'openshift-operators-redhat',
},
},
},
{
podSelector: {
matchLabels: {
name: 'elasticsearch-operator',
},
},
},
],
},
],
podSelector: {},
policyTypes: [ 'Ingress' ],
},
},
}
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
openshift4-logging is a Commodore component to manage OpenShift4 Logging.
It installs the https://github.com/openshift/cluster-logging-operator[cluster logging operator] and the corresponding `ClusterLogging` instance.

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.

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

Expand Down

0 comments on commit 6c701b4

Please sign in to comment.