oci-logging-analytics-kubernetes-discovery 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1199ab8d0ac81fc5f30f69f908205ae7e8a7e1eb1142310eb8532a581a8036c
4
- data.tar.gz: 02131efa98c4ce38ec97c9e32c28942be9357720e1c894914c6630b4dd8062db
3
+ metadata.gz: c681f69e69d4781e9512102c5d998ae72b9a333c737ce5c9a2cd0ee977ba197b
4
+ data.tar.gz: f58899a4cfb6d93fe430adb699292e79f93c81a168a92629f8fcbdab166f413c
5
5
  SHA512:
6
- metadata.gz: 50726236669da194d7bb92fccb9d1aa77cfbfba6f181d194485050d8475457d3f4046e87fbc4a87a52e4e263ebf3cf837390f8e34fa271599a2910e3a8cf0aa8
7
- data.tar.gz: 01bcb89ce5ddea1f0a3ca4ae365bf7f337c597d5256243709234215aaf49a1ba0488d2baaca0f0f394eceefeb752a016dece5581866235afd9e4984932fbd63c
6
+ metadata.gz: 1cc3c0c11b29e3decf0eb55da47f17436c5f577307070599c8eff6afa09e934ce723e4f08f601e03040db3bbb7607c729360659645579d4d76491bc913b3933a
7
+ data.tar.gz: 45f3dd949edda1f114c67ad372b4955c9b185b4f4b83ffe35d9bce12beb9098b5db3622d39c0e8f22feaeefbeadab9c1352f03ef4dd56e890a191acd9fd4d6ac
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ logan-kubernetes-discovery
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-3.1.5
data/.travis.yml CHANGED
@@ -2,5 +2,6 @@
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.7.0
6
- before_install: gem install bundler -v 2.1.2
5
+ - 3.0.0
6
+ - 3.1.5
7
+ before_install: gem install bundler -v 2.3.27
data/README.md CHANGED
@@ -6,6 +6,8 @@ A rubygem for discovering Kubernetes resources and send it to OCI Log Analytics.
6
6
 
7
7
  ## Installation
8
8
 
9
+ Requires Ruby 3.0 or newer.
10
+
9
11
  Add this line to your application's Gemfile:
10
12
 
