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 +4 -4
- data/Makefile +13 -0
- data/Rakefile +1 -1
- data/lib/discover/object.rb +26 -2
- data/lib/dto/kubernetes_objects_payload.rb +5 -3
- data/lib/oci_loganalytics_resources_discovery.rb +1 -1
- data/lib/version.rb +1 -1
- data/ocibuild.conf +29 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 358cc8651c1361741c8232f14c77c4d40aec7a9981a491c5b0f835baada853c6
|
4
|
+
data.tar.gz: deb40680dae588f0c26580679c2c4ff35afd941dfb14447ea8ec09e2ddbd4985
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/lib/discover/object.rb
CHANGED
@@ -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
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.
|
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-
|
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
|