Skip to content
Draft
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
4 changes: 2 additions & 2 deletions cloudpg/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ dependencies {
implementation("de.fraunhofer.aisec:cpg-language-go:$version")
implementation("de.fraunhofer.aisec:cpg-language-python:$version")

implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.+")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.0")
implementation ("org.xmlunit:xmlunit-core:2.9.0")
implementation("org.xmlunit:xmlunit-matchers:2.9.0")

Expand All @@ -97,7 +97,7 @@ dependencies {
implementation("com.azure.resourcemanager:azure-resourcemanager-loganalytics:1.0.0-beta.2")
implementation("com.azure:azure-identity:1.2.0")

implementation("io.kubernetes:client-java:10.0.0")
implementation("io.kubernetes:client-java:17.0.2")
implementation("com.microsoft.azure:adal4j:1.6.6")

implementation("com.fasterxml.jackson.core:jackson-databind:2.11.2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class WorkflowHandler(private val result: TranslationResult, val rootPath: Path)
result += compute

val mapper = ObjectMapper(YAMLFactory())
mapper.registerModule(KotlinModule())
mapper.registerModule(KotlinModule.Builder().build())

Files.newBufferedReader(rootPath.resolve(composePath)).use { reader ->
val compose = mapper.readValue(reader, DockerCompose::class.java)
Expand Down
2 changes: 1 addition & 1 deletion cloudpg/src/main/java/io/clouditor/graph/passes/Azure.kt
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class AzurePass : CloudResourceDiscoveryPass() {
}

// model data export as ObjectStorageRequest
val request = ObjectStorageRequest(log, listOf(storage), "append")
val request = ObjectStorageRequest(log, listOfNotNull(storage), "append")
storage?.let { request.addNextDFG(it) }

// add DFG from the source to the sink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GitHubWorkflowPass : Pass() {
workflowPath.toFile().walkTopDown().iterator().forEach { file ->
if (file.extension == "yml") {
val mapper = ObjectMapper(YAMLFactory())
mapper.registerModule(KotlinModule())
mapper.registerModule(KotlinModule.Builder().build())

Files.newBufferedReader(file.toPath()).use {
val workflow = mapper.readValue(it, Workflow::class.java)
Expand Down
31 changes: 23 additions & 8 deletions cloudpg/src/main/java/io/clouditor/graph/passes/KubernetesPass.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import io.clouditor.graph.nodes.isInSelector
import io.kubernetes.client.openapi.ApiClient
import io.kubernetes.client.openapi.Configuration
import io.kubernetes.client.openapi.apis.CoreV1Api
import io.kubernetes.client.openapi.apis.ExtensionsV1beta1Api
import io.kubernetes.client.openapi.models.ExtensionsV1beta1Ingress
import io.kubernetes.client.openapi.apis.NetworkingV1Api
import io.kubernetes.client.openapi.models.V1Ingress
import io.kubernetes.client.openapi.models.V1Pod
import io.kubernetes.client.openapi.models.V1Service
import io.kubernetes.client.util.ClientBuilder
import io.kubernetes.client.util.KubeConfig
import java.io.FileReader
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
import kotlin.collections.List
Expand Down Expand Up @@ -49,7 +48,8 @@ class KubernetesPass : CloudResourceDiscoveryPass() {

// the CoreV1Api loads default api-client from global configuration.
val api = CoreV1Api()
val extensionsApi = ExtensionsV1beta1Api()
// val extensionsApi = ExtensionsV1beta1Api()
val extensionsApi = NetworkingV1Api()

val namespace = App.kubernetesNamespace

Expand All @@ -61,7 +61,19 @@ class KubernetesPass : CloudResourceDiscoveryPass() {

// invokes the CoreV1Api client
val pods =
api.listNamespacedPod(namespace, null, null, null, null, null, null, null, null, null)
api.listNamespacedPod(
namespace,
null,
null,
null,
null,
null,
null,
null,
null,
null,
false
)
for (pod in pods.items) {
val container = handlePod(t, pod, cluster)

Expand All @@ -82,6 +94,7 @@ class KubernetesPass : CloudResourceDiscoveryPass() {
null,
null,
null,
null,
false
)
for (item in services.items) {
Expand All @@ -101,6 +114,7 @@ class KubernetesPass : CloudResourceDiscoveryPass() {
null,
null,
null,
null,
false
)
for (item in endpoints.items) {
Expand Down Expand Up @@ -138,6 +152,7 @@ class KubernetesPass : CloudResourceDiscoveryPass() {
null,
null,
null,
null,
false
)
for (item in list.items) {
Expand Down Expand Up @@ -262,7 +277,7 @@ class KubernetesPass : CloudResourceDiscoveryPass() {

private fun handleIngress(
t: TranslationResult,
ingress: ExtensionsV1beta1Ingress,
ingress: V1Ingress,
cluster: ContainerOrchestration?
): List<LoadBalancer> {
val list = mutableListOf<LoadBalancer>()
Expand All @@ -274,7 +289,7 @@ class KubernetesPass : CloudResourceDiscoveryPass() {
// look for the service (TODO: add namespace to filter)
val service =
t.additionalNodes.filterIsInstance(NetworkService::class.java).firstOrNull {
it.name == path.backend?.serviceName
it.name == path.backend?.service?.name
}

val hasTLS = ingress.spec?.tls?.isEmpty() ?: false
Expand All @@ -298,7 +313,7 @@ class KubernetesPass : CloudResourceDiscoveryPass() {
null,
ArrayList(),
ArrayList(),
null,
ArrayList(),
null,
cluster?.geoLocation ?: GeoLocation("Europe"),
mapOf()
Expand Down