Skip to content

Commit 8a24a26

Browse files
committed
Initial commit
1 parent f1699bd commit 8a24a26

File tree

4 files changed

+226
-23
lines changed

4 files changed

+226
-23
lines changed

argocd/port.yaml

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
apiVersion: argoproj.io/v1alpha1
3+
kind: Application
4+
metadata:
5+
name: port-k8s-exporter
6+
namespace: argocd
7+
finalizers:
8+
- resources-finalizer.argocd.argoproj.io
9+
spec:
10+
project: production
11+
source:
12+
chart: port-k8s-exporter
13+
repoURL: https://port-labs.github.io/helm-charts
14+
targetRevision: 0.1.13
15+
helm:
16+
releaseName: port-k8s-exporter
17+
values: |-
18+
installCRDs: true
19+
secret:
20+
secrets:
21+
portClientId: CLIENT_ID
22+
portClientSecret: CLIENT_SECRET
23+
configMap:
24+
config:
25+
resources:
26+
- kind: v1/namespaces
27+
selector:
28+
query: .metadata.name | contains("kube-system")
29+
port:
30+
entity:
31+
mappings:
32+
- identifier: '"dot"'
33+
title: '"dot"'
34+
blueprint: '"cluster"'
35+
- kind: v1/namespaces
36+
selector:
37+
query: .metadata.environment == "true"
38+
port:
39+
entity:
40+
mappings:
41+
- identifier: .metadata.name + "-" + "dot"
42+
title: .metadata.labels.environment
43+
blueprint: '"environment"'
44+
relations:
45+
cluster: '"dot"'
46+
- kind: v1/namespaces
47+
selector:
48+
query: .metadata.name | startswith("kube") | not
49+
port:
50+
entity:
51+
mappings:
52+
- identifier: .metadata.name + "-" + "dot"
53+
title: .metadata.name
54+
blueprint: '"namespace"'
55+
properties:
56+
creationTimestamp: .metadata.creationTimestamp
57+
labels: .metadata.labels
58+
relations:
59+
Cluster: '"dot"'
60+
- kind: devopstoolkitseries.com/v1alpha1/appclaims
61+
selector:
62+
query: .spec.compositionSelector.matchLabels.type == "backend-db-google"
63+
port:
64+
entity:
65+
mappings:
66+
- identifier: .metadata.name + "-appclaim-" + .metadata.namespace + "-" + "dot"
67+
title: .metadata.name
68+
icon: '"Deployment"'
69+
blueprint: '"backend-app"'
70+
properties:
71+
url: '"https://github.com/" + .metadata.annotations.gitHubOrg + "/" + .metadata.annotations.gitHubRepo'
72+
language: go
73+
host: .spec.parameters.host
74+
db-version: .spec.parameters.db.version
75+
db-size: .spec.parameters.db.size
76+
labels: .metadata.labels
77+
relations:
78+
environment: .metadata.namespace + "-" + "dot"
79+
- kind: v1/nodes
80+
port:
81+
entity:
82+
mappings:
83+
- identifier: (.metadata.name) | (split(".")|join("_")) + "-" + "dot"
84+
title: .metadata.name + "-" + "dot"
85+
icon: '"Node"'
86+
blueprint: '"node"'
87+
properties:
88+
creationTimestamp: .metadata.creationTimestamp
89+
totalCPU: .status.allocatable.cpu
90+
totalMemory: .status.allocatable.memory
91+
labels: .metadata.labels
92+
kubeletVersion: .status.nodeInfo.kubeletVersion | split("-") | .[0]
93+
ready: .status.conditions[] | select(.type == "Ready") | .status
94+
relations:
95+
Cluster: '"dot"'
96+
- kind: v1/pods
97+
selector:
98+
query: .metadata.namespace | startswith("kube") | not
99+
port:
100+
entity:
101+
mappings:
102+
- identifier: .metadata.name + "-" + .metadata.namespace + "-" + "dot"
103+
title: .metadata.name
104+
icon: '"Microservices"'
105+
blueprint: '"pod"'
106+
properties:
107+
startTime: .status.startTime
108+
phase: .status.phase
109+
labels: .metadata.labels
110+
containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add)
111+
conditions: .status.conditions
112+
relations:
113+
Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "dot"
114+
destination:
115+
server: https://kubernetes.default.svc
116+
namespace: kyverno
117+
syncPolicy:
118+
automated:
119+
selfHeal: true
120+
prune: true
121+
syncOptions:
122+
- CreateNamespace=true
123+
- Replace=true

