C7RXNVX5R4VIHPPWMBN27S7UA742QWVRMGWET3O4LUSPYYI62C3QC
U66KCVZMSQF6B4S3V3TBN4P4KKP4CWCEX7XB63QCMLPLN7V5NSWQC
FGD37V6XCUCI6IJGJP4SU4EFNEE7F3GQVBYJNK4XT2AYY34OCUTQC
DTAFS7PQQ6X2REJYR6EDKEM7TOKGIAX2YHIRRU354AOAFR2B3VIQC
6WWZUDNYHVYEQJHHJCUBMOZME2LG4SATAXSADBECKPBUGR3QLYTAC
SCCMQCSX6BA6DQKARGW25PVWQPU3MZNZS4RNZ53FXYFCKMI24RGQC
4MK5VE34SUDTEN2C2VVFBEONHGFY3P3EDTEK2WPU7RH5IWDAT3DQC
RQHPHZ6GVNUXCI4ZMV6UBGRGJZJHIAQVGCBUAUMMDNKRJJW76TJAC
TFHE7SKK7K6UKJM3ATI2OU3QWX4YVAHHIFAAVLNIMA6EUZGZJWFAC
- suffix:
/metadata/name: '-web'
- filter:
/kind: Deployment
/metadata/name: test-web
add:
- filters:
- /kind: Deployment
/metadata/name: test-web
patches:
name: http
containerPort: 8080
/spec/revisionHistoryLimit: 3
/spec/strategy/rollingUpdate/maxUnavailable: 0
/spec/strategy/rollingUpdate/maxSurge: 50%
add:
name: http
containerPort: 8080
/spec/revisionHistoryLimit:
add: 3
/spec/strategy/rollingUpdate/maxUnavailable:
add: 0
/spec/strategy/rollingUpdate/maxSurge:
add: 50%
for field in self.fields() {
result = result
.get_mut(field)
.expect("Field {field} wasn't found");
Self::walk(&mut result, fields);
return result;
}
pub fn create_mut<'a>(&'a self, doc: &'a mut Value) -> &mut Value {
let mut result = doc;
let mut fields = self.fields();
if let Some(new_field) = fields.pop() {
Self::walk(&mut result, fields);
}
fn walk(mut result: &mut Value, fields: Vec<String>) -> &mut Value {
for field in fields {
if let Ok(number) = field.parse::<usize>() {
result = result
.get_mut(number)
.expect("Field {field} wasn't found");
} else {
result = result
.get_mut(field)
.expect("Field {field} wasn't found");
}
}
return result;
apiVersion: karbon/v1alpha1
kind: Karbonfile
resources:
? deployment.yml
transformations:
- filters:
- /metadata/name: test
patches:
/spec/template/spec/containers/0/ports/-:
add:
name: http
containerPort: 8080
/spec/revisionHistoryLimit:
replace: 3
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: test
name: test
spec:
revisionHistoryLimit: 10
replicas: 1
selector:
matchLabels:
app: test
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: test
spec:
containers:
- image: bash
name: bash
resources: {}
status: {}