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

Kubernetes dev #69

Merged
merged 13 commits into from
Jun 25, 2024
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ and this project adheres to

## [Unreleased]

## 2.1.0 - 2024-06-18

### Changed

- Updated kube_container_spec entity
- Updated JupiterOne SDk from v8.22.6 to v12.8.3

### Added

- Added new relationships.

| Source Entity `_type` | Relationship `_class` | Target Entity `_type` |
| --------------------- | --------------------- | --------------------- |
| `kube_container_spec` | **HAS** | `kube_cron_job` |
| `kube_container_spec` | **HAS** | `kube_daemon_set` |
| `kube_container_spec` | **HAS** | `kube_job` |
| `kube_container_spec` | **HAS** | `kube_replica_set` |
| `kube_container_spec` | **HAS** | `kube_stateful_set` |

## 2.1.0 - 2024-03-22

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Learn about the data ingested, benefits of this integration, and how to use it
with JupiterOne in the [integration documentation](docs/jupiterone.md).

## Development
## Development

### Prerequisites

Expand Down
5 changes: 5 additions & 0 deletions docs/jupiterone.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ The following relationships are created:
| `kube_cluster` | **CONTAINS** | `kube_cluster_role` |
| `kube_cluster` | **CONTAINS** | `kube_cluster_role_binding` |
| `kube_cluster` | **CONTAINS** | `kube_namespace` |
| `kube_container_spec` | **HAS** | `kube_cron_job` |
| `kube_container_spec` | **HAS** | `kube_daemon_set` |
| `kube_container_spec` | **HAS** | `kube_job` |
| `kube_container_spec` | **HAS** | `kube_replica_set` |
| `kube_container_spec` | **HAS** | `kube_stateful_set` |
| `kube_container_spec` | **USES** | `kube_volume` |
| `kube_cron_job` | **MANAGES** | `kube_job` |
| `kube_deployment` | **MANAGES** | `kube_replica_set` |
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
"dependencies": {
"@jupiterone/integration-sdk-dev-tools": "^8.22.6",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update all packages to latest version. Check the armis for reference

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to latest

"@kubernetes/client-node": "^0.20.0",
"latest": "^0.2.0",
"node-fetch": "2.6.1"
},
"peerDependencies": {
"@jupiterone/integration-sdk-core": "^8.22.6"
"@jupiterone/integration-sdk-core": "^12.8.3"
}
}
15 changes: 15 additions & 0 deletions src/getStepStartStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,21 @@ export default async function getStepStartStates(
[IntegrationSteps.NODES]: {
disabled: nodesDisabled,
},
[IntegrationSteps.CONTAINER_SPEC_HAS_JOB]: {
disabled: jobsDisabled,
},
[IntegrationSteps.CONTAINER_SPEC_HAS_DAEMONSET]: {
disabled: daemonsetsDisabled,
},
[IntegrationSteps.CONTAINER_SPEC_HAS_REPLICASET]: {
disabled: replicasetsDisabled,
},
[IntegrationSteps.CONTAINER_SPEC_HAS_STATEFULSET]: {
disabled: statefulsetsDisabled,
},
[IntegrationSteps.CONTAINER_SPEC_HAS_CRON_JOB]: {
disabled: cronJobsDisabled,
},
[IntegrationSteps.PODS]: {
disabled: !(
instance.accountId == '0c51143d-9728-4f42-8442-4b52be5e8a74' ||
Expand Down
44 changes: 44 additions & 0 deletions src/steps/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export enum IntegrationSteps {
SECRETS = 'fetch-secrets',
IMAGES = 'fetch-images',
PODS = 'fetch-pods',
CONTAINER_SPEC = 'fetch-container-spec',
CONTAINER_SPEC_HAS_JOB = 'fetch-container-spec-job-relationship',
CONTAINER_SPEC_HAS_CRON_JOB = 'fetch-container-spec-cron-job-relationship',
CONTAINER_SPEC_HAS_DAEMONSET = 'fetch-container-spec-daemonset-relationship',
CONTAINER_SPEC_HAS_REPLICASET = 'fetch-container-spec-replicaset-relationship',
CONTAINER_SPEC_HAS_STATEFULSET = 'fetch-container-spec-statefulset-relationship',
}

export const Entities = {
Expand Down Expand Up @@ -330,8 +336,46 @@ export const Relationships = {
sourceType: Entities.POD._type,
targetType: Entities.CONTAINER._type,
},
CONTAINER_SPEC_HAS_JOB: {
_type: 'kube_container_spec_has_job',
_class: RelationshipClass.HAS,
sourceType: Entities.CONTAINER_SPEC._type,
targetType: Entities.JOB._type,
},
CONTAINER_SPEC_HAS_CRONJOB: {
_type: 'kube_container_spec_has_cron_job',
_class: RelationshipClass.HAS,
sourceType: Entities.CONTAINER_SPEC._type,
targetType: Entities.CRONJOB._type,
},
CONTAINER_SPEC_HAS_DAEMONSET: {
_type: 'kube_container_spec_has_daemon_set',
_class: RelationshipClass.HAS,
sourceType: Entities.CONTAINER_SPEC._type,
targetType: Entities.DAEMONSET._type,
},
CONTAINER_SPEC_HAS_REPLICASET: {
_type: 'kube_container_spec_has_replica_set',
_class: RelationshipClass.HAS,
sourceType: Entities.CONTAINER_SPEC._type,
targetType: Entities.REPLICASET._type,
},
CONTAINER_SPEC_HAS_STATEFULSET: {
_type: 'kube_container_spec_has_stateful_set',
_class: RelationshipClass.HAS,
sourceType: Entities.CONTAINER_SPEC._type,
targetType: Entities.STATEFULSET._type,
},
};

export enum ContainerspecType {
CRONJOB = 'cronjob',
JOB = 'job',
DAEMONSET = 'daemonset',
REPLICASET = 'replicaset',
STATEFULSET = 'statefulset',
}

export const MappedRelationships: Record<
string,
StepMappedRelationshipMetadata
Expand Down
Loading