Skip to content

Commit

Permalink
Migrate console-plugin to observability operator
Browse files Browse the repository at this point in the history
  • Loading branch information
DebakelOrakel committed Dec 23, 2024
1 parent 6530a39 commit d060a41
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 13 deletions.
24 changes: 12 additions & 12 deletions component/log_forwarder.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ local rbac = [
roleRef: {
apiGroup: 'rbac.authorization.k8s.io',
kind: 'ClusterRole',
name: 'collect-application-logs'
name: 'collect-application-logs',
},
subjects: [{
subjects: [ {
kind: 'ServiceAccount',
name: 'logcollector',
namespace: params.namespace
}],
namespace: params.namespace,
} ],
},
kube._Object('rbac.authorization.k8s.io/v1', 'ClusterRoleBinding', 'logcollector-infrastructure-logs') {
metadata+: {
Expand All @@ -127,13 +127,13 @@ local rbac = [
roleRef: {
apiGroup: 'rbac.authorization.k8s.io',
kind: 'ClusterRole',
name: 'collect-infrastructure-logs'
name: 'collect-infrastructure-logs',
},
subjects: [{
subjects: [ {
kind: 'ServiceAccount',
name: 'logcollector',
namespace: params.namespace
}],
namespace: params.namespace,
} ],
},
kube._Object('rbac.authorization.k8s.io/v1', 'ClusterRoleBinding', 'logcollector-audit-logs') {
metadata+: {
Expand All @@ -145,13 +145,13 @@ local rbac = [
roleRef: {
apiGroup: 'rbac.authorization.k8s.io',
kind: 'ClusterRole',
name: 'collect-audit-logs'
name: 'collect-audit-logs',
},
subjects: [{
subjects: [ {
kind: 'ServiceAccount',
name: 'logcollector',
namespace: params.namespace
}],
namespace: params.namespace,
} ],
},
];

Expand Down
21 changes: 21 additions & 0 deletions component/log_lokistack.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,34 @@ local aggregate_loki_log_access = kube.ClusterRole('syn:loki:cluster-reader') {
],
};

// Console Log Plugin
local console_plugin = kube._Object('observability.openshift.io/v1alpha1', 'UIPlugin', 'logging') {
metadata: {
labels: {
name: 'logging',
},
name: 'logging',
},
spec: {
type: 'Logging',
logging: {
lokiStack: {
name: 'loki',
},
logsLimit: 50,
timeout: '30s',
},
},
};

// Define outputs below
if loki.enabled then
{
'30_loki_stack': lokistack,
'30_loki_logstore': logstore,
'30_loki_netpol': [ netpol_viewplugin, netpol_lokigateway ],
'30_loki_rbac': [ aggregate_loki_log_access ],
'30_loki_plugin': console_plugin,
}
else
std.trace(
Expand Down
13 changes: 13 additions & 0 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,22 @@ local lokistack = if lokiEnabled then operatorlib.managedSubscription(
},
};

local observability = if lokiEnabled then operatorlib.managedSubscription(
'openshift-operators-redhat',
'cluster-observability-operator',
'development'
) {
metadata+: {
annotations+: {
'argocd.argoproj.io/sync-wave': '-80',
},
},
};

local subscriptions = std.filter(function(it) it != null, [
logging,
lokistack,
observability,
]);

local secrets = com.generateResources(params.secrets, kube.Secret);
Expand Down
1 change: 0 additions & 1 deletion tests/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ parameters:
input_paths:
- tests/console-patch.jsonnet
output_path: console-patching/

openshift4_operators:
defaultInstallPlanApproval: Automatic
defaultSource: openshift-operators-redhat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,19 @@ spec:
name: loki-operator
source: openshift-operators-redhat
sourceNamespace: openshift-operators-redhat
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
annotations:
argocd.argoproj.io/sync-wave: '-80'
labels:
name: cluster-observability-operator
name: cluster-observability-operator
namespace: openshift-operators-redhat
spec:
channel: development
installPlanApproval: Automatic
name: cluster-observability-operator
source: openshift-operators-redhat
sourceNamespace: openshift-operators-redhat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: observability.openshift.io/v1alpha1
kind: UIPlugin
metadata:
labels:
name: logging
name: logging
spec:
logging:
logsLimit: 50
lokiStack:
name: loki
timeout: 30s
type: Logging
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,19 @@ spec:
name: loki-operator
source: openshift-operators-redhat
sourceNamespace: openshift-operators-redhat
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
annotations:
argocd.argoproj.io/sync-wave: '-80'
labels:
name: cluster-observability-operator
name: cluster-observability-operator
namespace: openshift-operators-redhat
spec:
channel: development
installPlanApproval: Automatic
name: cluster-observability-operator
source: openshift-operators-redhat
sourceNamespace: openshift-operators-redhat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: observability.openshift.io/v1alpha1
kind: UIPlugin
metadata:
labels:
name: logging
name: logging
spec:
logging:
logsLimit: 50
lokiStack:
name: loki
timeout: 30s
type: Logging
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,19 @@ spec:
name: loki-operator
source: openshift-operators-redhat
sourceNamespace: openshift-operators-redhat
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
annotations:
argocd.argoproj.io/sync-wave: '-80'
labels:
name: cluster-observability-operator
name: cluster-observability-operator
namespace: openshift-operators-redhat
spec:
channel: development
installPlanApproval: Automatic
name: cluster-observability-operator
source: openshift-operators-redhat
sourceNamespace: openshift-operators-redhat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: observability.openshift.io/v1alpha1
kind: UIPlugin
metadata:
labels:
name: logging
name: logging
spec:
logging:
logsLimit: 50
lokiStack:
name: loki
timeout: 30s
type: Logging

0 comments on commit d060a41

Please sign in to comment.