diff --git a/kubernetes/templates/argo-argo_rollouts-istio-kubernetes_v1_config.yaml b/kubernetes/templates/argo-argo_rollouts-istio-kubernetes_v1_config.yaml index b25a58f..1de9c1e 100644 --- a/kubernetes/templates/argo-argo_rollouts-istio-kubernetes_v1_config.yaml +++ b/kubernetes/templates/argo-argo_rollouts-istio-kubernetes_v1_config.yaml @@ -7,14 +7,14 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: # Mappings between one K8s object to one or many Port Entities. Each value is a JQ query. - - identifier: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"namespace"' properties: creationTimestamp: .metadata.creationTimestamp labels: .metadata.labels relations: - Cluster: env.CLUSTER_NAME + Cluster: '"{CLUSTER_NAME}"' - kind: v1/namespaces selector: @@ -22,8 +22,8 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: env.CLUSTER_NAME - title: env.CLUSTER_NAME + - identifier: '"{CLUSTER_NAME}"' + title: '"{CLUSTER_NAME}"' blueprint: '"cluster"' - kind: apps/v1/deployments @@ -32,7 +32,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"workload"' @@ -50,7 +50,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/daemonsets selector: @@ -58,7 +58,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -74,7 +74,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/statefulsets selector: @@ -82,7 +82,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -98,7 +98,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/replicasets selector: @@ -106,7 +106,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"replicaSet"' @@ -122,7 +122,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME // [] + replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" // [] # Pods who are owned by replica-sets are connected directly to their deployment - kind: v1/pods @@ -131,7 +131,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -142,8 +142,8 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME // "" + replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" // "" # Pods that are not managed by replicasets->deployments (daemonsets, statefulsets etc) @@ -153,7 +153,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -164,15 +164,15 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME + workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" - kind: v1/nodes port: entity: mappings: - - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME - title: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" + title: .metadata.name + "-" + "{CLUSTER_NAME}" icon: '"Node"' blueprint: '"node"' properties: @@ -183,14 +183,14 @@ resources: # List of K8s resources to list, watch, and export to Port. kubeletVersion: .status.nodeInfo.kubeletVersion | split("-") | .[0] ready: .status.conditions[] | select(.type == "Ready") | .status relations: - Cluster: env.CLUSTER_NAME + Cluster: '"{CLUSTER_NAME}"' # ArgoCD configuration - kind: argoproj.io/v1alpha1/applications port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" blueprint: '"argocdApp"' title: .metadata.name properties: @@ -201,20 +201,20 @@ resources: # List of K8s resources to list, watch, and export to Port. gitPath: .spec.source.path // null gitRev: .status.sync.revision // null relations: - workload: '(.spec.destination.namespace as $namespace | .status.resources | map(select(.kind == "Deployment" or .kind == "StatefulSet" or .kind == "DaemonSet" or .kind == "Rollout" )) | .[] | .name + "-" + .kind + "-" + $namespace + "-" + env.CLUSTER_NAME) // []' - argocdProject: .spec.project + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - destinationNamespace: .spec.destination.namespace + "-" + env.CLUSTER_NAME + workload: '(.spec.destination.namespace as $namespace | .status.resources | map(select(.kind == "Deployment" or .kind == "StatefulSet" or .kind == "DaemonSet" or .kind == "Rollout" )) | .[] | .name + "-" + .kind + "-" + $namespace + "-{CLUSTER_NAME}") // []' + argocdProject: .spec.project + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + destinationNamespace: .spec.destination.namespace + "-" + "{CLUSTER_NAME}" - kind: argoproj.io/v1alpha1/appproject port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"argocdProject"' properties: relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: v1/secrets selector: @@ -222,14 +222,14 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"argocdRepo"' properties: repoUrl: .data.url | @base64d repoType: .data.type | @base64d relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" # ArgoCD Rollouts configuration - kind: argoproj.io/v1alpha1/rollouts @@ -238,7 +238,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-Rollout-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-Rollout-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -254,7 +254,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: networking.istio.io/v1beta1/virtualservices port: diff --git a/kubernetes/templates/argo-argo_rollouts-kubernetes_v1_config.yaml b/kubernetes/templates/argo-argo_rollouts-kubernetes_v1_config.yaml index 427b5ee..5609125 100644 --- a/kubernetes/templates/argo-argo_rollouts-kubernetes_v1_config.yaml +++ b/kubernetes/templates/argo-argo_rollouts-kubernetes_v1_config.yaml @@ -7,14 +7,14 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: # Mappings between one K8s object to one or many Port Entities. Each value is a JQ query. - - identifier: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"namespace"' properties: creationTimestamp: .metadata.creationTimestamp labels: .metadata.labels relations: - Cluster: 'env.CLUSTER_NAME' + Cluster: '"{CLUSTER_NAME}"' - kind: v1/namespaces selector: @@ -22,8 +22,8 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: env.CLUSTER_NAME - title: env.CLUSTER_NAME + - identifier: '"{CLUSTER_NAME}"' + title: '"{CLUSTER_NAME}"' blueprint: '"cluster"' - kind: apps/v1/deployments @@ -32,7 +32,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"workload"' @@ -50,7 +50,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/daemonsets selector: @@ -58,7 +58,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -74,7 +74,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/statefulsets selector: @@ -82,7 +82,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -98,7 +98,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/replicasets selector: @@ -106,7 +106,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"replicaSet"' @@ -122,7 +122,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME // [] + replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" // [] # Pods who are owned by replica-sets are connected directly to their deployment - kind: v1/pods @@ -131,7 +131,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -142,8 +142,8 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME // "" + replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" // "" # Pods that are not managed by replicasets->deployments (daemonsets, statefulsets etc) @@ -153,7 +153,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -164,15 +164,15 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME + workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" - kind: v1/nodes port: entity: mappings: - - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME - title: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" + title: .metadata.name + "-" + "{CLUSTER_NAME}" icon: '"Node"' blueprint: '"node"' properties: @@ -183,14 +183,14 @@ resources: # List of K8s resources to list, watch, and export to Port. kubeletVersion: .status.nodeInfo.kubeletVersion | split("-") | .[0] ready: .status.conditions[] | select(.type == "Ready") | .status relations: - Cluster: env.CLUSTER_NAME + Cluster: '"{CLUSTER_NAME}"' # ArgoCD configuration - kind: argoproj.io/v1alpha1/applications port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" blueprint: '"argocdApp"' title: .metadata.name properties: @@ -201,20 +201,20 @@ resources: # List of K8s resources to list, watch, and export to Port. gitPath: .spec.source.path // null gitRev: .status.sync.revision // null relations: - workload: '(.spec.destination.namespace as $namespace | .status.resources | map(select(.kind == "Deployment" or .kind == "StatefulSet" or .kind == "DaemonSet" or .kind == "Rollout" )) | .[] | .name + "-" + .kind + "-" + $namespace + "-" + env.CLUSTER_NAME) // []' - argocdProject: .spec.project + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - destinationNamespace: .spec.destination.namespace + "-" + env.CLUSTER_NAME + workload: '(.spec.destination.namespace as $namespace | .status.resources | map(select(.kind == "Deployment" or .kind == "StatefulSet" or .kind == "DaemonSet" or .kind == "Rollout" )) | .[] | .name + "-" + .kind + "-" + $namespace + "-{CLUSTER_NAME}") // []' + argocdProject: .spec.project + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + destinationNamespace: .spec.destination.namespace + "-" + "{CLUSTER_NAME}" - kind: argoproj.io/v1alpha1/appproject port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"argocdProject"' properties: relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: v1/secrets selector: @@ -222,14 +222,14 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"argocdRepo"' properties: repoUrl: .data.url | @base64d repoType: .data.type | @base64d relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" # ArgoCD Rollouts configuration - kind: argoproj.io/v1alpha1/rollouts @@ -238,7 +238,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-Rollout-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-Rollout-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -254,4 +254,4 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" diff --git a/kubernetes/templates/argo-istio-kubernetes_v1_config.yaml b/kubernetes/templates/argo-istio-kubernetes_v1_config.yaml index 642eda3..535be85 100644 --- a/kubernetes/templates/argo-istio-kubernetes_v1_config.yaml +++ b/kubernetes/templates/argo-istio-kubernetes_v1_config.yaml @@ -7,14 +7,14 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: # Mappings between one K8s object to one or many Port Entities. Each value is a JQ query. - - identifier: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"namespace"' properties: creationTimestamp: .metadata.creationTimestamp labels: .metadata.labels relations: - Cluster: env.CLUSTER_NAME + Cluster: '"{CLUSTER_NAME}"' - kind: v1/namespaces selector: @@ -22,8 +22,8 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: env.CLUSTER_NAME - title: env.CLUSTER_NAME + - identifier: '"{CLUSTER_NAME}"' + title: '"{CLUSTER_NAME}"' blueprint: '"cluster"' - kind: apps/v1/deployments @@ -32,7 +32,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"workload"' @@ -50,7 +50,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/daemonsets selector: @@ -58,7 +58,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -74,7 +74,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/statefulsets selector: @@ -82,7 +82,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -98,7 +98,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/replicasets selector: @@ -106,7 +106,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"replicaSet"' @@ -122,7 +122,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME // [] + replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" // [] # Pods who are owned by replica-sets are connected directly to their deployment - kind: v1/pods @@ -131,7 +131,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -142,8 +142,8 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME // "" + replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" // "" # Pods that are not managed by replicasets->deployments (daemonsets, statefulsets etc) @@ -153,7 +153,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -164,15 +164,15 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME + workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" - kind: v1/nodes port: entity: mappings: - - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME - title: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" + title: .metadata.name + "-" + "{CLUSTER_NAME}" icon: '"Node"' blueprint: '"node"' properties: @@ -183,14 +183,14 @@ resources: # List of K8s resources to list, watch, and export to Port. kubeletVersion: .status.nodeInfo.kubeletVersion | split("-") | .[0] ready: .status.conditions[] | select(.type == "Ready") | .status relations: - Cluster: env.CLUSTER_NAME + Cluster: '"{CLUSTER_NAME}"' # ArgoCD configuration - kind: argoproj.io/v1alpha1/applications port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" blueprint: '"argocdApp"' title: .metadata.name properties: @@ -201,20 +201,20 @@ resources: # List of K8s resources to list, watch, and export to Port. gitPath: .spec.source.path // null gitRev: .status.sync.revision // null relations: - workload: '(.spec.destination.namespace as $namespace | .status.resources | map(select(.kind == "Deployment" or .kind == "StatefulSet" or .kind == "DaemonSet" or .kind == "Rollout" )) | .[] | .name + "-" + .kind + "-" + $namespace + "-" + env.CLUSTER_NAME) // []' - argocdProject: .spec.project + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - destinationNamespace: .spec.destination.namespace + "-" + env.CLUSTER_NAME + workload: '(.spec.destination.namespace as $namespace | .status.resources | map(select(.kind == "Deployment" or .kind == "StatefulSet" or .kind == "DaemonSet" or .kind == "Rollout" )) | .[] | .name + "-" + .kind + "-" + $namespace + "-{CLUSTER_NAME}") // []' + argocdProject: .spec.project + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + destinationNamespace: .spec.destination.namespace + "-" + "{CLUSTER_NAME}" - kind: argoproj.io/v1alpha1/appproject port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"argocdProject"' properties: relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: v1/secrets selector: @@ -222,14 +222,14 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"argocdRepo"' properties: repoUrl: .data.url | @base64d repoType: .data.type | @base64d relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: networking.istio.io/v1beta1/virtualservices port: diff --git a/kubernetes/templates/argo-kubernetes_v1_config.yaml b/kubernetes/templates/argo-kubernetes_v1_config.yaml index 2a7a4b3..979053e 100644 --- a/kubernetes/templates/argo-kubernetes_v1_config.yaml +++ b/kubernetes/templates/argo-kubernetes_v1_config.yaml @@ -7,14 +7,14 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: # Mappings between one K8s object to one or many Port Entities. Each value is a JQ query. - - identifier: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"namespace"' properties: creationTimestamp: .metadata.creationTimestamp labels: .metadata.labels relations: - Cluster: env.CLUSTER_NAME + Cluster: '"{CLUSTER_NAME}"' - kind: v1/namespaces selector: @@ -22,8 +22,8 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: env.CLUSTER_NAME - title: 'env.CLUSTER_NAME' + - identifier: '"{CLUSTER_NAME}"' + title: '"{CLUSTER_NAME}"' blueprint: '"cluster"' - kind: apps/v1/deployments @@ -32,7 +32,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"workload"' @@ -50,7 +50,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/daemonsets selector: @@ -58,7 +58,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -74,7 +74,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/statefulsets selector: @@ -82,7 +82,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -98,7 +98,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/replicasets selector: @@ -106,7 +106,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"replicaSet"' @@ -122,7 +122,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME // [] + replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" // [] # Pods who are owned by replica-sets are connected directly to their deployment - kind: v1/pods @@ -131,7 +131,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -142,8 +142,8 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME // "" + replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" // "" # Pods that are not managed by replicasets->deployments (daemonsets, statefulsets etc) @@ -153,7 +153,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -164,15 +164,15 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME + workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" - kind: v1/nodes port: entity: mappings: - - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME - title: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" + title: .metadata.name + "-" + "{CLUSTER_NAME}" icon: '"Node"' blueprint: '"node"' properties: @@ -183,14 +183,14 @@ resources: # List of K8s resources to list, watch, and export to Port. kubeletVersion: .status.nodeInfo.kubeletVersion | split("-") | .[0] ready: .status.conditions[] | select(.type == "Ready") | .status relations: - Cluster: env.CLUSTER_NAME + Cluster: '"{CLUSTER_NAME}"' # ArgoCD configuration - kind: argoproj.io/v1alpha1/applications port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" blueprint: '"argocdApp"' title: .metadata.name properties: @@ -201,20 +201,20 @@ resources: # List of K8s resources to list, watch, and export to Port. gitPath: .spec.source.path // null gitRev: .status.sync.revision // null relations: - workload: '(.spec.destination.namespace as $namespace | .status.resources | map(select(.kind == "Deployment" or .kind == "StatefulSet" or .kind == "DaemonSet" or .kind == "Rollout" )) | .[] | .name + "-" + .kind + "-" + $namespace + "-" + env.CLUSTER_NAME) // []' - argocdProject: .spec.project + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - destinationNamespace: .spec.destination.namespace + "-" + env.CLUSTER_NAME + workload: '(.spec.destination.namespace as $namespace | .status.resources | map(select(.kind == "Deployment" or .kind == "StatefulSet" or .kind == "DaemonSet" or .kind == "Rollout" )) | .[] | .name + "-" + .kind + "-" + $namespace + "-{CLUSTER_NAME}") // []' + argocdProject: .spec.project + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + destinationNamespace: .spec.destination.namespace + "-" + "{CLUSTER_NAME}" - kind: argoproj.io/v1alpha1/appproject port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"argocdProject"' properties: relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: v1/secrets selector: @@ -222,11 +222,11 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"argocdRepo"' properties: repoUrl: .data.url | @base64d repoType: .data.type | @base64d relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" diff --git a/kubernetes/templates/istio-kubernetes_v1_config.yaml b/kubernetes/templates/istio-kubernetes_v1_config.yaml index 248a670..fa6c433 100644 --- a/kubernetes/templates/istio-kubernetes_v1_config.yaml +++ b/kubernetes/templates/istio-kubernetes_v1_config.yaml @@ -7,14 +7,14 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: # Mappings between one K8s object to one or many Port Entities. Each value is a JQ query. - - identifier: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"namespace"' properties: creationTimestamp: .metadata.creationTimestamp labels: .metadata.labels relations: - Cluster: 'env.CLUSTER_NAME' + Cluster: '"{CLUSTER_NAME}"' - kind: v1/namespaces selector: @@ -22,8 +22,8 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: env.CLUSTER_NAME - title: env.CLUSTER_NAME + - identifier: '"{CLUSTER_NAME}"' + title: '"{CLUSTER_NAME}"' blueprint: '"cluster"' - kind: apps/v1/deployments @@ -32,7 +32,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"workload"' @@ -50,7 +50,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/daemonsets selector: @@ -58,7 +58,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -74,7 +74,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/statefulsets selector: @@ -82,7 +82,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -98,7 +98,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/replicasets selector: @@ -106,7 +106,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"replicaSet"' @@ -122,7 +122,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME // [] + replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" // [] # Pods who are owned by replica-sets are connected directly to their deployment - kind: v1/pods @@ -131,7 +131,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -142,8 +142,8 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME // "" + replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" // "" # Pods that are not managed by replicasets->deployments (daemonsets, statefulsets etc) @@ -153,7 +153,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -164,15 +164,15 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME + workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" - kind: v1/nodes port: entity: mappings: - - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME - title: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" + title: .metadata.name + "-" + "{CLUSTER_NAME}" icon: '"Node"' blueprint: '"node"' properties: @@ -183,7 +183,7 @@ resources: # List of K8s resources to list, watch, and export to Port. kubeletVersion: .status.nodeInfo.kubeletVersion | split("-") | .[0] ready: .status.conditions[] | select(.type == "Ready") | .status relations: - Cluster: 'env.CLUSTER_NAME' + Cluster: '"{CLUSTER_NAME}"' - kind: networking.istio.io/v1beta1/virtualservices port: diff --git a/kubernetes/templates/kubernetes_v1_config.yaml b/kubernetes/templates/kubernetes_v1_config.yaml index 8c822bf..66bb30c 100644 --- a/kubernetes/templates/kubernetes_v1_config.yaml +++ b/kubernetes/templates/kubernetes_v1_config.yaml @@ -7,14 +7,14 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: # Mappings between one K8s object to one or many Port Entities. Each value is a JQ query. - - identifier: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"namespace"' properties: creationTimestamp: .metadata.creationTimestamp labels: .metadata.labels relations: - Cluster: env.CLUSTER_NAME + Cluster: '"{CLUSTER_NAME}"' - kind: v1/namespaces selector: @@ -22,8 +22,8 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: env.CLUSTER_NAME - title: env.CLUSTER_NAME + - identifier: '"{CLUSTER_NAME}"' + title: '"{CLUSTER_NAME}"' blueprint: '"cluster"' - kind: apps/v1/deployments @@ -32,7 +32,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"workload"' @@ -50,7 +50,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/daemonsets selector: @@ -58,7 +58,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -74,7 +74,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/statefulsets selector: @@ -82,7 +82,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name blueprint: '"workload"' properties: @@ -98,7 +98,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME + Namespace: .metadata.namespace + "-" + "{CLUSTER_NAME}" - kind: apps/v1/replicasets selector: @@ -106,7 +106,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-ReplicaSet-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Deployment"' blueprint: '"replicaSet"' @@ -122,7 +122,7 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.template.spec.containers | map({name, image, resources})) isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" else "Unhealthy" end relations: - replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME // [] + replicaSetManager: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" // [] # Pods who are owned by replica-sets are connected directly to their deployment - kind: v1/pods @@ -131,7 +131,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -142,8 +142,8 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME // "" + replicaSet: .metadata.ownerReferences[0].name + "-" + "ReplicaSet" + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" // "" # Pods that are not managed by replicasets->deployments (daemonsets, statefulsets etc) @@ -153,7 +153,7 @@ resources: # List of K8s resources to list, watch, and export to Port. port: entity: mappings: - - identifier: .metadata.name + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME + - identifier: .metadata.name + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" title: .metadata.name icon: '"Microservices"' blueprint: '"pod"' @@ -164,15 +164,15 @@ resources: # List of K8s resources to list, watch, and export to Port. containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add) conditions: .status.conditions relations: - workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + env.CLUSTER_NAME - Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME + workload: .metadata.ownerReferences[0].name + "-" + .metadata.ownerReferences[0].kind + "-" + .metadata.namespace + "-" + "{CLUSTER_NAME}" + Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" - kind: v1/nodes port: entity: mappings: - - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + env.CLUSTER_NAME - title: .metadata.name + "-" + env.CLUSTER_NAME + - identifier: (.metadata.name) | (split(".")|join("_")) + "-" + "{CLUSTER_NAME}" + title: .metadata.name + "-" + "{CLUSTER_NAME}" icon: '"Node"' blueprint: '"node"' properties: @@ -183,4 +183,4 @@ resources: # List of K8s resources to list, watch, and export to Port. kubeletVersion: .status.nodeInfo.kubeletVersion | split("-") | .[0] ready: .status.conditions[] | select(.type == "Ready") | .status relations: - Cluster: env.CLUSTER_NAME + Cluster: '"{CLUSTER_NAME}"'