This commit is contained in:
		
							parent
							
								
									2eedcb2963
								
							
						
					
					
						commit
						fd4424f5ff
					
				
							
								
								
									
										33
									
								
								src/neon.rs
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								src/neon.rs
									
									
									
									
									
								
							@ -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()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user