Skip to content

Commit

Permalink
Add DNS Policy to fluent controller (#372)
Browse files Browse the repository at this point in the history
Signed-off-by: Wenjie Ma <[email protected]>
  • Loading branch information
euclidgame authored Oct 23, 2023
1 parent 693ca4a commit f926600
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions deploy/fluent/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ spec:
properties:
spec:
properties:
DNSPolicy:
type: string
affinity:
description: Affinity is a group of affinity scheduling rules.
nullable: true
Expand Down Expand Up @@ -557,6 +559,7 @@ spec:
nullable: true
type: array
required:
- DNSPolicy
- fluentBitConfigName
- image
- runtimeClassName
Expand Down
1 change: 1 addition & 0 deletions e2e/src/fluent_e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub fn fluent_bit() -> String {
fluentBitConfigName: fluent-bit-config
image: kubesphere/fluent-bit:v2.1.7
runtimeClassName: ''
DNSPolicy: ''
tolerations:
- operator: Exists
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ fn make_fluentbit_pod_spec(fb: &FluentBit) -> (pod_spec: PodSpec)
if !fb.spec().runtime_class_name().eq(&new_strlit("").to_string()) {
pod_spec.set_runtime_class_name(fb.spec().runtime_class_name());
}
if !fb.spec().dns_policy().eq(&new_strlit("").to_string()) {
pod_spec.set_dns_policy(fb.spec().dns_policy());
}
pod_spec
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ impl FluentBitSpec {
{
String::from_rust_string(self.inner.runtime_class_name.clone())
}

#[verifier(external_body)]
pub fn dns_policy(&self) -> (dns_policy: String)
ensures
dns_policy@ == self@.dns_policy,
{
String::from_rust_string(self.inner.dns_policy.clone())
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ pub open spec fn make_fluentbit_pod_spec(fb: FluentBitView) -> PodSpecView
} else {
PodSpecView::default().runtime_class_name
},
dns_policy: if fb.spec.dns_policy != new_strlit("")@ {
Some(fb.spec.dns_policy)
} else {
PodSpecView::default().dns_policy
},
..PodSpecView::default()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ pub struct FluentBitSpecView {
pub affinity: Option<AffinityView>,
pub node_selector: Map<StringView, StringView>,
pub runtime_class_name: StringView,
pub dns_policy: StringView,
}

impl FluentBitSpecView {}
Expand Down
2 changes: 2 additions & 0 deletions src/deps_hack/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ pub struct FluentBitSpec {
pub node_selector: std::collections::BTreeMap<String, String>,
#[serde(rename = "runtimeClassName")]
pub runtime_class_name: String,
#[serde(rename = "DNSPolicy")]
pub dns_policy: String,
}

#[derive(
Expand Down

0 comments on commit f926600

Please sign in to comment.