Skip to content

Commit bd94a2a

Browse files
Support for OKE Infra and Service Log Collection (#100)
1 parent 8352266 commit bd94a2a

32 files changed

+1042
-287
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
4+
## 2025-03-19
5+
### Added
6+
- OKE Infrastructure Discovery: Automatic detection of associated VCNs, subnets, and load balancers.
7+
- OKE Infrastructure Logs Collection: Enables log collection for infrastructure components associated with the OKE cluster.
8+
- Disabled by default. Refer to the FAQs for steps to enable this feature.
9+
10+
311
## 2025-02-07
412
### Changed
513
- Management Agent container image has been updated to version 1.7.0

README.md

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,37 +42,81 @@ It does extensive enrichment of logs, metrics and object information to enable c
4242

4343
* OCI Logging Analytics service must be onboarded with the minimum required policies, in the OCI region where you want to monitor. Refer [Logging Analytics Quick Start](https://docs.oracle.com/en-us/iaas/logging-analytics/doc/quick-start.html) for details.
4444
* Create OCI Logging Analytics LogGroup(s) if not done already. Refer [Create Log Group](https://docs.oracle.com/en-us/iaas/logging-analytics/doc/create-logging-analytics-resources.html#GUID-D1758CFB-861F-420D-B12F-34D1CC5E3E0E) for details.
45+
46+
* Compartments:
47+
* OKE Compartment: where OKE and related infra resources are created.
48+
* Different OKE components such as Node Pools, VCN, Subnets, Load Balancers may be hosted in different compartments (other than OKE compartment).
49+
* You may need to modify the policy statements if any of the above resources are not created in same compartment as OKEs.
50+
* ONM Compartment: where Observability & Monitoring resources will be created.
51+
* OCI resources such as entities, management agent key, service connector, logging logs and logGroup, RMS stack and jobs will be created in this compartment.
52+
* It can be same as OKE compartment.
4553
* OCI Dynamic Groups, User Group and Policies.
4654
<details>
4755
<summary>Details</summary>
48-
56+
4957
* Create a dynamic group with the following sample rule for OCI Management Agent. Refer [Managing Dynamic Groups](https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/managingdynamicgroups.htm) for details.
5058
```
51-
ALL {resource.type='managementagent', resource.compartment.id='OCI Management Agent Compartment OCID'}
59+
ALL {resource.type='managementagent', resource.compartment.id='ONM Compartment OCID'}
5260
```
53-
* Create a dynamic group with following sample rule for OKE Instances.
61+
62+
* Create a dynamic group with following sample rule for OKE Instances.
5463
```
5564
ALL {instance.compartment.id='OKE Cluster Compartment OCID'}
5665
```
5766
- **Note**: _This dynamic group is not required for non OKE or when you choose to use Config file based AuthZ for monitoring the logs._
67+
5868
* Create a user and user group using which the logs to be published to OCI Logging Analytics. Refer [Managing Users](https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/managingusers.htm) and [Managing User Groups](https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/managinggroups.htm) for details.
5969
- **Note**: _This is not required for OKE when you choose to use the default (Instance principal) AuthZ mechanism._
70+
6071
* Create a policy with following statements.
6172
* Policy Statement for providing necessary access to upload the metrics.
6273
```
63-
Allow dynamic-group <OCI Management Agent Dynamic Group> to use metrics in compartment <Compartment Name> WHERE target.metrics.namespace = 'mgmtagent_kubernetes_metrics'
74+
Allow dynamic-group <OCI Management Agent Dynamic Group> to use metrics in compartment id <ONM Compartment OCID> WHERE target.metrics.namespace = 'mgmtagent_kubernetes_metrics'
6475
```
76+
6577
* Policy Statement for providing necessary access to upload the logs and objects data.
6678
```
67-
Allow dynamic-group <OKE Instances Dynamic Group> to {LOG_ANALYTICS_LOG_GROUP_UPLOAD_LOGS} in compartment <Compartment Name>
79+
Allow dynamic-group <OKE Instances Dynamic Group> to {LOG_ANALYTICS_LOG_GROUP_UPLOAD_LOGS} in compartment id <ONM Compartment OCID>
6880
Allow dynamic-group <OKE Instances Dynamic Group> to {LOG_ANALYTICS_DISCOVERY_UPLOAD} in tenancy
6981
```
7082
OR
7183
```
72-
Allow group <User Group> to {LOG_ANALYTICS_LOG_GROUP_UPLOAD_LOGS} in compartment <Compartment Name>
84+
Allow group <User Group> to {LOG_ANALYTICS_LOG_GROUP_UPLOAD_LOGS} in compartment id <ONM Compartment OCID>
7385
Allow group <User Group> to {LOG_ANALYTICS_DISCOVERY_UPLOAD} in tenancy
7486
```
7587
- **Note**: _The policy definition for LOG_ANALYTICS_DISCOVERY_UPLOAD permission only works at tenancy level and thereby it must be created at tenancy level._
88+
89+
* Policy statements for providing necessary access to enable OKE infra discovery and service logs collection.
90+
* Only required if service logs [collection is enabled](docs/FAQ.md#how-to-enable-oke-infra-discovery-and-corresponding-infra-services-log-collection)
91+
```
92+
Allow dynamic-group <OKE Instances Dynamic Group> to {CLUSTER_READ} in compartment id <OKE Compartment OCID> where target.cluster.id='<OKE Cluster OCID>'
93+
Allow dynamic-group <OKE Instances Dynamic Group> to read cluster-node-pools in compartment id <OKE Compartment OCID>
94+
Allow dynamic-group <OKE Instances Dynamic Group> to inspect vcns in compartment id <OKE Compartment OCID>
95+
Allow dynamic-group <OKE Instances Dynamic Group> to inspect subnets in compartment id <OKE Compartment OCID>
96+
Allow dynamic-group <OKE Instances Dynamic Group> to read load-balancers in compartment id <OKE Compartment OCID>
97+
98+
Allow dynamic-group <OKE Instances Dynamic Group> to read loganalytics-entity in compartment id <ONM Compartment OCID>
99+
Allow dynamic-group <OKE Instances Dynamic Group> to manage orm-jobs in compartment id <ONM Compartment OCID>
100+
Allow dynamic-group <OKE Instances Dynamic Group> to manage orm-stacks in compartment id <ONM Compartment OCID>
101+
102+
Allow dynamic-group <OKE Instances Dynamic Group> to use load-balancers in compartment id <OKE Compartment OCID>
103+
Allow dynamic-group <OKE Instances Dynamic Group> to {SUBNET_UPDATE} in compartment id <OKE Compartment OCID>
104+
Allow dynamic-group <OKE Instances Dynamic Group> to {CLUSTER_UPDATE} in compartment id <OKE Compartment OCID>
105+
Allow dynamic-group <OKE Instances Dynamic Group> to read log-content in compartment id <OKE Compartment OCID>
106+
Allow dynamic-group <OKE Instances Dynamic Group> to read log-content in compartment id <ONM Compartment OCID>
107+
Allow dynamic-group <OKE Instances Dynamic Group> to use log-groups in compartment id <OKE Compartment OCID>
108+
Allow dynamic-group <OKE Instances Dynamic Group> to manage log-groups in compartment id <ONM Compartment OCID>
109+
110+
Allow dynamic-group <OKE Instances Dynamic Group> to manage serviceconnectors in compartment id <ONM Compartment OCID>
111+
Allow any-user to {LOG_ANALYTICS_LOG_GROUP_UPLOAD_LOGS} in compartment id <Compartment OCID> where all {request.principal.type='serviceconnector', request.principal.compartment.id='<Compartment OCID>'}
112+
113+
Allow service loganalytics to {VCN_READ,SUBNET_READ,LOAD_BALANCER_READ,CLUSTER_READ,VNIC_READ} in compartment id <OKE Compartment OCID>
114+
```
115+
116+
* Policy Statement for using tag namespaces. (*_Only required if defined tags are used_)
117+
```
118+
Allow dynamic-group <OKE Instances Dynamic Group> to use tag-namespaces in tenancy where any {target.tag-namespace.name='example-ns-1', target.tag-namespace.name='example-ns-2'}
119+
```
76120
</details>
77121
78122
### Installation instructions

charts/logan/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apiVersion: v2
55
name: oci-onm-logan
66
description: Charts for sending Kubernetes platform logs, compute logs, and Kubernetes Objects information to OCI Logging Analytics.
77
type: application
8-
version: 3.5.3
8+
version: 3.6.0
99
appVersion: "3.0.0"
1010

1111
dependencies:

charts/logan/templates/discovery-cronjob.yaml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ metadata:
1212
spec:
1313
schedule: {{ .Values.k8sDiscovery.objects.cronSchedule | quote }}
1414
startingDeadlineSeconds: 120
15-
concurrencyPolicy: Replace
15+
concurrencyPolicy: Forbid
1616
successfulJobsHistoryLimit: {{ .Values.k8sDiscovery.objects.successfulJobsHistoryLimit }}
1717
failedJobsHistoryLimit: {{ .Values.k8sDiscovery.objects.failedJobsHistoryLimit }}
1818
jobTemplate:
1919
spec:
2020
backoffLimit: {{ .Values.k8sDiscovery.objects.backoffLimit }}
21+
activeDeadlineSeconds: 600
2122
template:
2223
spec:
2324
restartPolicy: {{ .Values.k8sDiscovery.objects.restartPolicy }}
@@ -83,10 +84,6 @@ spec:
8384
- --oci_domain
8485
- {{ .Values.ociDomain }}
8586
{{- end }}
86-
{{- if .Values.k8sDiscovery.objects.discoveryMode }}
87-
- --discovery
88-
- {{ .Values.k8sDiscovery.objects.discoveryMode }}
89-
{{- end }}
9087
{{- if .Values.k8sDiscovery.objects.log_format }}
9188
- --log_format
9289
- {{ .Values.k8sDiscovery.objects.log_format }}
@@ -107,6 +104,33 @@ spec:
107104
{{- if .Values.k8sDiscovery.objects.collect_warning_events_only }}
108105
- --collect_warning_events_only
109106
{{- end }}
107+
{{- /* Infra Discovery */}}
108+
{{- if eq .Values.k8sDiscovery.infra.enable_service_log true }}
109+
- --enable_service_log
110+
{{- if eq .Values.k8sDiscovery.infra.probe_all_compartments true }}
111+
{{- if .Values.k8sDiscovery.infra.tenancy_ocid }}
112+
- --probe_all_compartments
113+
- --tenancy_ocid
114+
- {{ .Values.k8sDiscovery.infra.tenancy_ocid | quote }}
115+
{{- else -}}
116+
{{- required "tenancy ocid must be set when probe_all_compartments is set as true" .Values.k8sDiscovery.infra.tenancy_ocid }}
117+
{{- end }}
118+
{{- end }}
119+
{{- if .Values.k8sDiscovery.infra.oci_tags_base64 }}
120+
- --oci_tags_base64
121+
- {{ .Values.k8sDiscovery.infra.oci_tags_base64 }}
122+
{{- end }}
123+
{{- if .Values.k8sDiscovery.infra.rms_template_base64_encoded }}
124+
- --rms_template_base64_encoded
125+
- {{ .Values.k8sDiscovery.infra.rms_template_base64_encoded }}
126+
{{- else }}
127+
{{- required "rms_template_base64_encoded is required" .Values.k8sDiscovery.infra.rms_template_base64_encoded }}
128+
{{- end }}
129+
{{- if .Values.k8sDiscovery.infra.stack_operation_timeout }}
130+
- --stack_operation_timeout
131+
- {{ .Values.k8sDiscovery.infra.stack_operation_timeout | quote }}
132+
{{- end }}
133+
{{- end }}
110134
{{- /* optional kubernetes cluster configuration */}}
111135
{{- if .Values.k8sDiscovery.kubeClientOptions.kubernetes_url }}
112136
- --kubernetes_url
@@ -150,4 +174,4 @@ spec:
150174
sources:
151175
- secret:
152176
name: {{ $resourceNamePrefix }}-oci-config
153-
{{- end }}
177+
{{- end }}

0 commit comments

Comments
 (0)