-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from port-labs/PORT-5363-ui-create-default-res…
…ources Port 5363 UI create default resources
- Loading branch information
Showing
27 changed files
with
1,290 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,5 @@ __debug_bin | |
config.yaml | ||
|
||
deployments/k8s | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
createMissingRelatedEntities: true | ||
resources: | ||
- kind: v1/namespaces | ||
port: | ||
entity: | ||
mappings: | ||
- blueprint: '"namespace"' | ||
identifier: .metadata.name + "-" + env.CLUSTER_NAME | ||
properties: | ||
creationTimestamp: .metadata.creationTimestamp | ||
labels: .metadata.labels | ||
relations: | ||
Cluster: env.CLUSTER_NAME | ||
title: .metadata.name | ||
selector: | ||
query: .metadata.name | startswith("kube") | not | ||
- kind: v1/namespaces | ||
port: | ||
entity: | ||
mappings: | ||
- blueprint: '"cluster"' | ||
identifier: env.CLUSTER_NAME | ||
title: env.CLUSTER_NAME | ||
selector: | ||
query: .metadata.name | contains("kube-system") | ||
- kind: apps/v1/deployments | ||
port: | ||
entity: | ||
mappings: | ||
- blueprint: '"workload"' | ||
icon: '"Deployment"' | ||
identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + env.CLUSTER_NAME | ||
properties: | ||
images: '(.spec.template.spec.containers | map({name, image, resources})) | map("\(.name): \(.image)")' | ||
availableReplicas: .status.availableReplicas | ||
containers: (.spec.template.spec.containers | map({name, image, resources})) | ||
creationTimestamp: .metadata.creationTimestamp | ||
hasLatest: .spec.template.spec.containers[].image | contains(":latest") | ||
hasLimits: .spec.template.spec.containers | all(has("resources") and (.resources.limits.memory | ||
and .resources.limits.cpu)) | ||
hasPrivileged: .spec.template.spec.containers | [.[].securityContext.privileged] | ||
| any | ||
isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" | ||
else "Unhealthy" end | ||
kind: '"Deployment"' | ||
labels: .metadata.labels | ||
replicas: .spec.replicas | ||
strategy: .spec.strategy.type | ||
strategyConfig: .spec.strategy // {} | ||
relations: | ||
Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME | ||
title: .metadata.name | ||
selector: | ||
query: .metadata.namespace | startswith("kube") | not | ||
- kind: apps/v1/daemonsets | ||
port: | ||
entity: | ||
mappings: | ||
- blueprint: '"workload"' | ||
identifier: .metadata.name + "-DaemonSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME | ||
properties: | ||
availableReplicas: .status.availableReplicas | ||
containers: (.spec.template.spec.containers | map({name, image, resources})) | ||
creationTimestamp: .metadata.creationTimestamp | ||
hasLatest: .spec.template.spec.containers[].image | contains(":latest") | ||
hasLimits: .spec.template.spec.containers | all(has("resources") and (.resources.limits.memory | ||
and .resources.limits.cpu)) | ||
hasPrivileged: .spec.template.spec.containers | [.[].securityContext.privileged] | ||
| any | ||
isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" | ||
else "Unhealthy" end | ||
kind: '"DaemonSet"' | ||
labels: .metadata.labels | ||
replicas: .spec.replicas | ||
strategyConfig: .spec.strategy // {} | ||
relations: | ||
Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME | ||
title: .metadata.name | ||
selector: | ||
query: .metadata.namespace | startswith("kube") | not | ||
- kind: apps/v1/statefulsets | ||
port: | ||
entity: | ||
mappings: | ||
- blueprint: '"workload"' | ||
identifier: .metadata.name + "-StatefulSet-" + .metadata.namespace + "-" + env.CLUSTER_NAME | ||
properties: | ||
availableReplicas: .status.availableReplicas | ||
containers: (.spec.template.spec.containers | map({name, image, resources})) | ||
creationTimestamp: .metadata.creationTimestamp | ||
hasLatest: .spec.template.spec.containers[].image | contains(":latest") | ||
hasLimits: .spec.template.spec.containers | all(has("resources") and (.resources.limits.memory | ||
and .resources.limits.cpu)) | ||
hasPrivileged: .spec.template.spec.containers | [.[].securityContext.privileged] | ||
| any | ||
isHealthy: if .spec.replicas == .status.availableReplicas then "Healthy" | ||
else "Unhealthy" end | ||
kind: '"StatefulSet"' | ||
labels: .metadata.labels | ||
replicas: .spec.replicas | ||
strategyConfig: .spec.strategy // {} | ||
relations: | ||
Namespace: .metadata.namespace + "-" + env.CLUSTER_NAME | ||
title: .metadata.name | ||
selector: | ||
query: .metadata.namespace | startswith("kube") | not |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
[ | ||
{ | ||
"identifier": "cluster", | ||
"description": "This blueprint represents a Kubernetes Cluster", | ||
"title": "Cluster", | ||
"icon": "Cluster", | ||
"schema": { | ||
"properties": {}, | ||
"required": [] | ||
}, | ||
"mirrorProperties": {}, | ||
"calculationProperties": {}, | ||
"relations": {} | ||
}, | ||
{ | ||
"identifier": "namespace", | ||
"description": "This blueprint represents a k8s Namespace", | ||
"title": "Namespace", | ||
"icon": "Environment", | ||
"schema": { | ||
"properties": { | ||
"creationTimestamp": { | ||
"type": "string", | ||
"title": "Created", | ||
"format": "date-time", | ||
"description": "When the Namespace was created" | ||
}, | ||
"labels": { | ||
"type": "object", | ||
"title": "Labels", | ||
"description": "Labels of the Namespace" | ||
} | ||
}, | ||
"required": [] | ||
}, | ||
"mirrorProperties": {}, | ||
"calculationProperties": {}, | ||
"relations": { | ||
"Cluster": { | ||
"title": "Cluster", | ||
"description": "The namespace's Kubernetes cluster", | ||
"target": "cluster", | ||
"required": false, | ||
"many": false | ||
} | ||
} | ||
}, | ||
{ | ||
"identifier": "workload", | ||
"description": "This blueprint represents a k8s Workload. This includes all k8s objects which can create pods (deployments[replicasets], daemonsets, statefulsets...)", | ||
"title": "Workload", | ||
"icon": "Deployment", | ||
"schema": { | ||
"properties": { | ||
"availableReplicas": { | ||
"type": "number", | ||
"title": "Running Replicas", | ||
"description": "Current running replica count" | ||
}, | ||
"containers": { | ||
"type": "array", | ||
"title": "Containers", | ||
"default": [], | ||
"description": "The containers for each pod instance of the Workload" | ||
}, | ||
"creationTimestamp": { | ||
"type": "string", | ||
"title": "Created", | ||
"format": "date-time", | ||
"description": "When the Workload was created" | ||
}, | ||
"labels": { | ||
"type": "object", | ||
"title": "Labels", | ||
"description": "Labels of the Workload" | ||
}, | ||
"replicas": { | ||
"type": "number", | ||
"title": "Wanted Replicas", | ||
"description": "Wanted replica count" | ||
}, | ||
"strategy": { | ||
"type": "string", | ||
"title": "Strategy", | ||
"description": "Rollout Strategy" | ||
}, | ||
"hasPrivileged": { | ||
"type": "boolean", | ||
"title": "Has Privileged Container" | ||
}, | ||
"hasLatest": { | ||
"type": "boolean", | ||
"title": "Has 'latest' tag", | ||
"description": "Has Container with 'latest' as image tag" | ||
}, | ||
"hasLimits": { | ||
"type": "boolean", | ||
"title": "All containers have limits" | ||
}, | ||
"isHealthy": { | ||
"type": "string", | ||
"enum": [ | ||
"Healthy", | ||
"Unhealthy" | ||
], | ||
"enumColors": { | ||
"Healthy": "green", | ||
"Unhealthy": "red" | ||
}, | ||
"title": "Workload Health" | ||
}, | ||
"kind": { | ||
"title": "Workload Kind", | ||
"description": "The kind of Workload", | ||
"type": "string", | ||
"enum": [ | ||
"StatefulSet", | ||
"DaemonSet", | ||
"Deployment", | ||
"Rollout" | ||
] | ||
}, | ||
"strategyConfig": { | ||
"type": "object", | ||
"title": "Strategy Config", | ||
"description": "The workloads rollout strategy" | ||
} | ||
}, | ||
"required": [] | ||
}, | ||
"mirrorProperties": { | ||
"Cluster": { | ||
"title": "Cluster", | ||
"path": "Namespace.Cluster.$title" | ||
}, | ||
"namespace": { | ||
"title": "Namespace", | ||
"path": "Namespace.$title" | ||
} | ||
}, | ||
"calculationProperties": {}, | ||
"relations": { | ||
"Namespace": { | ||
"title": "Namespace", | ||
"target": "namespace", | ||
"required": false, | ||
"many": false | ||
} | ||
} | ||
} | ||
] |
Oops, something went wrong.