Skip to content

Commit

Permalink
reverts
Browse files Browse the repository at this point in the history
  • Loading branch information
yairsimantov20 committed Dec 31, 2023
1 parent 1d908f7 commit e1a44a8
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ 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:
query: .metadata.name | contains("kube-system")
port:
entity:
mappings:
- identifier: env.CLUSTER_NAME
title: env.CLUSTER_NAME
- identifier: '"{CLUSTER_NAME}"'
title: '"{CLUSTER_NAME}"'
blueprint: '"cluster"'

- kind: apps/v1/deployments
Expand All @@ -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"'
Expand All @@ -50,15 +50,15 @@ 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:
query: .metadata.namespace | startswith("kube") | not
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:
Expand All @@ -74,15 +74,15 @@ 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:
query: .metadata.namespace | startswith("kube") | not
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:
Expand All @@ -98,15 +98,15 @@ 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:
query: .metadata.namespace | startswith("kube") | not
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"'
Expand All @@ -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
Expand All @@ -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"'
Expand All @@ -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)
Expand All @@ -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"'
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -201,35 +201,35 @@ 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:
query: '.metadata.labels // {} | contains({ "argocd.argoproj.io/secret-type": "repository" })'
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
Expand All @@ -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:
Expand All @@ -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:
Expand Down
Loading

0 comments on commit e1a44a8

Please sign in to comment.