Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chirpstack-operator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chirpstack-operator"
version = "0.3.3"
version = "0.3.4"
authors = ["Ole Kliemann <mail@olekliemann.de>", "Malte Groth <malte.groth@deepshore.de>"]
edition = "2021"

Expand Down
7 changes: 7 additions & 0 deletions chirpstack-operator/src/builder/server/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ pub fn build(chirpstack: &Chirpstack, dependent_hash: String) -> Deployment {
chirpstack.spec.server.workload.image.tag
);

let image_pull_policy = chirpstack
.spec
.server
.workload
.image_pull_policy.to_string();

let mut env_vars = vec![EnvVar {
name: "CHIRPSTACK_SERVER_POD_NAME".to_string(),
value_from: Some(k8s_openapi::api::core::v1::EnvVarSource {
Expand Down Expand Up @@ -104,6 +110,7 @@ pub fn build(chirpstack: &Chirpstack, dependent_hash: String) -> Deployment {
env_from: chirpstack.spec.server.configuration.env_from.clone(),
ports: Some(ports),
volume_mounts: Some(volume_mounts),
image_pull_policy: Some(image_pull_policy),
..Default::default()
};

Expand Down
19 changes: 18 additions & 1 deletion chirpstack-operator/src/crd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub mod spec {
}

pub mod workload {
use super::super::super::types::{Image, KeyValue, WorkloadType};
use super::super::super::types::{Image, ImagePullPolicy, KeyValue, WorkloadType};
use k8s_openapi::api::core::v1::EnvVar;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
Expand All @@ -56,6 +56,8 @@ pub mod spec {
pub pod_labels: Vec<KeyValue>,
#[serde(default)]
pub extra_env_vars: Vec<EnvVar>,
#[serde(default)]
pub image_pull_policy: ImagePullPolicy,
}

fn default_image() -> Image {
Expand Down Expand Up @@ -262,6 +264,21 @@ pub mod types {
pub tag: String,
}

#[derive(Debug, Serialize, Deserialize, Default, Clone, JsonSchema, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub enum ImagePullPolicy {
#[default]
Always,
IfNotPresent,
Never,
}

impl fmt::Display for ImagePullPolicy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{self:?}")
}
}

#[derive(Debug, Serialize, Deserialize, Default, Clone, JsonSchema)]
#[serde(rename_all = "camelCase")]
pub struct KeyValue {
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/applications.deepshore.de_chirpstacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ spec:
- repository
- tag
type: object
imagePullPolicy:
default: Always
enum:
- Always
- IfNotPresent
- Never
type: string
podAnnotations:
default: []
items:
Expand Down
Loading