oci-logging-analytics-kubernetes-discovery 1.1.0 → 1.2.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: 40cb1255cc1125f85989f0abea5d0c6afb113327ed376c5920e2c3bc05124807
4
- data.tar.gz: 2b7538d6052d87229aebdf934d51800e711d6da4017a9184c6bf0c3e236f3705
3
+ metadata.gz: 358cc8651c1361741c8232f14c77c4d40aec7a9981a491c5b0f835baada853c6
4
+ data.tar.gz: deb40680dae588f0c26580679c2c4ff35afd941dfb14447ea8ec09e2ddbd4985
5
5
  SHA512:
6
- metadata.gz: 889778a1de60813ec7c955b027f0b5668706d6484c980cf861a4c05de76b237043dcb47ff01a841aa191b1d8fcd90a47c45ce7652574f8c2fe614faabcd264e5
7
- data.tar.gz: e5d84ff26835e2102c0bc7b25f1b5e7aee4a49ac083c14c7e1d3d910af1e69dbfd97e9669cd6763b46a87661b8158c5217b10b7fe605a3ef4e8fff4a1cec8e1c
6
+ metadata.gz: a4cb5609901d156a1c1d792e60c352e30a1bcae3a777388dde13dbce966671982489263e954cc12ad2ce6e7061e7f066a04a8f8d9e7921c2bb0f4d7bafe9f1e8
7
+ data.tar.gz: 3e3f52a6ea9d8c7f2bf0e59b15aeb7525e8b0649b71bfb4bec6c1be31d2505a901b1e13260e4a51a9ded9112f5d3aae58a7fe39c9d001d042b9f825cc5004520
data/Makefile ADDED
@@ -0,0 +1,13 @@
1
+ # Makefile for installing Ruby and building the gem
2
+
3
+ ruby_install:
4
+ @echo "Setting up ruby..."
5
+ dnf install ruby
6
+ ruby -v
7
+ @echo "Ruby installation complete..."
8
+
9
+ @echo "Building gem..."
10
+ gem build oci-logging-analytics-kubernetes-discovery.gemspec
11
+
12
+ @echo "Build completed. Generated files:"
13
+ ls -la *.gem
data/Rakefile CHANGED
@@ -12,4 +12,4 @@ Rake::TestTask.new do |t|
12
12
 
13
13
  # If you want your tests to output what they should do, then set this to true.
14
14
  t.verbose = true
15
- end
15
+ end
@@ -21,7 +21,7 @@ module Discover
21
21
  End_point_slice = Struct.new(:name, :namespace, :uid, :endpoints, :ports)
22
22
  Job = Struct.new(:name, :namespace, :uid, :controller)
23
23
  Node = Struct.new(:name, :displayName, :uid, :internalIP, :externalIP)
24
- Pod = Struct.new(:name, :namespace, :uid, :podIP, :hostIP, :nodeIP, :controller, :phase, :startTime, :finishTime)
24
+ Pod = Struct.new(:name, :namespace, :uid, :podIP, :hostIP, :nodeIP, :controller, :phase, :startTime, :finishTime, :containerStartedAt)
25
25
  Replica_set = Struct.new(:name, :namespace, :uid, :controller)
26
26
  Service = Struct.new(:name, :namespace, :uid, :clusterIP, :externalIP, :loadBalancerIP, :serviceType, :ports)
27
27
  Namespace = Struct.new(:name, :uid)
@@ -201,6 +201,30 @@ module Discover
201
201
  hostIP = item[:status][:hostIP]
202
202
  nodeIP = item[:status][:nodeIP]
203
203
  phase = item[:status][:phase]
204
+
205
+ containerStartedAt = nil
206
+ begin
207
+ if !item[:status][:containerStatuses].nil? && !item[:status][:containerStatuses].empty?
208
+ containers = item[:status][:containerStatuses]
209
+ containers.each do |container|
210
+ next if container.nil?
211
+ if !container[:state].nil? && !container[:state].empty?
212
+ container[:state].each do |key, value|
213
+ if !value.nil? && value.is_a?(Hash) && !value[:startedAt].nil?
214
+ current_started_at_str = value[:startedAt]
215
+ if containerStartedAt.nil? ||
216
+ Time.parse(current_started_at_str) < Time.parse(containerStartedAt)
217
+ containerStartedAt = current_started_at_str
218
+ end
219
+ end
220
+ end
221
+ end
222
+ end
223
+ end
224
+ rescue StandardError => e
225
+ logger.warn("Error parsing containerStartedAt time: '#{e.message}'")
226
+ end
227
+
204
228
  startTime = item[:status][:startTime]
205
229
  controller = nil
206
230
  if !item[:metadata][:ownerReferences].nil? && !item[:metadata][:ownerReferences].empty?
@@ -223,7 +247,7 @@ module Discover
223
247
  end
224
248
  end