k8s/namespaces.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
annotations:
6+
environment: "true"
7+
name: production
8+
---
9+
apiVersion: v1
10+
kind: Namespace
11+
metadata:
12+
annotations:
13+
environment: "true"
14+
name: staging

port/backend-app-blueprint.json

-23
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,10 @@
4545
],
4646
"description": "DB size"
4747
},
48-
"availableReplicas": {
49-
"type": "number",
50-
"title": "Running Replicas",
51-
"description": "Current running replica count"
52-
},
5348
"labels": {
5449
"type": "object",
5550
"title": "Labels",
5651
"description": "Labels of the workload"
57-
},
58-
"containers": {
59-
"type": "array",
60-
"title": "Containers",
61-
"default": [],
62-
"description": "The containers for each pod instance of the workload"
63-
},
64-
"isHealthy": {
65-
"type": "string",
66-
"enum": [
67-
"Healthy",
68-
"Unhealthy"
69-
],
70-
"enumColors": {
71-
"Healthy": "green",
72-
"Unhealthy": "red"
73-
},
74-
"title": "Workload Health"
7552
}
7653
},
7754
"required": [

port/config.yaml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
resources:
2+
- kind: v1/namespaces
3+
selector:
4+
query: .metadata.name | contains("kube-system")
5+
port:
6+
entity:
7+
mappings:
8+
- identifier: '"dot"'
9+
title: '"dot"'
10+
blueprint: '"cluster"'
11+
- kind: v1/namespaces
12+
selector:
13+
query: .metadata.environment == "true"
14+
port:
15+
entity:
16+
mappings:
17+
- identifier: .metadata.name + "-" + "dot"
18+
title: .metadata.labels.environment
19+
blueprint: '"environment"'
20+
relations:
21+
cluster: '"dot"'
22+
- kind: v1/namespaces
23+
selector:
24+
query: .metadata.name | startswith("kube") | not
25+
port:
26+
entity:
27+
mappings:
28+
- identifier: .metadata.name + "-" + "dot"
29+
title: .metadata.name
30+
blueprint: '"namespace"'
31+
properties:
32+
creationTimestamp: .metadata.creationTimestamp
33+
labels: .metadata.labels
34+
relations:
35+
Cluster: '"dot"'
36+
- kind: devopstoolkitseries.com/v1alpha1/appclaims
37+
selector:
38+
query: .spec.compositionSelector.matchLabels.type == "backend-db-google"
39+
port:
40+
entity:
41+
mappings:
42+
- identifier: .metadata.name + "-appclaim-" + .metadata.namespace + "-" + "dot"
43+
title: .metadata.name
44+
icon: '"Deployment"'
45+
blueprint: '"backend-app"'
46+
properties:
47+
url: '"https://github.com/" + .metadata.annotations.gitHubOrg + "/" + .metadata.annotations.gitHubRepo'
48+
language: go
49+
host: .spec.parameters.host
50+
db-version: .spec.parameters.db.version
51+
db-size: .spec.parameters.db.size
52+
labels: .metadata.labels
53+
relations:
54+
environment: .metadata.namespace + "-" + "dot"
55+
- kind: v1/nodes
56+
port:
57+
entity:
58+
mappings:
59+
- identifier: (.metadata.name) | (split(".")|join("_")) + "-" + "dot"
60+
title: .metadata.name + "-" + "dot"
61+
icon: '"Node"'
62+
blueprint: '"node"'
63+
properties:
64+
creationTimestamp: .metadata.creationTimestamp
65+
totalCPU: .status.allocatable.cpu
66+
totalMemory: .status.allocatable.memory
67+
labels: .metadata.labels
68+
kubeletVersion: .status.nodeInfo.kubeletVersion | split("-") | .[0]
69+
ready: .status.conditions[] | select(.type == "Ready") | .status
70+
relations:
71+
Cluster: '"dot"'
72+
- kind: v1/pods
73+
selector:
74+
query: .metadata.namespace | startswith("kube") | not
75+
port:
76+
entity:
77+
mappings:
78+
- identifier: .metadata.name + "-" + .metadata.namespace + "-" + "dot"
79+
title: .metadata.name
80+
icon: '"Microservices"'
81+
blueprint: '"pod"'
82+
properties:
83+
startTime: .status.startTime
84+
phase: .status.phase
85+
labels: .metadata.labels
86+
containers: (.spec.containers | map({image, resources})) + .status.containerStatuses | group_by(.image) | map(add)
87+
conditions: .status.conditions
88+
relations:
89+
Node: (.spec.nodeName) | (split(".")|join("_")) + "-" + "dot"

0 commit comments

Comments
 (0)