Skip to content

Commit e1662a5

Browse files
Custom Domain Input; OKE Status check; Optional Custom input before helm install (#98)
Custom Domain Input; OKE Status check; Optional Custom input before helm install
1 parent da250d7 commit e1662a5

25 files changed

+285
-45
lines changed

CHANGELOG.md

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

3+
## 2024-11-20
4+
### Added
5+
- Support for new OCI Regions which are not yet supported through OCI Ruby SDK by default.
6+
- Status check for OKE lifecycle state to be active before installing helm chart, when installed using RMS.
7+
- An option to apply a static delay before installing helm chart, when installed using RMS.
8+
39
## 2024-11-05
410
### Added
511
- Support of extraEnv for Management Agent

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.1
8+
version: 3.5.2
99
appVersion: "3.0.0"
1010

1111
dependencies:

charts/logan/templates/discovery-cronjob.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,18 @@ spec:
7171
{{- end }}
7272
{{- end }}
7373
{{- /* optional discovery job configuration */}}
74-
{{- if and .Values.ociLAClusterEntityID $resourceNamePrefix }}
74+
{{- if .Values.ociLAClusterEntityID }}
7575
- --oci_la_cluster_entity_id
7676
- {{ .Values.ociLAClusterEntityID }}
77+
{{- end }}
78+
{{- if $resourceNamePrefix }}
7779
- --kubernetes_resourcename_prefix
7880
- {{ $resourceNamePrefix }}
7981
{{- end }}
82+
{{- if .Values.ociDomain }}
83+
- --oci_domain
84+
- {{ .Values.ociDomain }}
85+
{{- end }}
8086
{{- if .Values.k8sDiscovery.objects.discoveryMode }}
8187
- --discovery
8288
- {{ .Values.k8sDiscovery.objects.discoveryMode }}

charts/logan/templates/ekscp-logs-configmap.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ data:
290290
config_file_location {{ $.Values.oci.path }}/{{ $.Values.oci.file }}
291291
profile_name "{{ $.Values.fluentd.ociLoggingAnalyticsOutputPlugin.profile_name }}"
292292
{{- end }}
293+
{{- if $.Values.ociDomain }}
294+
oci_domain "{{ $.Values.ociDomain }}"
295+
{{- end }}
293296
plugin_log_location "{{ $.Values.fluentd.baseDir }}"
294297
plugin_log_level "{{ $.Values.fluentd.ociLoggingAnalyticsOutputPlugin.plugin_log_level }}"
295298
plugin_log_file_size "{{ $.Values.fluentd.ociLoggingAnalyticsOutputPlugin.plugin_log_file_size }}"

charts/logan/templates/logs-configmap.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,9 @@ data:
609609
config_file_location {{ $.Values.oci.path }}/{{ $.Values.oci.file }}
610610
profile_name "{{ $.Values.fluentd.ociLoggingAnalyticsOutputPlugin.profile_name }}"
611611
{{- end }}
612+
{{- if $.Values.ociDomain }}
613+
oci_domain "{{ $.Values.ociDomain }}"
614+
{{- end }}
612615
plugin_log_location "{{ $.Values.fluentd.baseDir }}"
613616
plugin_log_level "{{ $.Values.fluentd.ociLoggingAnalyticsOutputPlugin.plugin_log_level }}"
614617
plugin_log_file_size "{{ $.Values.fluentd.ociLoggingAnalyticsOutputPlugin.plugin_log_file_size }}"

charts/logan/values.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ runtime: cri
3535
# -- Allowed values: InstancePrincipal, config
3636
authtype: InstancePrincipal
3737

38+
# This parameter is required only for realms where the OCI Ruby SDK is not supported.
39+
# Format: <oci-region>.oci.<oci_domain>
40+
# Example: us-ashburn-1.oci.oraclecloud.com
41+
ociDomain:
42+
3843
# -- Kubernetes Namespace for deploying monitoring resources deployed by this chart.
3944
namespace: "{{ .Values.global.namespace }}"
4045

@@ -48,7 +53,7 @@ image:
4853
# Image pull secrets for. Secret must be in the namespace defined by namespace
4954
imagePullSecrets:
5055
# -- Replace this value with actual docker image url
51-
url: container-registry.oracle.com/oci_observability_management/oci-la-fluentd-collector:1.5.1
56+
url: container-registry.oracle.com/oci_observability_management/oci-la-fluentd-collector:1.5.2
5257
# -- Image pull policy
5358
imagePullPolicy: Always
5459

charts/oci-onm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies:
3232
repository: "file://../common"
3333
condition: oci-onm-common.enabled
3434
- name: oci-onm-logan
35-
version: "3.5.1"
35+
version: "3.5.2"
3636
repository: "file://../logan"
3737
condition: oci-onm-logan.enabled
3838
- name: oci-onm-mgmt-agent

charts/oci-onm/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@ oci-onm-logan:
3131
kubernetesClusterID: "{{ .Values.global.kubernetesClusterID }}"
3232
kubernetesClusterName: "{{ .Values.global.kubernetesClusterName }}"
3333
image:
34-
url: container-registry.oracle.com/oci_observability_management/oci-la-fluentd-collector:1.5.1
34+
url: container-registry.oracle.com/oci_observability_management/oci-la-fluentd-collector:1.5.2
3535
# Go to OCI Logging Analytics Administration, click Service Details, and note the namespace value.
3636
ociLANamespace:
3737
# OCI Logging Analytics Default Log Group OCID
3838
ociLALogGroupID:
3939
# OCI Logging Analytics Entity OCID representing the target cluster
4040
ociLAClusterEntityID:
41+
# This parameter is required only for realms where the OCI Ruby SDK is not supported.
42+
# Format: <oci-region>.oci.<oci_domain>
43+
# Example: us-ashburn-1.oci.oraclecloud.com
44+
ociDomain:
4145

4246
oci-onm-mgmt-agent:
4347
oci-onm-common:

terraform/modules/helm/helm-inputs.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ variable "livelab_service_account" {
109109
default = ""
110110
}
111111

112+
####
113+
## OCI Client Config
114+
####
115+
116+
# OCI domain
117+
variable "oci_domain" {
118+
type = string
119+
default = null
120+
}
121+
112122
####
113123
## Others
114124
####

terraform/modules/helm/helm-outputs.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ locals {
55
cmd_1_helm_repo_add = "helm repo add oci-onm https://oracle-quickstart.github.io/oci-kubernetes-monitoring"
66
cmd_2_helm_repo_update = "helm repo update"
77

8-
cmd_3_helm_install = join(" ", [
8+
cmd_3_layer_0 = join(" ", [
99
"helm install oci-kubernetes-monitoring oci-onm/oci-onm",
1010
"--set global.namespace=${var.kubernetes_namespace}",
1111
"--set global.kubernetesClusterID=${var.kubernetes_cluster_id}",
@@ -16,6 +16,10 @@ locals {
1616
"--set oci-onm-mgmt-agent.deployMetricServer=${var.opt_deploy_metric_server}",
1717
"--set oci-onm-mgmt-agent.mgmtagent.installKeyFileContent=${var.mgmt_agent_install_key_content}"
1818
])
19+
20+
cmd_3_layer_1 = var.oci_domain == null ? local.cmd_3_layer_0 : "${local.cmd_3_layer_0} --set oci-onm-logan.ociDomain=${var.oci_domain}"
21+
22+
cmd_3_helm_install = local.cmd_3_layer_1
1923
}
2024

2125
# Helm release artifacts for local testing and validation.

terraform/modules/helm/helm.tf

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ locals {
2929
"oci-onm-mgmt-agent.mgmtagent.installKeyFileContent" = var.mgmt_agent_install_key_content
3030
"oci-onm-mgmt-agent.deployMetricServer" = var.opt_deploy_metric_server
3131
}
32-
33-
mushop_helm_inputs = {
34-
# oci-onm-logan
35-
"createServiceAccount" = false
36-
"serviceAccount" = var.livelab_service_account
37-
}
3832
}
3933

4034
# Create helm release
@@ -59,7 +53,7 @@ resource "helm_release" "oci-kubernetes-monitoring" {
5953
}
6054

6155
dynamic "set" {
62-
for_each = var.deploy_mushop_config ? local.mushop_helm_inputs : {}
56+
for_each = var.oci_domain == null ? {} : { "oci-onm-logan.ociDomain" = var.oci_domain }
6357
content {
6458
name = set.key
6559
value = set.value
@@ -90,7 +84,7 @@ data "helm_template" "oci-kubernetes-monitoring" {
9084
}
9185

9286
dynamic "set" {
93-
for_each = var.deploy_mushop_config ? local.mushop_helm_inputs : {}
87+
for_each = var.oci_domain == null ? {} : { "oci-onm-logan.ociDomain" = var.oci_domain }
9488
content {
9589
name = set.key
9690
value = set.value

terraform/modules/logan/logan.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ resource "oci_log_analytics_log_analytics_entity" "oke_entity" {
8787
freeform_tags = var.tags.freeformTags
8888

8989
lifecycle {
90-
ignore_changes = [name, metadata, defined_tags, freeform_tags, ]
90+
ignore_changes = [name, metadata, defined_tags, freeform_tags]
9191
# Not a User Facing Error
9292
precondition {
9393
condition = !(var.new_entity_name == null && var.oke_entity_ocid == null)

terraform/modules/main/developer-options.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
## Leave it to default for production use
77
####
88

9-
# Enable/Disable livelab module
10-
variable "toggle_livelab_module" {
11-
type = bool
12-
default = true
13-
}
14-
159
# Enable/Disable helm module
1610
variable "toggle_helm_module" {
1711
type = bool

terraform/modules/main/main-inputs.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ variable "kubernetes_namespace" {
124124
default = "oci-onm"
125125
}
126126

127+
# OCI domain
128+
variable "oci_domain" {
129+
type = string
130+
default = null
131+
}
132+
127133
# Kubernetes Cluster OCID
128134
variable "kubernetes_cluster_id" {
129135
type = string

terraform/modules/main/main.tf

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ module "helm_release" {
128128
mgmt_agent_install_key_content = module.management_agent[0].mgmt_agent_install_key_content
129129
opt_deploy_metric_server = var.opt_deploy_metric_server
130130
fluentd_base_dir_path = var.fluentd_base_dir_path
131-
# livelab_service_account = local.livelab_service_account
131+
oci_domain = var.oci_domain
132132
}
133133

134134
# Import Kubernetes Dashboards
@@ -140,18 +140,3 @@ module "import_kubernetes_dashboards" {
140140
debug = var.debug
141141
tags = var.tags
142142
}
143-
144-
# // Only execute for livelab stack
145-
# // livelab module only supports local users
146-
# // it will error out when an identity domain user is used and livelab_switch is set as true
147-
# module "livelab" {
148-
# source = "./modules/livelab"
149-
# current_user_ocid = var.current_user_ocid
150-
# debug = var.debug
151-
152-
# count = local.module_controls_enable_livelab_module ? 1 : 0
153-
154-
# /* providers = {
155-
# oci = oci.home_region
156-
# } */
157-
# }

terraform/oke/providers.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ data "oci_identity_regions" "region_map" {
4141

4242
data "oci_containerengine_cluster_kube_config" "oke" {
4343
cluster_id = var.oke_cluster_ocid
44+
depends_on = [null_resource.wait-for-oke-active-status[0]]
4445
}
4546

4647
provider "oci" {
@@ -74,4 +75,6 @@ provider "helm" {
7475
}
7576
}
7677

77-
provider "local" {}
78+
provider "local" {}
79+
80+
provider "external" {}

terraform/oke/resources/metadata.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# Copyright (c) 2024, Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
set -e
5+
curl -H "Authorization: Bearer Oracle" -sL http://169.254.169.254/opc/v2/instance/ | jq .regionInfo
6+
# example output =>
7+
# echo '{
8+
# "realmDomainComponent": "oraclecloud.com",
9+
# "realmKey": "oc1",
10+
# "regionIdentifier": "us-phoenix-1",
11+
# "regionKey": "PHX"
12+
# }'
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
# Copyright (c) 2024, Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
############################################################
6+
##
7+
## Check the lifecycle-state of OKE cluster [$OKE_OCID]
8+
## every $CHECK_INTERVAL seconds
9+
## untill
10+
## - lifecycle state is "ACTIVE"
11+
## or
12+
## - time limit $WAIT_TIME is breached
13+
##
14+
## exit with status 0, iff lifecycle-state is "ACTIVE",
15+
## otherwise exit with status 1
16+
##
17+
############################################################
18+
19+
# Exit on error
20+
set -e
21+
22+
# Inputs from ENV is preferred over CLI
23+
if [ -z "${WAIT_TIME}" ]; then WAIT_TIME=$1; fi
24+
if [ -z "${CHECK_INTERVAL}" ]; then CHECK_INTERVAL=$2; fi
25+
if [ -z "${OKE_OCID}" ]; then OKE_OCID=$3; fi
26+
27+
timer=0
28+
29+
while true;
30+
do
31+
oke_status=$(oci ce cluster get --cluster-id "$OKE_OCID" --query 'data."lifecycle-state"' --raw-output)
32+
echo -e "OKE status: $oke_status"
33+
34+
if [[ "$oke_status" == "ACTIVE" ]]; then
35+
echo -e "Returning with success."
36+
break;
37+
fi
38+
39+
echo -e "Next check scheduled after seconds: $CHECK_INTERVAL"
40+
sleep "$CHECK_INTERVAL"
41+
42+
(( timer = timer + CHECK_INTERVAL ))
43+
if [ $timer -ge "$WAIT_TIME" ]; then
44+
echo -e "Timeout limit breached: $WAIT_TIME"
45+
echo -e "ERROR: OKE status is not ACTIVE."
46+
exit 1
47+
fi
48+
done
49+
50+
exit 0

terraform/oke/ruby_sdk_regions.tf

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
# source: https://github.com/oracle/oci-ruby-sdk/blob/v2.21.1/lib/oci/regions_definitions.rb
3+
# ruby SDK version: 2.21.1
4+
locals {
5+
ruby_sdk_supported_regions = [
6+
"ap-chuncheon-1",
7+
"ap-hyderabad-1",
8+
"ap-melbourne-1",
9+
"ap-mumbai-1",
10+
"ap-osaka-1",
11+
"ap-seoul-1",
12+
"ap-sydney-1",
13+
"ap-tokyo-1",
14+
"ca-montreal-1",
15+
"ca-toronto-1",
16+
"eu-amsterdam-1",
17+
"eu-frankfurt-1",
18+
"eu-zurich-1",
19+
"me-jeddah-1",
20+
"me-dubai-1",
21+
"sa-saopaulo-1",
22+
"uk-cardiff-1",
23+
"uk-london-1",
24+
"us-ashburn-1",
25+
"us-phoenix-1",
26+
"us-sanjose-1",
27+
"sa-vinhedo-1",
28+
"sa-santiago-1",
29+
"il-jerusalem-1",
30+
"eu-marseille-1",
31+
"ap-singapore-1",
32+
"me-abudhabi-1",
33+
"eu-milan-1",
34+
"eu-stockholm-1",
35+
"af-johannesburg-1",
36+
"eu-paris-1",
37+
"mx-queretaro-1",
38+
"eu-madrid-1",
39+
"us-chicago-1",
40+
"mx-monterrey-1",
41+
"us-saltlake-2",
42+
"sa-bogota-1",
43+
"sa-valparaiso-1",
44+
"us-langley-1",
45+
"us-luke-1",
46+
"us-gov-ashburn-1",
47+
"us-gov-chicago-1",
48+
"us-gov-phoenix-1",
49+
"uk-gov-london-1",
50+
"uk-gov-cardiff-1",
51+
"ap-chiyoda-1",
52+
"ap-ibaraki-1",
53+
"me-dcc-muscat-1",
54+
"ap-dcc-canberra-1",
55+
"eu-dcc-milan-1",
56+
"eu-dcc-milan-2",
57+
"eu-dcc-dublin-2",
58+
"eu-dcc-rating-2",
59+
"eu-dcc-rating-1",
60+
"eu-dcc-dublin-1",
61+
"ap-dcc-gazipur-1",
62+
"eu-madrid-2",
63+
"eu-frankfurt-2",
64+
"eu-jovanovac-1",
65+
"me-dcc-doha-1",
66+
"eu-dcc-zurich-1",
67+
"me-abudhabi-3"
68+
]
69+
}

0 commit comments

Comments
 (0)