Compare commits

..

20 Commits

Author SHA1 Message Date
Michael Francis 5714b48667 even older
Tests / test (pull_request) Failing after 33m20s Details
2024-09-11 22:59:48 +01:00
Michael Francis fd4424f5ff Missing updates?
Tests / test (pull_request) Failing after 33m52s Details
2024-09-11 21:24:54 +01:00
Michael Francis 2eedcb2963 add crd manually
Tests / test (pull_request) Failing after 32m43s Details
2024-09-11 21:23:59 +01:00
Michael Francis 10a755d41b even older 2024-09-11 21:20:45 +01:00
Michael Francis eb443e0f1b trying something different
Tests / test (pull_request) Failing after 1m45s Details
2024-09-11 21:12:55 +01:00
Michael Francis b79fc62599 trying something different
Tests / test (pull_request) Failing after 3m25s Details
2024-09-11 21:01:53 +01:00
Michael Francis 1da5d8955e doubt itll work
Tests / test (push) Failing after 25s Details
Tests / test (pull_request) Failing after 1m16s Details
2024-09-11 18:42:50 +01:00
Michael Francis 88400f1be2 old kind doesnt get cleaned up?
Tests / test (push) Failing after 1m39s Details
Tests / test (pull_request) Failing after 2m7s Details
2024-09-11 18:34:47 +01:00
Michael Francis 6c4f9e0ccc old kind doesnt get cleaned up?
Tests / test (push) Failing after 9s Details
Tests / test (pull_request) Failing after 10s Details
2024-09-11 18:33:01 +01:00
Michael Francis 228fe10ae8 maybe fix the network
Tests / test (push) Failing after 10s Details
Tests / test (pull_request) Failing after 10s Details
2024-09-11 18:31:36 +01:00
Michael Francis a365b32063 hmm
Tests / test (push) Failing after 1m54s Details
Tests / test (pull_request) Failing after 1m58s Details
2024-09-11 18:09:47 +01:00
Michael Francis 6615d9b5bd fix path 2024-09-11 17:57:27 +01:00
Michael Francis 28442ade62 WIP, fixing networking?
Tests / test (push) Failing after 4m54s Details
Tests / test (pull_request) Failing after 1m59s Details
2024-09-11 17:52:29 +01:00
Michael Francis d56ddfe8a6 WIP, fixing networking?
Tests / test (push) Failing after 2m0s Details
Tests / test (pull_request) Failing after 1m47s Details
2024-09-11 17:48:05 +01:00
Michael Francis a1f0eb2b9f WIP
Tests / test (push) Failing after 1m49s Details
Tests / test (pull_request) Failing after 1m51s Details
2024-09-11 17:31:50 +01:00
Michael Francis d41890df3f WIP
Tests / test (push) Failing after 1m47s Details
Tests / test (pull_request) Failing after 1m47s Details
2024-09-11 17:26:31 +01:00
Michael Francis 4b673506df WIP
Tests / test (push) Successful in 2m32s Details
Tests / test (pull_request) Successful in 1m45s Details
2024-09-11 17:20:18 +01:00
Michael Francis 2030a7d4f4 WIP
Tests / test (push) Successful in 1m12s Details
Tests / test (pull_request) Successful in 7s Details
2024-09-11 16:41:48 +01:00
Michael Francis 8908ebd6d1 add workflow dispatch 2024-09-11 15:03:02 +01:00
Michael Francis d5252cceda start working on tests 2024-09-11 14:59:14 +01:00
4 changed files with 58 additions and 6 deletions

24
.github/workflows/tests.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Kubernetes Tools
uses: yokawasa/action-setup-kube-tools@v0.11.1
with:
tilt: "v0.33.20"
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
- name: Run the tests
run: |
tilt ci

5
kind/kind-config-ci.yaml Normal file
View File

@ -0,0 +1,5 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
apiServerAddress: "127.0.0.1"
apiServerPort: 6443

View File

@ -4,5 +4,5 @@ metadata:
name: my-neon-database name: my-neon-database
spec: spec:
compute_image_ref: "melenion/compute-node-v15" compute_image_ref: "melenion/compute-node-v15"
neon_image_ref: "neondatabase/neon" neon_image_ref: "neondatabase/neon:release-5545"
postgres_version: "15" postgres_version: "15"

View File

@ -3,6 +3,7 @@ use k8s_openapi::api::core::v1::{
Container, ContainerPort, EnvVar, PodSpec, PodTemplateSpec, Service, ServicePort, ServiceSpec, Container, ContainerPort, EnvVar, PodSpec, PodTemplateSpec, Service, ServicePort, ServiceSpec,
}; };
use k8s_openapi::apimachinery::pkg::apis::meta::v1::{LabelSelector, OwnerReference}; use k8s_openapi::apimachinery::pkg::apis::meta::v1::{LabelSelector, OwnerReference};
use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
use kube::api::{ObjectMeta, Patch, PatchParams}; use kube::api::{ObjectMeta, Patch, PatchParams};
use kube::{Api, Client, Error}; use kube::{Api, Client, Error};
use std::collections::BTreeMap; use std::collections::BTreeMap;
@ -414,16 +415,38 @@ pub async fn reconcile_compute(
containers: vec![Container { containers: vec![Container {
name: "compute".to_string(), name: "compute".to_string(),
image: Some(compute_image.to_string()), image: Some(compute_image.to_string()),
ports: Some(vec![ContainerPort {
container_port: 9898, ports: Some(vec![
..Default::default() ContainerPort {
}]), container_port: 3080,
..Default::default()
},
// TODO: The port the compute node listens on comes from the spec,
// so it should be part of the CRD so it can be dynamically set
ContainerPort {
container_port: 55433,
..Default::default()
},
]),
env: Some(vec![EnvVar { env: Some(vec![EnvVar {
name: "PG_VERSION".to_string(), name: "PG_VERSION".to_string(),
value: Some("15".to_string()), value: Some("15".to_string()),
..Default::default() ..Default::default()
}]), }]),
command: Some(vec!["/shell/compute.sh".to_string()]), command: Some(vec!["/shell/compute.sh".to_string()]),
readiness_probe: Some(k8s_openapi::api::core::v1::Probe {
http_get: Some(k8s_openapi::api::core::v1::HTTPGetAction {
// HACK: This is a hack to get around the fact that most of the compute node's HTTP endppoints
// returns 200 OK event when the response contains an error message. Would be nice
// to fix that upstream, or write a small script to parse the reponse
// but I worry that'd be more fragile than using this endpoint
path: Some("/dbs_and_roles".to_string()),
port: IntOrString::Int(3080),
..Default::default()
}),
period_seconds: Some(1),
..Default::default()
}),
..Default::default() ..Default::default()
}], }],
..Default::default() ..Default::default()
@ -445,7 +468,7 @@ pub async fn reconcile_compute(
spec: Some(ServiceSpec { spec: Some(ServiceSpec {
selector: Some(BTreeMap::from([("app".to_string(), "compute".to_string())])), selector: Some(BTreeMap::from([("app".to_string(), "compute".to_string())])),
ports: Some(vec![ServicePort { ports: Some(vec![ServicePort {
port: 9898, port: 55433,
..Default::default() ..Default::default()
}]), }]),
..Default::default() ..Default::default()