225
249
  processed_data.push(Pod.new(generic_object[:name], generic_object[:namespace], generic_object[:uid],
226
- podIP, hostIP, nodeIP, controller.to_h, phase, startTime, finishTime))
250
+ podIP, hostIP, nodeIP, controller.to_h, phase, startTime, finishTime, containerStartedAt))
227
251
  end
228
252
  rescue StandardError => e
229
253
  logger.error("Unable to fetch '#{resource_name}'")
@@ -10,11 +10,11 @@ module Dto
10
10
 
11
11
  attr_accessor :cluster, :nodes, :pods, :services, :endpointslices, :deployments,
12
12
  :replicasets, :daemonsets, :cronjobs, :jobs, :statefulsets, :events, :namespaces,
13
- :infra
13
+ :infra, :payloadCreationTime
14
14
 
15
15
  def initialize(cluster, nodes, pods, services, endpointslices, deployments,
16
16
  replicasets, daemonsets, cronjobs, jobs, statefulsets, events, namespaces,
17
- infra)
17
+ infra, payloadCreationTime)
18
18
  @cluster = cluster
19
19
  @nodes = nodes
20
20
  @pods = pods
@@ -29,6 +29,7 @@ module Dto
29
29
  @events = events
30
30
  @namespaces = namespaces
31
31
  @infra = infra
32
+ @payloadCreationTime = payloadCreationTime
32
33
  end
33
34
 
34
35
  def get_hash(obj, obj_name)
@@ -55,7 +56,8 @@ module Dto
55
56
  statefulsets: get_hash(@statefulsets, STATEFUL_SETS.to_s),
56
57
  events: get_hash(@events, EVENTS.to_s),
57
58
  namespaces: get_hash(@namespaces, NAMESPACES.to_s),
58
- infra: @infra.nil? ? nil : @infra.to_hash
59
+ infra: @infra.nil? ? nil : @infra.to_hash,
60
+ payloadCreationTime: @payloadCreationTime
59
61
  }.compact
60
62
  end
61
63
  end
@@ -115,7 +115,7 @@ module OciLogAnalyticsResourcesDiscovery
115
115
  combined_data = Dto::KubernetesObjectsPayLoad.new(
116
116
  processed_objects[:cluster], processed_objects[:nodes], processed_objects[:pods], processed_objects[:services], processed_objects[:endpoint_slices],
117
117
  processed_objects[:deployments], processed_objects[:replica_sets], processed_objects[:daemon_sets], processed_objects[:cron_jobs],
118
- processed_objects[:jobs], processed_objects[:stateful_sets], processed_objects[:events], processed_objects[:namespaces], infra_objects_payload
118
+ processed_objects[:jobs], processed_objects[:stateful_sets], processed_objects[:events], processed_objects[:namespaces], infra_objects_payload, @snapshot_id
119
119
  )
120
120
 
121
121
  logger.info('Combined discovery payload created.')
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.1.0'.freeze
5
+ VERSION = '1.2.0'.freeze
6
6
  end
data/ocibuild.conf ADDED
@@ -0,0 +1,29 @@
1
+ runnerTag: latest
2
+ name: logan-kubernetes-discovery
3
+ team: LOGAN
4
+ description: Build config to build Logging Analytics Kubernetes Discovery gem.
5
+ phoneBookId: logan
6
+ version: ${BLD_NUMBER}
7
+ authCompartmentOcid: ocid1.tenancy.oc1..aaaaaaaauj75yrhg54zor44qlc3chockspqc6e5c7nxlxjlcnunxo2hbs6ca
8
+ scheduleOnOl9Hosts: true
9
+ steps:
10
+ [
11
+ {
12
+ name: ruby_install
13
+ runnerImage: build-runner-make-ol9
14
+ type: make
15
+ makeCommands: [
16
+ { target: ruby_install }
17
+ ]
18
+ artifacts: ["**"]
19
+ },
20
+ {
21
+ name: publish-gem
22
+ type: publishgeneric
23
+ dependsOn: ruby_install
24
+ repository: logan-release-gems-local
25
+ filesToPublish: [
26
+ "*.gem"
27
+ ]
28
+ }
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.1.0
4
+ version: 1.2.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: 2025-03-11 00:00:00.000000000 Z
12
+ date: 2025-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -274,6 +274,7 @@ files:
274
274
  - ".travis.yml"
275
275
  - Gemfile
276
276
  - LICENSE.txt
277
+ - Makefile
277
278
  - README.md
278
279
  - Rakefile
279
280
  - bin/console
@@ -311,6 +312,7 @@ files:
311
312
  - lib/util/string_utils.rb
312
313
  - lib/version.rb
313
314
  - oci-logging-analytics-kubernetes-discovery.gemspec
315
+ - ocibuild.conf
314
316
  homepage: https://rubygems.org/gems/oci-logging-analytics-kubernetes-discovery
315
317
  licenses:
316
318
  - UPL-1.0