Skip to content
Snippets Groups Projects
Commit 754d27a8 authored by tranoris's avatar tranoris
Browse files

adding new spec param for values yaml

parent 171fe4b2
No related branches found
No related tags found
No related merge requests found
eclipse.preferences.version=1
encoding//src/main/java=utf-8
encoding//src/main/resources=utf-8
encoding//src/test/java=utf-8
encoding//src/test/resources=utf-8
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
......@@ -371,8 +371,15 @@ public class SylvaMDResourceOperator {
createEmptyFile(deploymentFolder + "/secrets.yaml");
// Step 3: Modify values.yaml using SylvaMDResourceSpec
populateAndModifyValuesYaml(namespace, "values.sylvamd.configmaps.osl.etsi.org",
deploymentFolder + "/values.yaml", resourceClone.getSpec());
if ( resourceClone.getSpec().getValuesyaml() != null ) {
populateFileFromText(namespace, resourceClone.getSpec().getValuesyaml(),
deploymentFolder + "/values.yaml");
}else {
populateAndModifyValuesYaml(namespace, "values.sylvamd.configmaps.osl.etsi.org",
deploymentFolder + "/values.yaml", resourceClone.getSpec());
}
// Step 4: Populate kustomization.yaml and secrets.yaml from ConfigMaps
populateFileFromConfigMap(namespace, "kustomization.sylvamd.configmaps.osl.etsi.org",
......@@ -487,6 +494,22 @@ public class SylvaMDResourceOperator {
log.error("Error writing to file: {}", filePath, e);
}
}
private void populateFileFromText(String namespace, String text, String filePath) {
try {
if (text != null ) {
String content = text;
Files.write(Paths.get(filePath), content.getBytes());
log.info("Populated file {} from text {}", filePath, text);
} else {
log.error("Failed to write text: {}", text);
}
} catch (IOException e) {
log.error("Error writing to file: {}", filePath, e);
}
}
// Execute the shell script to apply the workload with the working directory set to
// /opt/sylva-core
......
......@@ -26,6 +26,7 @@ public class SylvaMDResourceSpec {
private int clusterControlPlaneReplicas;
private int clusterMd0Replicas;
private String valuesyaml;
}
......@@ -20,6 +20,8 @@ spec:
spec:
type: object
properties:
valuesyaml:
type: string
clusterControlPlaneReplicas:
type: string
clusterMd0Replicas:
......
apiVersion: controllers.osl.etsi.org/v1alpha1
kind: SylvaMDResource
metadata:
name: wc67890-bbccdd
spec:
valuesyaml: |
---
cluster:
capi_providers:
infra_provider: capo
bootstrap_provider: cabpr
capo:
image_key: ubuntu-jammy-plain-rke2-1-28-8 # OpenStack Glance image (key of image in sylva_diskimagebuilder_images/os_images)
ssh_key_name: sylva # OpenStack Nova SSH keypair is provided by runner context in CI
network_id: 7b490a0c-0f5c-4475-a436-e4bcbecc7f5e # OpenStack Neutron network id is provided by runner context in CI
flavor_name: cpu8.m16384.d40g
control_plane_az:
- nova
machine_deployments:
md0:
replicas: 2
capo:
failure_domain: nova
flavor_name: cpu8.m16384.d40g
control_plane_replicas: 1
openstack:
control_plane_affinity_policy: soft-anti-affinity
storageClass:
name: "rbd1"
type: "rbd1"
proxies:
http_proxy: ""
https_proxy: ""
no_proxy: ""
ntp:
enabled: false
servers:
# - 1.2.3.4
# - 1.2.3.5
sylva_diskimagebuilder_images:
ubuntu-jammy-plain-rke2-1-28-8:
enabled: true
ubuntu-jammy-plain-kubeadm-1-28-9:
enabled: true
......@@ -53,42 +53,3 @@ data:
ubuntu-jammy-plain-kubeadm-1-28-9:
enabled: true
units:
coredns:
kustomization_spec:
patches:
- target:
kind: ConfigMap
patch: |
- op: replace
path: /data/Corefile
value: |
${CLUSTER_DOMAIN}:53 {
errors
forward ${CLUSTER_DOMAIN} ${CLUSTER_VIRTUAL_IP}
}
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . /etc/resolv.conf {
max_concurrent 1000
}
cache 60
loop
reload
loadbalance
hosts {
10.1.3.2 glance.pnet nova.pnet neutron.pnet horizon.pnet cinder.pnet novncproxy.pnet keystone.pnet heat-api.pnet
fallthrough
fallthrough
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment