Skip to content

Commit b00e3e5

Browse files
Merge pull request #141 from CleverCloud/clg/azimutt
feat: add Azimutt custom resource definition
2 parents 7872a41 + 0bf263a commit b00e3e5

26 files changed

Lines changed: 782 additions & 116 deletions

Cargo.lock

Lines changed: 20 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ axum = { version = "^0.8.1", default-features = false, features = [
2626
base64 = "^0.22.1"
2727
chrono = { version = "^0.4.40", default-features = false }
2828
clap = { version = "^4.5.32", features = ["derive"] }
29-
clevercloud-sdk = { version = "^0.13.6", features = ["jsonschemas"] }
29+
clevercloud-sdk = { version = "^0.14.0", features = ["jsonschemas"] }
3030
config = "^0.15.9"
3131
futures = "^0.3.31"
3232
hostname = "^0.4.0"

deployments/kubernetes/v1.30.0/10-custom-resource-definition.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,3 +1005,77 @@ spec:
10051005
storage: true
10061006
subresources:
10071007
status: {}
1008+
1009+
---
1010+
apiVersion: apiextensions.k8s.io/v1
1011+
kind: CustomResourceDefinition
1012+
metadata:
1013+
name: azimutts.api.clever-cloud.com
1014+
spec:
1015+
group: api.clever-cloud.com
1016+
names:
1017+
categories: []
1018+
kind: Azimutt
1019+
plural: azimutts
1020+
shortNames: []
1021+
singular: azimutt
1022+
scope: Namespaced
1023+
versions:
1024+
- additionalPrinterColumns:
1025+
- description: Organisation
1026+
jsonPath: .spec.organisation
1027+
name: organisation
1028+
type: string
1029+
- description: Addon
1030+
jsonPath: .status.addon
1031+
name: addon
1032+
type: string
1033+
- description: Region
1034+
jsonPath: .spec.instance.region
1035+
name: region
1036+
type: string
1037+
- description: Instance
1038+
jsonPath: .spec.instance.plan
1039+
name: instance
1040+
type: string
1041+
name: v1
1042+
schema:
1043+
openAPIV3Schema:
1044+
description: Auto-generated derived type for Spec via `CustomResource`
1045+
properties:
1046+
spec:
1047+
properties:
1048+
instance:
1049+
properties:
1050+
plan:
1051+
type: string
1052+
region:
1053+
type: string
1054+
required:
1055+
- plan
1056+
- region
1057+
type: object
1058+
options:
1059+
default: {}
1060+
type: object
1061+
organisation:
1062+
type: string
1063+
required:
1064+
- instance
1065+
- organisation
1066+
type: object
1067+
status:
1068+
nullable: true
1069+
properties:
1070+
addon:
1071+
nullable: true
1072+
type: string
1073+
type: object
1074+
required:
1075+
- spec
1076+
title: Azimutt
1077+
type: object
1078+
served: true
1079+
storage: true
1080+
subresources:
1081+
status: {}

deployments/kubernetes/v1.30.0/20-deployment.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ rules:
5959
- matomos/status
6060
- otoroshis
6161
- otoroshis/status
62+
- azimutts
63+
- azimutts/status
6264
verbs:
6365
- get
6466
- list
@@ -184,4 +186,4 @@ spec:
184186
runAsGroup: 25000
185187
runAsUser: 20000
186188
restartPolicy: Always
187-
terminationGracePeriodSeconds: 30
189+
terminationGracePeriodSeconds: 30

examples/kubernetes/18-metabase-addon.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
organisation: orga_<uuid v4>
99
instance:
1010
region: par
11-
plan: plan_2925d534-7155-4521-8052-d068d7ce8915 # corresponds to the 'base' plan
11+
plan: base
1212
---
1313
apiVersion: v1
1414
kind: ServiceAccount

examples/kubernetes/19-keycloak-addon.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
organisation: orga_<uuid v4>
99
instance:
1010
region: par
11-
plan: plan_3819e4b3-cc6d-4847-9f02-0db93212956c # corresponds to the 'base' plan
11+
plan: base
1212
---
1313
apiVersion: v1
1414
kind: ServiceAccount

examples/kubernetes/20-matomo-addon.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
organisation: orga_<uuid v4>
99
instance:
1010
region: par
11-
plan: plan_87283ba6-617c-420d-8e37-3350a2fcdd66 # corresponds to the 'beta' plan
11+
plan: beta
1212
---
1313
apiVersion: v1
1414
kind: ServiceAccount

examples/kubernetes/21-otoroshi-addon.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
organisation: orga_<uuid v4>
99
instance:
1010
region: par
11-
plan: plan_d738ee0f-8720-499a-8067-2fca53a2665a # corresponds to the 'base' plan
11+
plan: base
1212
---
1313
apiVersion: v1
1414
kind: ServiceAccount
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
apiVersion: api.clever-cloud.com/v1
3+
kind: Azimutt
4+
metadata:
5+
namespace: default
6+
name: azimutt
7+
spec:
8+
organisation: orga_<uuid v4>
9+
instance:
10+
region: par
11+
plan: free
12+
---
13+
apiVersion: v1
14+
kind: ServiceAccount
15+
metadata:
16+
labels:
17+
app: debian-azimutt
18+
name: debian-azimutt
19+
namespace: default
20+
---
21+
apiVersion: policy/v1
22+
kind: PodDisruptionBudget
23+
metadata:
24+
name: debian-azimutt
25+
namespace: default
26+
spec:
27+
minAvailable: 0
28+
selector:
29+
matchLabels:
30+
app: debian-azimutt
31+
---
32+
apiVersion: networking.k8s.io/v1
33+
kind: NetworkPolicy
34+
metadata:
35+
name: debian-azimutt
36+
namespace: default
37+
spec:
38+
podSelector:
39+
matchLabels:
40+
app: debian-azimutt
41+
policyTypes:
42+
- Ingress
43+
- Egress
44+
ingress:
45+
- {}
46+
egress:
47+
- {}
48+
---
49+
apiVersion: apps/v1
50+
kind: Deployment
51+
metadata:
52+
namespace: default
53+
name: debian-azimutt
54+
labels:
55+
app: debian-azimutt
56+
spec:
57+
replicas: 1
58+
selector:
59+
matchLabels:
60+
app: debian-azimutt
61+
template:
62+
metadata:
63+
labels:
64+
app: debian-azimutt
65+
spec:
66+
serviceAccountName: debian-azimutt
67+
automountServiceAccountToken: true
68+
containers:
69+
- image: debian:bullseye-slim
70+
imagePullPolicy: Always
71+
name: debian-azimutt
72+
command:
73+
- "sleep"
74+
- "3600"
75+
env: []
76+
resources:
77+
requests:
78+
memory: 64M
79+
cpu: 100m
80+
limits:
81+
memory: 64M
82+
cpu: 100m

src/cmd/crd.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use crate::{
1414
svc::{
1515
cfg::Configuration,
1616
crd::{
17-
config_provider::ConfigProvider, elasticsearch::ElasticSearch, keycloak::Keycloak,
18-
kv::KV, matomo::Matomo, metabase::Metabase, mongodb::MongoDb, mysql::MySql,
19-
otoroshi::Otoroshi, postgresql::PostgreSql, pulsar::Pulsar, redis::Redis,
17+
azimutt::Azimutt, config_provider::ConfigProvider, elasticsearch::ElasticSearch,
18+
keycloak::Keycloak, kv::KV, matomo::Matomo, metabase::Metabase, mongodb::MongoDb,
19+
mysql::MySql, otoroshi::Otoroshi, postgresql::PostgreSql, pulsar::Pulsar, redis::Redis,
2020
},
2121
},
2222
};
@@ -38,6 +38,7 @@ pub enum CustomResource {
3838
Keycloak,
3939
Matomo,
4040
Otoroshi,
41+
Azimutt,
4142
}
4243

4344
impl FromStr for CustomResource {
@@ -58,10 +59,11 @@ impl FromStr for CustomResource {
5859
"keycloak" => Ok(Self::Keycloak),
5960
"matomo" => Ok(Self::Matomo),
6061
"otoroshi" => Ok(Self::Otoroshi),
62+
"azimutt" => Ok(Self::Azimutt),
6163
_ => Err(format!(
6264
"failed to parse '{s}', available options are: 'postgresql', 'redis', \
6365
'mysql', 'mongodb, 'pulsar', 'config-server', 'elasticsearch', 'kv', \
64-
'metabase', 'keycloak', 'matomo' and 'otoroshi'"
66+
'metabase', 'keycloak', 'matomo', 'otoroshi' and 'azimutt'"
6567
)
6668
.into()),
6769
}
@@ -135,6 +137,8 @@ pub async fn view(
135137
.map_err(CustomResourceDefinitionError::Serialize)?,
136138
CustomResource::Otoroshi => serde_yaml::to_string(&Otoroshi::crd())
137139
.map_err(CustomResourceDefinitionError::Serialize)?,
140+
CustomResource::Azimutt => serde_yaml::to_string(&Azimutt::crd())
141+
.map_err(CustomResourceDefinitionError::Serialize)?,
138142
}]
139143
} else {
140144
vec![
@@ -161,6 +165,8 @@ pub async fn view(
161165
.map_err(CustomResourceDefinitionError::Serialize)?,
162166
serde_yaml::to_string(&Otoroshi::crd())
163167
.map_err(CustomResourceDefinitionError::Serialize)?,
168+
serde_yaml::to_string(&Azimutt::crd())
169+
.map_err(CustomResourceDefinitionError::Serialize)?,
164170
]
165171
};
166172

0 commit comments

Comments
 (0)