11
13
  ```ruby
@@ -115,6 +115,13 @@ begin
115
115
  end
116
116
  end
117
117
 
118
+ # Valid oci_domain format check
119
+ unless auth_config[:oci_domain].nil?
120
+ unless auth_config[:oci_domain].match?(/^[a-z0-9-]+\.oci\.[a-z0-9.]+[a-z0-9]$/i)
121
+ raise OptionParser::InvalidOption, "--oci_domain '#{auth_config[:oci_domain]}' | " \
122
+ "expected format: <region>.oci.<domain> (e.g., us-ashburn-1.oci.oraclecloud.com)"
123
+ end
124
+ end
118
125
  # If threads are enabled, thread count and queue size should be provided as arguments.
119
126
  if app_config[:enable_threading] && app_config[:thread_count].nil?
120
127
  raise OptionParser::MissingArgument, '--thread_count'
@@ -164,10 +171,12 @@ cluster_config[:oci_la_cluster_entity_id] = cluster_config[:oci_la_cluster_entit
164
171
  cluster_config[:kubernetes_resourcename_prefix] = cluster_config[:kubernetes_resourcename_prefix] ||= 'oci-onm'
165
172
 
166
173
  # OCI Auth Type
167
- if !auth_config[:config_file_location].nil?
168
- auth_config[:auth_type] = auth_config[:auth_type] ||= Enum::AuthTypeEnum::CONFIG
169
- else
170
- auth_config[:auth_type] = auth_config[:auth_type] ||= Enum::AuthTypeEnum::INSTANCE_PRINCIPAL
174
+ if auth_config[:auth_type].nil?
175
+ if !auth_config[:config_file_location].nil?
176
+ auth_config[:auth_type] = Enum::AuthTypeEnum::CONFIG
177
+ else
178
+ auth_config[:auth_type] = Enum::AuthTypeEnum::INSTANCE_PRINCIPAL
179
+ end
171
180
  end
172
181
 
173
182
  # OCI Domain
@@ -0,0 +1,24 @@
1
+ ## Copyright (c) 2026 Oracle and/or its affiliates.
2
+ ## The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
3
+
4
+ require 'oci'
5
+
6
+ module OciDiscoveryCompat
7
+ module CycleModesAsStrings
8
+ def swagger_types
9
+ types = super
10
+
11
+ # OCI SDK 2.22.0 through 2.24.0 reference a CycleMode class that does
12
+ # not exist. Cycle modes are enum strings in the API response.
13
+ if types[:cycle_modes] == :'Array<OCI::ContainerEngine::Models::CycleMode>'
14
+ types.merge(cycle_modes: :'Array<String>')
15
+ else
16
+ types
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ OCI::ContainerEngine::Models::NodePoolCyclingDetails
23
+ .singleton_class
24
+ .prepend(OciDiscoveryCompat::CycleModesAsStrings)
@@ -5,6 +5,6 @@ module Enum
5
5
  module AuthTypeEnum
6
6
  CONFIG = 'config'.freeze
7
7
  INSTANCE_PRINCIPAL = 'instance_principal'.freeze
8
- # OKE_WORKLOAD_IDENTITY = 'oke_workload_identity'.freeze
8
+ OKE_WORKLOAD_IDENTITY = 'oke_workload_identity'.freeze
9
9
  end
10
10
  end
@@ -2,6 +2,7 @@
2
2
  ## The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
3
3
 
4
4
  require 'oci'
5
+ require_relative '../compat/oci_cycle_modes'
5
6
 
6
7
  require_relative '../util/logging'
7
8
  require_relative '../enum/auth_type_enum'
@@ -14,7 +15,7 @@ module Util
14
15
  module_function
15
16
 
16
17
  attr_accessor :oci_clients, :ce_client, :id_client, :lb_client, :la_client, :rs_client,
17
- :vcn_client, :oci_config, :instance_principals_signer, :la_endpoint,
18
+ :vcn_client, :oci_config, :instance_principals_signer, :workload_identity_signer , :la_endpoint,
18
19
  :auth_type, :auth_config_object, :oci_domain, :oci_retry_config, :oci_region
19
20
 
20
21
  # This must be the first method called before any other method
@@ -56,8 +57,38 @@ module Util
56
57
  )
57
58
  end
58
59
  @oci_region = @instance_principals_signer.region
59
- # elsif @auth_type == Enum::AuthTypeEnum::OKE_WORKLOAD_IDENTITY
60
- # @workload_identity_signer = OCI::Auth::Signers::oke_workload_resource_principal_signer
60
+ elsif @auth_type == Enum::AuthTypeEnum::OKE_WORKLOAD_IDENTITY
61
+ @oci_config = OCI::Config.new
62
+ @workload_identity_signer = OCI::Auth::Signers.oke_workload_resource_principal_signer
63
+ if !@oci_domain.nil?
64
+ region_match = @oci_domain.match(/^([a-z0-9-]+)\.oci\./i)
65
+ if region_match
66
+ @oci_region = region_match[1]
67
+ logger.info("Extracted region from domain: #{@oci_region}")
68
+ else
69
+ raise StandardError, "Invalid oci_domain format: '#{@oci_domain}'. " \
70
+ "Expected: <region>.oci.<domain> (e.g., us-ashburn-1.oci.oraclecloud.com)"
71
+ end
72
+ else
73
+ begin
74
+ tmp_signer = OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner.new
75
+ if tmp_signer.region
76
+ @oci_region = tmp_signer.region
77
+ logger.info("extracted region from IMDS: #{@oci_region}")
78
+ else
79
+ raise StandardError, "IMDS returned nil region. " \
80
+ "Provide --oci_domain parameter (e.g., us-ashburn-1.oci.oraclecloud.com)."
81
+ end
82
+ rescue StandardError => e
83
+ raise
84
+ rescue => e
85
+ raise StandardError, "Unable to determine region. " \
86
+ "IMDS not available: #{e.message}. " \
87
+ "Provide --oci_domain parameter (e.g., us-ashburn-1.oci.oraclecloud.com)."
88
+ end
89
+ end
90
+ @oci_config.region = @oci_region
91
+
61
92
  elsif @auth_type == Enum::AuthTypeEnum::CONFIG
62
93
  @oci_config = OCI::ConfigFileLoader.load_config(config_file_location: auth_config_hash[:config_file_location],
63
94
  profile_name: auth_config_hash[:profile_name])
@@ -132,6 +163,11 @@ module Util
132
163
  config: @oci_config, endpoint: endpoint,
133
164
  signer: @instance_principals_signer,
134
165
  retry_config: retry_config)
166
+ when Enum::AuthTypeEnum::OKE_WORKLOAD_IDENTITY
167
+ client = OCI::ContainerEngine::ContainerEngineClient.new(
168
+ config: @oci_config, endpoint: endpoint,
169
+ signer: @workload_identity_signer,
170
+ retry_config: retry_config)
135
171
  else
136
172
  logger.warn("Unknown auth_type '#{@auth_type}' provided for container engine client.")
137
173
  end
@@ -159,6 +195,8 @@ module Util
159
195
  client = OCI::Identity::IdentityClient.new(config: @oci_config, endpoint: endpoint, retry_config: retry_config)
160
196
  when Enum::AuthTypeEnum::INSTANCE_PRINCIPAL
161
197
  client = OCI::Identity::IdentityClient.new(config: @oci_config, endpoint: endpoint, signer: @instance_principals_signer, retry_config: retry_config)
198
+ when Enum::AuthTypeEnum::OKE_WORKLOAD_IDENTITY
199
+ client = OCI::Identity::IdentityClient.new(config: @oci_config, endpoint: endpoint, signer: @workload_identity_signer, retry_config: retry_config)
162
200
  else
163
201
  logger.warn("Unknown auth_type '#{@auth_type}' provided for identity client.")
164
202
  end
@@ -186,6 +224,8 @@ module Util
186
224
  client = OCI::LoadBalancer::LoadBalancerClient.new(config: @oci_config, endpoint: endpoint, retry_config: retry_config)
187
225
  when Enum::AuthTypeEnum::INSTANCE_PRINCIPAL
188
226
  client = OCI::LoadBalancer::LoadBalancerClient.new(config: @oci_config, endpoint: endpoint, signer: @instance_principals_signer, retry_config: retry_config)
227
+ when Enum::AuthTypeEnum::OKE_WORKLOAD_IDENTITY
228
+ client = OCI::LoadBalancer::LoadBalancerClient.new(config: @oci_config, endpoint: endpoint, signer: @workload_identity_signer, retry_config: retry_config)
189
229
  else
190
230
  logger.warn("Unknown auth_type '#{@auth_type}' provided for load balancer client.")
191
231
  end
@@ -221,6 +261,11 @@ module Util
221
261
  endpoint: endpoint,
222
262
  signer: @instance_principals_signer,
223
263
  retry_config: retry_config)
264
+ when Enum::AuthTypeEnum::OKE_WORKLOAD_IDENTITY
265
+ client = OCI::LogAnalytics::LogAnalyticsClient.new(config: @oci_config,
266
+ endpoint: endpoint,
267
+ signer: @workload_identity_signer,
268
+ retry_config: retry_config)
224
269
  else
225
270
  logger.warn("Unknown auth_type while creating log analytics client: #{@auth_type}")
226
271
  raise StandardError, 'Unknown auth_type for log analytics client.'
@@ -252,6 +297,8 @@ module Util
252
297
  client = OCI::ResourceSearch::ResourceSearchClient.new(config: @oci_config, endpoint: endpoint, retry_config: retry_config)
253
298
  when Enum::AuthTypeEnum::INSTANCE_PRINCIPAL
254
299
  client = OCI::ResourceSearch::ResourceSearchClient.new(config: @oci_config, endpoint: endpoint, signer: @instance_principals_signer, retry_config: retry_config)
300
+ when Enum::AuthTypeEnum::OKE_WORKLOAD_IDENTITY
301
+ client = OCI::ResourceSearch::ResourceSearchClient.new(config: @oci_config, endpoint: endpoint, signer: @workload_identity_signer, retry_config: retry_config)
255
302
  else
256
303
  logger.warn("Unknown auth_type '#{@auth_type}' provided for resource search client.")
257
304
  end
@@ -284,6 +331,8 @@ module Util
284
331
  client = OCI::Core::VirtualNetworkClient.new(config: @oci_config, endpoint: endpoint, retry_config: retry_config)
285
332
  when Enum::AuthTypeEnum::INSTANCE_PRINCIPAL
286
333
  client = OCI::Core::VirtualNetworkClient.new(config: @oci_config, endpoint: endpoint, signer: @instance_principals_signer, retry_config: retry_config)
334
+ when Enum::AuthTypeEnum::OKE_WORKLOAD_IDENTITY
335
+ client = OCI::Core::VirtualNetworkClient.new(config: @oci_config, endpoint: endpoint, signer: @workload_identity_signer, retry_config: retry_config)
287
336
  else
288
337
  logger.warn("Unknown auth_type '#{@auth_type}' provided for virtual network client.")
289
338
  end
@@ -317,6 +366,11 @@ module Util
317
366
  endpoint: endpoint,
318
367
  signer: @instance_principals_signer,
319
368
  retry_config: retry_config)
369
+ when Enum::AuthTypeEnum::OKE_WORKLOAD_IDENTITY
370
+ client = OCI::ResourceManager::ResourceManagerClient.new(config: @oci_config,
371
+ endpoint: endpoint,
372
+ signer: @workload_identity_signer,
373
+ retry_config: retry_config)
320
374
  else
321
375
  logger.warn("Unknown auth_type '#{auth_object[:auth_type]}' provided for resource manager client.")
322
376
  end
@@ -338,7 +392,7 @@ module Util
338
392
  oci_config: @oci_config,
339
393
  la_endpoint: @la_endpoint,
340
394
  instance_principals_signer: @instance_principals_signer,
341
- # workload_identity_signer: @workload_identity_signer,
395
+ workload_identity_signer: @workload_identity_signer,
342
396
  auth_type: @auth_type,
343
397
  oci_domain: @oci_domain
344
398
  }.compact
data/lib/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  ## The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
3
3
 
4
4
  module Discovery
5
- VERSION = '1.3.0'.freeze
5
+ VERSION = '1.5.0'.freeze
6
6
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.bindir = 'bin'
28
28
  spec.executables << 'oci-loganalytics-kubernetes-discovery'
29
29
  spec.require_paths = ['lib']
30
- spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
30
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0')
31
31
 
32
32
  spec.add_development_dependency 'bundler', '~> 2.3.3'
33
33
  spec.add_development_dependency 'forking_test_runner', '~> 1.13.0'
@@ -45,6 +45,6 @@ Gem::Specification.new do |spec|
45
45
  spec.add_runtime_dependency 'concurrent-ruby', '~> 1.2', '>= 1.2.2'
46
46
  spec.add_runtime_dependency 'kubeclient', '~> 4.9', '>= 4.9.3'
47
47
  spec.add_runtime_dependency 'oci', '~> 2.21'
48
- spec.add_runtime_dependency 'rubyzip', '~> 2.3.2'
48
+ spec.add_runtime_dependency 'rubyzip', '~> 3.7.0'
49
49
  spec.add_runtime_dependency 'yajl-ruby', '~> 1.0'
50
50
  end
data/ocibuild.conf CHANGED
@@ -22,11 +22,8 @@ steps:
22
22
  type: publishgeneric
23
23
  dependsOn: ruby_install
24
24
  repository: logan-release-gems-local
25
- filePathsToPublish [
26
- {
27
- localFile: "*.gem",
28
- targetDir: "gem/"
29
- }
30
- ]
25
+ filesToPublish: [
26
+ "*.gem"
27
+ ]
31
28
  }
32
29
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oci-logging-analytics-kubernetes-discovery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oracle
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2026-02-11 00:00:00.000000000 Z
12
+ date: 2026-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -239,14 +239,14 @@ dependencies:
239
239
  requirements:
240
240
  - - "~>"
241
241
  - !ruby/object:Gem::Version
242
- version: 2.3.2
242
+ version: 3.7.0
243
243
  type: :runtime
244
244
  prerelease: false
245
245
  version_requirements: !ruby/object:Gem::Requirement
246
246
  requirements:
247
247
  - - "~>"
248
248
  - !ruby/object:Gem::Version
249
- version: 2.3.2
249
+ version: 3.7.0
250
250
  - !ruby/object:Gem::Dependency
251
251
  name: yajl-ruby
252
252
  requirement: !ruby/object:Gem::Requirement
@@ -271,6 +271,8 @@ extensions: []
271
271
  extra_rdoc_files: []
272
272
  files:
273
273
  - ".gitignore"
274
+ - ".ruby-gemset"
275
+ - ".ruby-version"
274
276
  - ".travis.yml"
275
277
  - Gemfile
276
278
  - LICENSE.txt
@@ -280,6 +282,7 @@ files:
280
282
  - bin/console
281
283
  - bin/oci-loganalytics-kubernetes-discovery
282
284
  - bin/setup
285
+ - lib/compat/oci_cycle_modes.rb
283
286
  - lib/config/oci_client_retry_config.rb
284
287
  - lib/discover/infrastructure.rb
285
288
  - lib/discover/object.rb
@@ -325,7 +328,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
325
328
  requirements:
326
329
  - - ">="
327
330
  - !ruby/object:Gem::Version
328
- version: 2.7.0
331
+ version: 3.0.0
329
332
  required_rubygems_version: !ruby/object:Gem::Requirement
330
333
  requirements:
331
334
  - - ">="