Skip to content

Commit 93f8db5

Browse files
committed
Basic functioning loki implementation on AKS
1 parent 06e26ef commit 93f8db5

2 files changed

Lines changed: 56 additions & 4 deletions

File tree

infra/fridge/access-cluster/components/monitoring.py

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import pulumi
12
from pulumi import ComponentResource, ResourceOptions
23
from pulumi_kubernetes.core.v1 import (
34
Namespace,
@@ -7,13 +8,14 @@
78
)
89
from pulumi_kubernetes.helm.v3 import Release, ReleaseArgs
910
from pulumi_kubernetes.meta.v1 import ObjectMetaArgs
10-
from pulumi_kubernetes.yaml import ConfigFile
11+
1112

1213
from enums import K8sEnvironment
1314

1415

1516
class MonitoringArgs:
16-
def __init__(self, k8s_environment: K8sEnvironment):
17+
def __init__(self, config: pulumi.config.Config, k8s_environment: K8sEnvironment):
18+
self.config = config
1719
self.k8s_environment = k8s_environment
1820

1921

@@ -42,7 +44,7 @@ def __init__(
4244
"monitoring-operator",
4345
ReleaseArgs(
4446
chart="kube-prometheus-stack",
45-
version="81.6.3",
47+
version="82.0.0",
4648
repository_opts={
4749
"repo": "https://prometheus-community.github.io/helm-charts"
4850
},
@@ -62,8 +64,50 @@ def __init__(
6264
},
6365
namespace=monitoring_ns.metadata.name,
6466
create_namespace=False,
67+
values={
68+
"deploymentMode": "SingleBinary",
69+
"loki": {
70+
"auth_enabled": False,
71+
"commonConfig": {
72+
"replication_factor": 1,
73+
},
74+
"singleBinary": {
75+
"replicas": 1,
76+
"resources": {
77+
"requests": {"cpu": "500m", "memory": "512Mi"}
78+
},
79+
"persistence": {
80+
"enabled": True,
81+
"size": "10Gi",
82+
"storageClassName": "default",
83+
},
84+
},
85+
"storage": {
86+
"type": "azure",
87+
"azure": {
88+
"connectionString": args.config.require(
89+
"azure_storage_connection_string"
90+
),
91+
},
92+
"bucketNames": {
93+
"chunks": "loki-chunks",
94+
"ruler": "loki-ruler",
95+
},
96+
},
97+
"useTestSchema": True,
98+
},
99+
"chunksCache": {
100+
"enabled": False,
101+
},
102+
"resultsCache": {
103+
"enabled": False,
104+
},
105+
},
106+
),
107+
opts=ResourceOptions.merge(
108+
child_opts,
109+
ResourceOptions(depends_on=[prometheus_operator]),
65110
),
66-
opts=child_opts,
67111
)
68112
case K8sEnvironment.DAWN:
69113
# The namespace is already created on Dawn

infra/fridge/access-cluster/components/network_policies.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,11 @@ def __init__(
170170
file="./k8s/cilium/kube-system.yaml",
171171
opts=child_opts,
172172
)
173+
174+
# Add network policy to allow Prometheus monitoring for resources already deployed on Dawn
175+
# On Dawn, Prometheus is also already deployed
176+
ConfigFile(
177+
"network_policy_prometheus",
178+
file="./k8s/cilium/prometheus.yaml",
179+
opts=child_opts,
180+
)

0 commit comments

Comments
 (0)