Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

adding props from raw #82

Merged
merged 5 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

1,829 changes: 246 additions & 1,583 deletions src/steps/images/__snapshots__/index.test.ts.snap

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/steps/services/__snapshots__/converters.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ exports[`#createServiceEntity should convert data 1`] = `
"_type": "kube_service",
"active": undefined,
"allocateLoadBalancerNodePorts": undefined,
"apiVersion": undefined,
"category": [
"infrastructure",
],
"clusterIP": "10.96.0.1",
"clusterIPs": [
"10.96.0.1",
],
"clusterIpVersion": undefined,
"createdOn": 1619557039000,
"deletionGracePeriodSeconds": undefined,
"displayName": "kubernetes",
Expand All @@ -68,6 +70,15 @@ exports[`#createServiceEntity should convert data 1`] = `
"loadBalancerIP": undefined,
"loadBalancerSourceRanges": undefined,
"name": "kubernetes",
"portName": [
"https",
],
"portNumber": [
443,
],
"protocol": [
"TCP",
],
"publishNotReadyAddresses": undefined,
"resourceVersion": "202",
"sessionAffinity": "None",
Expand Down
70 changes: 70 additions & 0 deletions src/steps/services/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,19 @@ exports[`#fetchServices should collect data: jobState 1`] = `
"_type": "kube_service",
"active": undefined,
"allocateLoadBalancerNodePorts": undefined,
"apiVersion": [
"v1",
],
"category": [
"infrastructure",
],
"clusterIP": "10.96.0.1",
"clusterIPs": [
"10.96.0.1",
],
"clusterIpVersion": [
"IPv4",
],
"createdOn": 1704988216000,
"deletionGracePeriodSeconds": undefined,
"displayName": "kubernetes",
Expand All @@ -428,6 +434,15 @@ exports[`#fetchServices should collect data: jobState 1`] = `
"loadBalancerIP": undefined,
"loadBalancerSourceRanges": undefined,
"name": "kubernetes",
"portName": [
"https",
],
"portNumber": [
443,
],
"protocol": [
"TCP",
],
"publishNotReadyAddresses": undefined,
"resourceVersion": "231",
"sessionAffinity": "None",
Expand Down Expand Up @@ -564,13 +579,19 @@ exports[`#fetchServices should collect data: jobState 1`] = `
"_type": "kube_service",
"active": undefined,
"allocateLoadBalancerNodePorts": undefined,
"apiVersion": [
"v1",
],
"category": [
"infrastructure",
],
"clusterIP": "10.103.238.222",
"clusterIPs": [
"10.103.238.222",
],
"clusterIpVersion": [
"IPv4",
],
"createdOn": 1705009957000,
"deletionGracePeriodSeconds": undefined,
"displayName": "np-test-mariadb",
Expand All @@ -589,6 +610,15 @@ exports[`#fetchServices should collect data: jobState 1`] = `
"loadBalancerIP": undefined,
"loadBalancerSourceRanges": undefined,
"name": "np-test-mariadb",
"portName": [
"mysql",
],
"portNumber": [
3306,
],
"protocol": [
"TCP",
],
"publishNotReadyAddresses": undefined,
"resourceVersion": "27438",
"sessionAffinity": "None",
Expand Down Expand Up @@ -760,13 +790,20 @@ exports[`#fetchServices should collect data: jobState 1`] = `
"_type": "kube_service",
"active": undefined,
"allocateLoadBalancerNodePorts": true,
"apiVersion": [
"v1",
"v1",
],
"category": [
"infrastructure",
],
"clusterIP": "10.108.56.15",
"clusterIPs": [
"10.108.56.15",
],
"clusterIpVersion": [
"IPv4",
],
"createdOn": 1705009957000,
"deletionGracePeriodSeconds": undefined,
"displayName": "np-test-wordpress",
Expand All @@ -785,6 +822,18 @@ exports[`#fetchServices should collect data: jobState 1`] = `
"loadBalancerIP": undefined,
"loadBalancerSourceRanges": undefined,
"name": "np-test-wordpress",
"portName": [
"http",
"https",
],
"portNumber": [
80,
443,
],
"protocol": [
"TCP",
"TCP",
],
"publishNotReadyAddresses": undefined,
"resourceVersion": "27471",
"sessionAffinity": "None",
Expand Down Expand Up @@ -944,13 +993,19 @@ exports[`#fetchServices should collect data: jobState 1`] = `
"_type": "kube_service",
"active": undefined,
"allocateLoadBalancerNodePorts": undefined,
"apiVersion": [
"v1",
],
"category": [
"infrastructure",
],
"clusterIP": "10.96.0.10",
"clusterIPs": [
"10.96.0.10",
],
"clusterIpVersion": [
"IPv4",
],
"createdOn": 1704988218000,
"deletionGracePeriodSeconds": undefined,
"displayName": "kube-dns",
Expand All @@ -969,6 +1024,21 @@ exports[`#fetchServices should collect data: jobState 1`] = `
"loadBalancerIP": undefined,
"loadBalancerSourceRanges": undefined,
"name": "kube-dns",
"portName": [
"dns",
"dns-tcp",
"metrics",
],
"portNumber": [
53,
53,
9153,
],
"protocol": [
"UDP",
"TCP",
"TCP",
],
"publishNotReadyAddresses": undefined,
"resourceVersion": "275",
"sessionAffinity": "None",
Expand Down
9 changes: 9 additions & 0 deletions src/steps/services/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ export function createServiceEntity(data: k8s.V1Service) {
publishNotReadyAddresses: data.spec?.publishNotReadyAddresses,
sessionAffinity: data.spec?.sessionAffinity,
type: data.spec?.type,
clusterIpVersion: data.spec?.ipFamilies,
apiVersion: data.metadata?.managedFields?.map(
(managedField) => managedField.apiVersion ?? 'undefined',
),
//apiVersion: data.metadata?.managedFields[0].apiVersion,
portName: data.spec?.ports?.map((port) => port.name ?? 'undefined'),
portNumber: data.spec?.ports?.map((port) => port.port),
protocol: data.spec?.ports?.map((port) => port.protocol ?? 'undefined'),

// TODO: data.status part is made up of arrays, require some mappings/thinking
},
},
Expand Down
20 changes: 20 additions & 0 deletions src/steps/services/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,26 @@ describe('#fetchServices', () => {
publishNotReadyAddresses: { type: 'boolean' },
sessionAffinity: { type: 'string' },
type: { type: 'string' },
clusterIpVersion: {
type: 'array',
items: { type: 'string' },
},
apiVersion: {
type: 'array',
items: { type: 'string' },
},
portName: {
type: 'array',
items: { type: 'string' },
},
portNumber: {
type: 'array',
items: { type: 'number' },
},
protocol: {
type: 'array',
items: { type: 'string' },
},
},
},
},
Expand Down
Loading
Loading