6WWZUDNYHVYEQJHHJCUBMOZME2LG4SATAXSADBECKPBUGR3QLYTAC
---
apiVersion: karbon/v1alpha1
kind: Karbonfile
resources:
- ../../base
transformations:
- target:
kind: Deployment
patches:
- op: add
path: /spec/template/spec/containers/0/command
value: ["web"]
- op: add
path: /spec/template/spec/containers/0/args
value: ["start", "-p", "8080"]
apiVersion: karbon/v1alpha1
kind: Karbonfile
resources:
? !karbonfile ../../base
? !files service.yml
? !files ingress.yml
transformations:
- nameSuffix: '-web'
- filter:
kind: Deployment
metadata:
name: test
add:
/spec/template/spec/containers/0/ports/-/containerPort: 8080
.spec.revisionHistoryLimit: 3
spec:
strategy:
rollingUpdate:
maxUnavailable: 0
maxSurge: 50%
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
creationTimestamp: null
name: test
spec:
rules:
- host: test.local
http:
paths:
- backend:
service:
name: test
port:
number: 8080
path: /
pathType: Exact
status:
loadBalancer: {}
apiVersion: karbon/v1alpha1
kind: Karbonfile
resources:
? !files deployment.yml
transformations: []
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: test
name: test
spec:
replicas: 1
selector:
matchLabels:
app: test
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: test
spec:
containers:
- image: bash
name: bash
resources: {}
status: {}
#[derive(Deserialize, Debug)]
#[derive(Deserialize, Clone, Debug)]
#[serde(rename_all = "lowercase")]
#[serde(deny_unknown_fields)]
enum Resource {
Files(PathBuf),
Karbonfile(PathBuf),
//Git { path: PathBuf },
}
impl Resource {
fn path(&self) -> PathBuf {
use Resource::*;
match self {
Files(p) => { p.clone() }
Karbonfile(p) => { p.clone() }
}
}
}
impl PartialEq for Resource {
fn eq(&self, other: &Self) -> bool {
self.path() == other.path()
}
}
impl Eq for Resource {}
impl Hash for Resource {
fn hash<H: Hasher>(&self, state: &mut H) {
use Resource::*;
match self {
Files(p) => p.hash(state),
Karbonfile(p) => p.hash(state),
}
}
}
#[derive(Deserialize, Clone, Debug)]
fn build_tree(path: PathBuf, mut branch: Vec<PathBuf>, result: &mut Vec<Vec<PathBuf>>) {
let canonical = find_resource_file(&path);
fn set_path(&mut self, p: PathBuf) {
self.resource_path = Some(p);
}
fn add_transformation(&mut self, p: PathBuf, t: Vec<Transformation>) {
self.transformations.insert(p, t);
}
}