WIP: start working on tests #1
							
								
								
									
										31
									
								
								src/neon.rs
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								src/neon.rs
									
									
									
									
									
								
							@ -3,6 +3,7 @@ use k8s_openapi::api::core::v1::{
 | 
			
		||||
    Container, ContainerPort, EnvVar, PodSpec, PodTemplateSpec, Service, ServicePort, ServiceSpec,
 | 
			
		||||
};
 | 
			
		||||
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, Client, Error};
 | 
			
		||||
use std::collections::BTreeMap;
 | 
			
		||||
@ -414,16 +415,38 @@ pub async fn reconcile_compute(
 | 
			
		||||
                    containers: vec![Container {
 | 
			
		||||
                        name: "compute".to_string(),
 | 
			
		||||
                        image: Some(compute_image.to_string()),
 | 
			
		||||
                        ports: Some(vec![ContainerPort {
 | 
			
		||||
                            container_port: 9898,
 | 
			
		||||
 | 
			
		||||
                        ports: Some(vec![
 | 
			
		||||
                            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 {
 | 
			
		||||
                            name: "PG_VERSION".to_string(),
 | 
			
		||||
                            value: Some("15".to_string()),
 | 
			
		||||
                            ..Default::default()
 | 
			
		||||
                        }]),
 | 
			
		||||
                        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()
 | 
			
		||||
@ -445,7 +468,7 @@ pub async fn reconcile_compute(
 | 
			
		||||
        spec: Some(ServiceSpec {
 | 
			
		||||
            selector: Some(BTreeMap::from([("app".to_string(), "compute".to_string())])),
 | 
			
		||||
            ports: Some(vec![ServicePort {
 | 
			
		||||
                port: 9898,
 | 
			
		||||
                port: 55433,
 | 
			
		||||
                ..Default::default()
 | 
			
		||||
            }]),
 | 
			
		||||
            ..Default::default()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user