Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port 5363 UI create default resources #20

Merged
merged 38 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9c2efe3
default resources
yairsimantov20 Dec 13, 2023
b5d6718
imports
yairsimantov20 Dec 13, 2023
d2ca0fd
Merge branch 'PORT-5363-ui-for-the-kubernetes-exporter-moving-the-con…
yairsimantov20 Dec 13, 2023
9d40a7d
Merge remote-tracking branch 'origin/PORT-5363-ui-for-the-kubernetes-…
yairsimantov20 Dec 13, 2023
de5e006
Merge remote-tracking branch 'origin/PORT-5363-ui-for-the-kubernetes-…
yairsimantov20 Dec 13, 2023
0ad1ecf
Merge remote-tracking branch 'origin/PORT-5363-ui-for-the-kubernetes-…
yairsimantov20 Dec 13, 2023
205cfb3
fixed imports
yairsimantov20 Dec 13, 2023
6ff6dad
fixed defaults behavior
yairsimantov20 Dec 14, 2023
1383405
Merge remote-tracking branch 'origin/PORT-5363-ui-for-the-kubernetes-…
yairsimantov20 Dec 20, 2023
34b8a32
fixed init integration.go
yairsimantov20 Dec 20, 2023
6194ac8
removed whitespace
yairsimantov20 Dec 20, 2023
b29c7b8
Merge remote-tracking branch 'origin/PORT-5363-ui-for-the-kubernetes-…
yairsimantov20 Dec 20, 2023
926be7e
cr fixes
yairsimantov20 Dec 20, 2023
48d5295
update naming
yairsimantov20 Dec 20, 2023
f34bf6b
fixed pr conflicts
yairsimantov20 Dec 22, 2023
281c440
comment
yairsimantov20 Dec 22, 2023
8be7fc7
renaming
yairsimantov20 Dec 22, 2023
f763647
defaults tests
yairsimantov20 Dec 24, 2023
bc5ceb6
removed error printing for the .env file
yairsimantov20 Dec 24, 2023
ef56c38
removed a comment
yairsimantov20 Dec 24, 2023
c7d2801
fix tests
yairsimantov20 Dec 24, 2023
b4a5270
allow configuring if resources should be created
yairsimantov20 Dec 24, 2023
2378a36
moved configuration
yairsimantov20 Dec 25, 2023
e48d782
fixed tests
yairsimantov20 Dec 25, 2023
9f685ed
fixed tests
yairsimantov20 Dec 25, 2023
b8c8cde
pr comments
yairsimantov20 Dec 25, 2023
8a7a69e
more comments
yairsimantov20 Dec 25, 2023
a298f08
omit calculation
yairsimantov20 Dec 25, 2023
9d63dcc
aggregation properties
yairsimantov20 Dec 25, 2023
22ec10f
deleting blueprints at the start
yairsimantov20 Dec 25, 2023
0599ab3
fixed tests
yairsimantov20 Dec 25, 2023
dc887c3
switch to klog
yairsimantov20 Dec 25, 2023
0de6337
wrapped signal with mutex
yairsimantov20 Dec 25, 2023
1566804
removed service from defaults
yairsimantov20 Dec 25, 2023
5d78b84
removed service from defaults
yairsimantov20 Dec 25, 2023
161e6ec
overriding configs
yairsimantov20 Dec 26, 2023
50f60c2
statekey to lower
yairsimantov20 Dec 26, 2023
7e18cab
supporting delete dependents deprecated
yairsimantov20 Dec 27, 2023
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ __debug_bin
config.yaml

deployments/k8s

.env
117 changes: 117 additions & 0 deletions assets/defaults/appConfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
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
- kind: apps/v1/deployments
port:
entity:
mappings:
- blueprint: '"service"'
icon: '"Deployment"'
identifier: .metadata.name + "-Deployment-" + .metadata.namespace + "-" + env.CLUSTER_NAME
properties: {}
title: .metadata.name
selector:
query: .metadata.namespace | startswith("kube") | not
151 changes: 151 additions & 0 deletions assets/defaults/blueprints.json
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
}
}
}
]
Loading