diff --git a/docs/user/howto_config.md b/docs/user/howto_config.md index 647f0e0e3b..6d17c7dee3 100644 --- a/docs/user/howto_config.md +++ b/docs/user/howto_config.md @@ -294,4 +294,63 @@ driver, the cluster has no knowledge of the underlying storage interface and thu provisioning/deprovisioning or mount/unmount operations. Workloads with attached volumes must be manually stopped, and those volumes must then be manually deleted by the user. Once the MicroShift config `storage` section is specified with supported values, the user may restart MicroShift. They should see that MicroShift does not redeploy the disabled -components after restart. \ No newline at end of file +components after restart. + +## Drop-in configuration directory + +In addition to the existing `/etc/microshift/config.yaml` configuration file there is a `/etc/microshift/config.d` configuration directory where you can place fragments of configuration. + +At runtime, `/etc/microshift/config.yaml` and `.yaml` files inside `/etc/microshift/config.d` are merged together to create one configuration file which overrides the defaults. + +Files in `/etc/microshift/config.d` are sorted lexicographilly. It is recommended to use numerical prefix for easy reasoning about the priority of the fragments. + +For example, given following files: +- `/etc/microshift/config.yaml` +- `/etc/microshift/config.d/10-subjectAltNames.yaml` +- `/etc/microshift/config.d/20-kubelet.yaml` + +The final user config will be created by using `config.yaml` as a base, and then overwriting it with `10-subjectAltNames.yaml`, and then overwriting it with `20-kubelet.yaml`: +``` +20-kubelet.yaml + || + \/ +10-subjectAltNames.yaml + || + \/ +config.yaml +``` + +Some additional rules: +- Lists are not merged together, they are overwritten. For example: + ```yaml + # 10-san.yaml + apiServer: + subjectAltNames: + - host1 + - host2 + + # 20-san.yaml + apiServer: + subjectAltNames: + - hostZ + + # end result + apiServer: + subjectAltNames: + - hostZ + ``` +- Contents of `kubelet:` configuration are merged together (unless specific field is a list). For example: + ```yaml + # 10-kubelet.yaml + kubelet: + some_setting: True + + # 20-kubelet.yaml + kubelet: + another_setting: True + + # end result + kubelet: + some_setting: True + another_setting: True + ``` diff --git a/packaging/rpm/microshift.spec b/packaging/rpm/microshift.spec index 807c3496f0..3f01517d30 100644 --- a/packaging/rpm/microshift.spec +++ b/packaging/rpm/microshift.spec @@ -263,6 +263,7 @@ install -p -m644 packaging/systemd/microshift.service %{buildroot}%{_unitdir}/mi install -d -m755 %{buildroot}/%{_sysconfdir}/microshift install -d -m755 %{buildroot}/%{_sysconfdir}/microshift/manifests install -d -m755 %{buildroot}/%{_sysconfdir}/microshift/manifests.d +install -d -m755 %{buildroot}/%{_sysconfdir}/microshift/config.d install -p -m644 packaging/microshift/config.yaml %{buildroot}%{_sysconfdir}/microshift/config.yaml.default install -p -m644 packaging/microshift/lvmd.yaml %{buildroot}%{_sysconfdir}/microshift/lvmd.yaml.default install -p -m644 packaging/microshift/ovn.yaml %{buildroot}%{_sysconfdir}/microshift/ovn.yaml.default @@ -446,6 +447,7 @@ fi %{_sysconfdir}/crio/crio.conf.d/10-microshift.conf %{_datadir}/microshift/spec/config-openapi-spec.json %dir %{_sysconfdir}/microshift +%dir %{_sysconfdir}/microshift/config.d %dir %{_sysconfdir}/microshift/manifests %dir %{_sysconfdir}/microshift/manifests.d %config(noreplace) %{_sysconfdir}/microshift/config.yaml.default @@ -519,6 +521,9 @@ fi # Use Git command to generate the log and replace the VERSION string # LANG=C git log --date="format:%a %b %d %Y" --pretty="tformat:* %cd %an <%ae> VERSION%n- %s%n" packaging/rpm/microshift.spec %changelog +* Fri Aug 30 2024 Patryk Matuszak 4.18.0 +- Support for config drop-in directory + * Mon Aug 26 2024 Nadia Pinaeva 4.17.0 - Update openvswitch to 3.4 diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 3520500302..4d36dbbed2 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -392,7 +392,7 @@ func TestGetActiveConfigFromYAML(t *testing.T) { for _, tt := range ttests { t.Run(tt.name, func(t *testing.T) { - config, err := getActiveConfigFromYAML([]byte(tt.config)) + config, err := getActiveConfigFromYAMLDropins([][]byte{[]byte(tt.config)}) // If we have any warnings, drop them. Use an empty array // instead of nil so that we can differentiate between // unexpected warnings (where we get an array instead of @@ -418,6 +418,78 @@ func TestGetActiveConfigFromYAML(t *testing.T) { } }) } + + t.Run("multiple-drop-ins", func(t *testing.T) { + dropins := [][]byte{ + // Individual fields should be overwritten + []byte(dedent(` + ingress: + ports: + http: 1234 + https: 9876 + `)), + []byte(dedent(` + ingress: + ports: + http: 2345 + `)), + []byte(dedent(` + ingress: + ports: + https: 8765 + `)), + + // Arrays are overwritten completely (no addition) + []byte(dedent(` + ingress: + listenAddress: + - eth1 + - eth2 + `)), + []byte(dedent(` + ingress: + listenAddress: + - lo + `)), + + // Even though kubelet is map[string]any, we want to merge individual settings + []byte(dedent(` + kubelet: + cpuManagerPolicy: static + evictionHard: + imagefs.available: 15% + memory.available: 100Mi + `)), + []byte(dedent(` + kubelet: + memoryManagerPolicy: Static + evictionHard: + nodefs.available: 10% + nodefs.inodesFree: 5% + `)), + } + + expected := mkDefaultConfig() + expected.Ingress.Ports.Http = ptr.To[int](2345) + expected.Ingress.Ports.Https = ptr.To[int](8765) + expected.Ingress.ListenAddress = []string{"lo"} + expected.Kubelet = map[string]any{ + "cpuManagerPolicy": "static", + "memoryManagerPolicy": "Static", + "evictionHard": map[string]any{ + "imagefs.available": "15%", + "memory.available": "100Mi", + "nodefs.available": "10%", + "nodefs.inodesFree": "5%", + }, + } + + config, err := getActiveConfigFromYAMLDropins(dropins) + assert.NoError(t, err) + + config.userSettings = nil + assert.Equal(t, expected, config) + }) } // Test the validation logic diff --git a/pkg/config/files.go b/pkg/config/files.go index 6078040b90..f944e41222 100644 --- a/pkg/config/files.go +++ b/pkg/config/files.go @@ -1,64 +1,127 @@ package config import ( + "encoding/json" "fmt" + "io/fs" "os" + "path/filepath" + "strings" + jsonpatch "github.com/evanphx/json-patch" + "github.com/openshift/microshift/pkg/util" "sigs.k8s.io/yaml" ) const ( - ConfigFile = "/etc/microshift/config.yaml" - DataDir = "/var/lib/microshift" - BackupsDir = "/var/lib/microshift-backups" + ConfigFile = "/etc/microshift/config.yaml" + DataDir = "/var/lib/microshift" + BackupsDir = "/var/lib/microshift-backups" + ConfigDropInDir = "/etc/microshift/config.d" ) -func parse(contents []byte) (*Config, error) { - c := &Config{} - if err := yaml.Unmarshal(contents, c); err != nil { - return nil, fmt.Errorf("failed to decode configuration: %v", err) +func getActiveConfigFromYAMLDropins(yamlDropins [][]byte) (*Config, error) { + var mergedUserConfigPatch []byte + + // Convert YAMLs to JSONs and merge them together to get a single configuration from the user. + for _, dropin := range yamlDropins { + if strings.TrimSpace(string(dropin)) == "" { + continue + } + + jsonDropin, err := yaml.YAMLToJSON(dropin) + if err != nil { + return nil, fmt.Errorf("failed to convert config yaml (%q) to json: %w", string(dropin), err) + } + + if mergedUserConfigPatch == nil { + mergedUserConfigPatch = jsonDropin + continue + } + + patched, err := jsonpatch.MergePatch(mergedUserConfigPatch, jsonDropin) + if err != nil { + return nil, fmt.Errorf("failed to merge dropin (%q) into the config patch (%q): %w", string(jsonDropin), string(mergedUserConfigPatch), err) + } + mergedUserConfigPatch = patched } - return c, nil -} -func getActiveConfigFromYAML(contents []byte) (*Config, error) { - userSettings, err := parse(contents) - if err != nil { - return nil, fmt.Errorf("failed to parse config file %q: %v", ConfigFile, err) + cfg := &Config{} + if err := cfg.fillDefaults(); err != nil { + return nil, fmt.Errorf("failed to fill config's defaults: %w", err) } - // Start with the defaults, then apply the user settings and - // recompute dynamic values. - results := &Config{} - if err := results.fillDefaults(); err != nil { - return nil, fmt.Errorf("invalid configuration: %v", err) + if len(mergedUserConfigPatch) != 0 { + userSettings := &Config{} + if err := json.Unmarshal(mergedUserConfigPatch, userSettings); err != nil { + return nil, fmt.Errorf("failed to unmarshal user cfg json to config: %w", err) + } + cfg.incorporateUserSettings(userSettings) } - results.incorporateUserSettings(userSettings) - if err := results.updateComputedValues(); err != nil { - return nil, fmt.Errorf("invalid configuration: %v", err) + + if err := cfg.updateComputedValues(); err != nil { + return nil, fmt.Errorf("invalid configuration: %w", err) } - if err := results.validate(); err != nil { - return nil, fmt.Errorf("invalid configuration: %v", err) + + if err := cfg.validate(); err != nil { + return nil, fmt.Errorf("invalid configuration: %w", err) } - return results, nil + + return cfg, nil } -// ActiveConfig returns the active configuration. If the configuration -// file exists, read it and require it to be valid. Otherwise return -// the default settings. -func ActiveConfig() (*Config, error) { - _, err := os.Stat(ConfigFile) - if os.IsNotExist(err) { - // No configuration file, use the default settings - return NewDefault(), nil - } else if err != nil { +// collectUserProvidedConfigs loads all the user provided yaml config files: +// - main MicroShift config (/etc/microshift/config.yaml), and +// - YAML files from config drop-in directory (/etc/microshift/config.d) +func collectUserProvidedConfigs() ([][]byte, error) { + dropins := [][]byte{} + + if exists, err := util.PathExists(ConfigFile); err != nil { return nil, err + } else if exists { + contents, err := os.ReadFile(ConfigFile) + if err != nil { + return nil, fmt.Errorf("error reading config file %q: %v", ConfigFile, err) + } + dropins = append(dropins, contents) } - // Read the file and merge user-provided settings with the defaults - contents, err := os.ReadFile(ConfigFile) + dropInDirExists, err := util.PathExistsAndIsNotEmpty(ConfigDropInDir) if err != nil { - return nil, fmt.Errorf("error reading config file %q: %v", ConfigFile, err) + return nil, err } - return getActiveConfigFromYAML(contents) + + if !dropInDirExists { + return dropins, nil + } + + err = filepath.WalkDir(ConfigDropInDir, func(path string, info fs.DirEntry, err error) error { + if err != nil { + return err + } + if !info.IsDir() && filepath.Ext(info.Name()) == ".yaml" { + contents, err := os.ReadFile(path) + if err != nil { + return fmt.Errorf("error reading config file %q: %v", path, err) + } + dropins = append(dropins, contents) + } + return nil + }) + if err != nil { + return nil, fmt.Errorf("failed to walk the config drop-in dir %q: %w", ConfigDropInDir, err) + } + + return dropins, nil +} + +// ActiveConfig returns the active configuration which is default config with overrides +// from user provided config files. +func ActiveConfig() (*Config, error) { + dropins, err := collectUserProvidedConfigs() + if err != nil { + return nil, err + } + + return getActiveConfigFromYAMLDropins(dropins) } diff --git a/test/resources/microshift-config.resource b/test/resources/microshift-config.resource index 7e28dfb66f..232eff68a6 100644 --- a/test/resources/microshift-config.resource +++ b/test/resources/microshift-config.resource @@ -67,6 +67,18 @@ Upload MicroShift Config [Arguments] ${config_content} Upload String To File ${config_content} /etc/microshift/config.yaml +Drop In MicroShift Config + [Documentation] Upload a drop-in configuration file to the MicroShift host + [Arguments] ${config_content} ${name} + Upload String To File ${config_content} /etc/microshift/config.d/${name}.yaml + +Remove Drop In MicroShift Config + [Documentation] Remove a drop-in configuration file from MicroShift host + [Arguments] ${name} + ${stdout} ${rc}= Execute Command + ... rm -f /etc/microshift/config.d/${name}.yaml + ... sudo=True return_rc=True + Save Lvmd Config [Documentation] If an lvmd.yaml file already exists, preserver it ${stdout} ${rc}= Execute Command diff --git a/test/suites/greenboot/greenboot.robot b/test/suites/greenboot/greenboot.robot index 8a33a59f77..8aea9193a2 100644 --- a/test/suites/greenboot/greenboot.robot +++ b/test/suites/greenboot/greenboot.robot @@ -57,7 +57,8 @@ Simulate Pod Failure ... Restart Greenboot And Wait For Success [Teardown] Run Keywords - ... Restore Default MicroShift Config + ... Remove Drop In MicroShift Config 10-svcNetwork + ... AND ... Cleanup And Start @@ -122,7 +123,6 @@ Restore Service Disrupt Pod Network [Documentation] Prevent Microshift pods From starting correctly - Save Default MicroShift Config ${configuration}= Catenate SEPARATOR=\n ... network: ... \ clusterNetwork: @@ -130,8 +130,7 @@ Disrupt Pod Network ... \ serviceNetwork: ... \ - 10.66.0.0/16 ... - ${newconfig}= Extend MicroShift Config ${configuration} - Upload MicroShift Config ${newconfig} + Drop In MicroShift Config ${configuration} 10-svcNetwork Cleanup And Start [Documentation] Wipe Microshift data and start it. diff --git a/test/suites/ipv6/dualstack.robot b/test/suites/ipv6/dualstack.robot index bf9423b073..4a75045c8b 100644 --- a/test/suites/ipv6/dualstack.robot +++ b/test/suites/ipv6/dualstack.robot @@ -24,7 +24,6 @@ ${HOSTNAME} hello-microshift.dualstack.cluster.local Verify New Pod Works With IPv6 [Documentation] Verify IPv6 services are routable. [Setup] Run Keywords - ... Save Default MicroShift Config ... Migrate To Dual Stack ... Create Hello MicroShift Pod ... Expose Hello MicroShift Service Via Route IPv6 @@ -50,13 +49,12 @@ Verify New Pod Works With IPv6 ... Delete Hello MicroShift Route ... Delete Hello MicroShift Pod And Service ... Wait For Service Deletion With Timeout - ... Restore Default MicroShift Config + ... Remove Dual Stack Config Drop In ... Restart MicroShift Verify New Pod Works With IPv4 [Documentation] Verify IPv4 services are routable. [Setup] Run Keywords - ... Save Default MicroShift Config ... Migrate To Dual Stack ... Create Hello MicroShift Pod ... Expose Hello MicroShift Service Via Route IPv4 @@ -82,13 +80,12 @@ Verify New Pod Works With IPv4 ... Delete Hello MicroShift Route ... Delete Hello MicroShift Pod And Service ... Wait For Service Deletion With Timeout - ... Restore Default MicroShift Config + ... Remove Dual Stack Config Drop In ... Restart MicroShift Verify Host Network Pods Get Dual Stack IP Addresses [Documentation] Verify host network pods get dual stack IP addresses [Setup] Run Keywords - ... Save Default MicroShift Config ... Migrate To Dual Stack ${pod_ips}= Oc Get JsonPath @@ -100,7 +97,7 @@ Verify Host Network Pods Get Dual Stack IP Addresses Should Contain ${pod_ips} ${USHIFT_HOST_IP2} [Teardown] Run Keywords - ... Restore Default MicroShift Config + ... Remove Dual Stack Config Drop In ... Restart MicroShift @@ -117,6 +114,10 @@ Teardown Teardown Suite With Namespace Logout MicroShift Host +Remove Dual Stack Config Drop In + [Documentation] Remove dual stack config drop-in + Remove Drop In MicroShift Config 10-dualstack + Initialize Global Variables [Documentation] Initializes global variables. Log IP1: ${USHIFT_HOST_IP1} IPv6: ${USHIFT_HOST_IP2} @@ -131,8 +132,7 @@ Migrate To Dual Stack ... network: ... \ \ clusterNetwork: [10.42.0.0/16, fd01::/48] ... \ \ serviceNetwork: [10.43.0.0/16, fd02::/112] - ${replaced}= Replace MicroShift Config ${dual_stack} - Upload MicroShift Config ${replaced} + Drop In MicroShift Config ${dual_stack} 10-dualstack Restart MicroShift Delete Hello MicroShift Route diff --git a/test/suites/network/multi-nic.robot b/test/suites/network/multi-nic.robot index 8887f5c8ee..ae62688175 100644 --- a/test/suites/network/multi-nic.robot +++ b/test/suites/network/multi-nic.robot @@ -46,7 +46,6 @@ Verify MicroShift Runs Only On Primary NIC ... change. A restart is forced so that MicroShift picks up the new ... configuration (without the secondary IP) and regenerates the ... certificates, which will be lacking the IP from secondary NIC. - [Setup] Save Default MicroShift Config Configure Subject Alternative Name ${USHIFT_HOST_IP1} @@ -68,7 +67,6 @@ Verify MicroShift Runs Only On Secondary NIC ... an automatic restart of the service. After restarting, the node IP will ... be that of the secondary NIC, and certificates will be updated according ... to the new configuration (which includes only the secondary IP). - [Setup] Save Default MicroShift Config Configure Subject Alternative Name ${USHIFT_HOST_IP2} @@ -184,8 +182,7 @@ Configure Subject Alternative Name ... \ \ subjectAltNames: ... \ \ - ${ip} - ${replaced}= Replace MicroShift Config ${subject_alt_names} - Upload MicroShift Config ${replaced} + Drop In MicroShift Config ${subject_alt_names} 10-subjectAltNames Check IP Certificate [Documentation] Checks whether the ${ip} is present in the subject @@ -214,7 +211,7 @@ IP Should Not Be Present In External Certificate Restore Network Configuration By Rebooting Host [Documentation] Restores network interface initial configuration ... by rebooting the host. - Restore Default MicroShift Config + Remove Drop In MicroShift Config 10-subjectAltNames Reboot MicroShift Host Login Switch To IP ${USHIFT_HOST_IP1} Wait Until Greenboot Health Check Exited diff --git a/test/suites/network/offline.robot b/test/suites/network/offline.robot index 242d29c333..b43f2358c3 100644 --- a/test/suites/network/offline.robot +++ b/test/suites/network/offline.robot @@ -6,6 +6,7 @@ Library String Library ../../resources/qemu-guest-agent.py Library ../../resources/DataFormats.py Resource ../../resources/libvirt.resource +Resource ../../resources/microshift-config.resource Suite Setup Setup Suite Teardown Teardown @@ -102,13 +103,11 @@ Pod Should Be Reachable Via Ingress Update MicroShift Config [Documentation] Update the MicroShift config to use the offline-network endpoint - Save Default MicroShift Config ${patch}= Catenate SEPARATOR=\n ... node: ... \ \ hostnameOverride: ${GUEST_NAME} ... \ \ nodeIP: ${NODE_IP} - ${patched_config}= Yaml Replace ${DEFAULT_MICROSHIFT_CONFIG} ${patch} - Write To File ${GUEST_NAME} /etc/microshift/config.yaml ${patched_config} + Write To File ${GUEST_NAME} /etc/microshift/config.d/10-hostname.yaml ${patch} Update Guest Network Config [Documentation] Setup the guest's loopback with IP address, hostname, and DNS @@ -157,28 +156,15 @@ Restore Guest Network Config ... nmcli connection modify lo connection.autoconnect no Should Be Equal As Integers ${result["rc"]} 0 -Save Default MicroShift Config - [Documentation] Save the default MicroShift config for offline start. MicroShift fails on first boot when - ... offline, so ignore the file not exist error. - ${data}= Set Variable ${EMPTY} - TRY - ${data}= Run Keyword - ... Read From File ${GUEST_NAME} /etc/microshift/config.yaml - EXCEPT *No such file or directory* type=glob - Log Default MicroShift config not found, ignoring - END - Set Suite Variable ${DEFAULT_MICROSHIFT_CONFIG} ${data} - Restore Default MicroShift Config [Documentation] Restore the default MicroShift config for offline start. - ${len}= Get Length ${DEFAULT_MICROSHIFT_CONFIG} - IF ${len} > 0 - Write To File ${GUEST_NAME} /etc/microshift/config.yaml ${DEFAULT_MICROSHIFT_CONFIG} - ELSE - ${result} ${ignore}= Run Guest Process ${GUEST_NAME} rm /etc/microshift/config.yaml - Log Many ${result["stdout"]} ${result["stderr"]} - Should Be Equal As Integers ${result["rc"]} 0 - END + ${result} ${ignore}= Run Guest Process + ... ${GUEST_NAME} + ... rm + ... -f + ... /etc/microshift/config.d/10-hostname.yaml + Log Many ${result["stdout"]} ${result["stderr"]} + Should Be Equal As Integers ${result["rc"]} 0 Start MicroShift [Documentation] Restart the MicroShift systemd service diff --git a/test/suites/standard1/configuration.robot b/test/suites/standard1/configuration.robot index 162490eaeb..5096afa820 100644 --- a/test/suites/standard1/configuration.robot +++ b/test/suites/standard1/configuration.robot @@ -81,7 +81,7 @@ Deploy MicroShift With LVMS By Default LVMS Is Deployed CSI Snapshot Controller And Webhook Are Deployed [Teardown] Run Keywords - ... Restore Default MicroShift Config + ... Remove Storage Drop In Config ... Restart MicroShift Deploy MicroShift Without LVMS @@ -93,7 +93,7 @@ Deploy MicroShift Without LVMS Run Keyword And Expect Error 1 != 0 ... LVMS Is Deployed [Teardown] Run Keywords - ... Restore Default MicroShift Config + ... Remove Storage Drop In Config ... Restart MicroShift Deploy MicroShift Without CSI Snapshotter @@ -105,7 +105,7 @@ Deploy MicroShift Without CSI Snapshotter ... CSI Snapshot Controller And Webhook Are Deployed [Teardown] Run Keywords - ... Restore Default MicroShift Config + ... Remove Storage Drop In Config ... Restart MicroShift @@ -115,12 +115,12 @@ Setup Check Required Env Variables Login MicroShift Host Setup Kubeconfig # for readiness checks - Save Default MicroShift Config Save Journal Cursor Teardown [Documentation] Test suite teardown - Restore Default MicroShift Config + Remove Drop In MicroShift Config 10-loglevel + Remove Drop In MicroShift Config 10-audit Restart MicroShift Logout MicroShift Host Remove Kubeconfig @@ -134,26 +134,22 @@ Save Journal Cursor Setup With Bad Log Level [Documentation] Set log level to an unknown value and restart - ${merged}= Extend MicroShift Config ${BAD_LOG_LEVEL} - Upload MicroShift Config ${merged} + Drop In MicroShift Config ${BAD_LOG_LEVEL} 10-loglevel Restart MicroShift Setup With Debug Log Level [Documentation] Set log level to debug and restart - ${merged}= Extend MicroShift Config ${BAD_LOG_LEVEL} - Upload MicroShift Config ${merged} + Drop In MicroShift Config ${DEBUG_LOG_LEVEL} 10-loglevel Restart MicroShift Setup Known Audit Log Profile [Documentation] Setup audit - ${merged}= Extend MicroShift Config ${AUDIT_PROFILE} - Upload MicroShift Config ${merged} + Drop In MicroShift Config ${AUDIT_PROFILE} 10-audit Restart MicroShift Setup Audit Flags [Documentation] Apply the audit config values set in ${AUDIT_FLAGS} - ${merged}= Extend MicroShift Config ${AUDIT_FLAGS} - Upload MicroShift Config ${merged} + Drop In MicroShift Config ${AUDIT_FLAGS} 10-audit Restart MicroShift Deploy Storage Config @@ -161,10 +157,13 @@ Deploy Storage Config ... and restarts microshift.service [Arguments] ${config} Cleanup MicroShift opt='--keep-images' - ${merged}= Extend MicroShift Config ${config} - Upload MicroShift Config ${merged} + Drop In MicroShift Config ${config} 10-storage Start MicroShift +Remove Storage Drop In Config + [Documentation] Remove the previously created drop-in config for storage + Remove Drop In MicroShift Config 10-storage + LVMS Is Deployed [Documentation] Wait for LVMS components to deploy Named Deployment Should Be Available lvms-operator openshift-storage 120s diff --git a/test/suites/standard1/kustomize.robot b/test/suites/standard1/kustomize.robot index 625a78d945..1d30586a71 100644 --- a/test/suites/standard1/kustomize.robot +++ b/test/suites/standard1/kustomize.robot @@ -110,7 +110,6 @@ Setup Suite # robocop: disable=too-long-keyword Set Suite Variable \${NOEXT_NAMESPACE} ${ns} # Extend the configuration setting to add the unique path to the defaults - Save Default MicroShift Config ${config_content}= Catenate SEPARATOR=\n ... manifests: ... \ \ kustomizePaths: @@ -121,8 +120,7 @@ Setup Suite # robocop: disable=too-long-keyword ... \ \ \ \ - ${NON_DEFAULT_DIR} ... \ \ \ \ # Add a directory _without_ the glob for unconfigured test ... \ \ \ \ - /home/${USHIFT_USER}/test-manifests.d - ${merged}= Extend MicroShift Config ${config_content} - Upload MicroShift Config ${merged} + Drop In MicroShift Config ${config_content} 10-kustomize Restart MicroShift @@ -233,7 +231,7 @@ Remove Manifest Directory Restore Default Config [Documentation] Remove any custom config and restart MicroShift - Restore Default MicroShift Config + Remove Drop In MicroShift Config 10-kustomize # When restoring, we check if ostree is active, if so we reboot # to convert everything back to normal, MicroShift restart should not diff --git a/test/suites/standard1/router.robot b/test/suites/standard1/router.robot index d9fceb1d2e..e400487011 100644 --- a/test/suites/standard1/router.robot +++ b/test/suites/standard1/router.robot @@ -111,12 +111,11 @@ Setup ... different ways there is no need to restart before/after each one of them. Instead, store ... the original configuration here to restore it at the end. Setup Suite With Namespace - Save Default MicroShift Config Teardown [Documentation] Special teardown for the suite, will finish off by restoring the original ... configuration and restarting MicroShift. - Restore Default MicroShift Config + Remove Drop In MicroShift Config 10-ingress Restart MicroShift Teardown Suite With Namespace @@ -146,8 +145,7 @@ Wait For Router Ready Setup With Custom Config [Documentation] Install a custom config and restart MicroShift. [Arguments] ${config_content} - ${merged}= Extend MicroShift Config ${config_content} - Upload MicroShift Config ${merged} + Drop In MicroShift Config ${config_content} 10-ingress Restart MicroShift Setup Namespaces diff --git a/test/suites/standard1/show-config.robot b/test/suites/standard1/show-config.robot index e53bb1e70e..54a29ed6db 100644 --- a/test/suites/standard1/show-config.robot +++ b/test/suites/standard1/show-config.robot @@ -58,13 +58,11 @@ Setup [Documentation] Test suite setup Check Required Env Variables Login MicroShift Host - Save Default MicroShift Config - ${newconfig}= Extend MicroShift Config ${MEMLIMIT128} - Upload MicroShift Config ${newconfig} + Drop In MicroShift Config ${MEMLIMIT128} 10-etcd Teardown [Documentation] Test suite teardown - Restore Default MicroShift Config + Remove Drop In MicroShift Config 10-etcd Logout MicroShift Host Show Config diff --git a/test/suites/standard2/etcd.robot b/test/suites/standard2/etcd.robot index 5f4838bba4..ef84cbabf4 100644 --- a/test/suites/standard2/etcd.robot +++ b/test/suites/standard2/etcd.robot @@ -49,7 +49,6 @@ Setup Check Required Env Variables Login MicroShift Host Setup Kubeconfig # for readiness checks - Save Default MicroShift Config Teardown [Documentation] Test suite teardown @@ -59,14 +58,13 @@ Teardown Restore Default Config [Documentation] Remove any custom config and restart MicroShift - Restore Default MicroShift Config + Remove Drop In MicroShift Config 10-etcd Restart MicroShift Setup With Custom Config [Documentation] Install a custom config and restart MicroShift [Arguments] ${config_content} - ${merged}= Extend MicroShift Config ${config_content} - Upload MicroShift Config ${merged} + Drop In MicroShift Config ${config_content} 10-etcd Restart MicroShift Expect MemoryHigh diff --git a/test/suites/standard2/validate-custom-certificates.robot b/test/suites/standard2/validate-custom-certificates.robot index f5631bbb22..b56e77d8ec 100644 --- a/test/suites/standard2/validate-custom-certificates.robot +++ b/test/suites/standard2/validate-custom-certificates.robot @@ -119,10 +119,10 @@ Setup Test [Documentation] Test suite setup ${tmp}= Create Random Temp Directory Set Global Variable ${TMPDIR} ${tmp} - Save Default MicroShift Config Teardown [Documentation] Test suite teardown + Remove Drop In MicroShift Config 10-subjectAltNames Remove Kubeconfig Logout MicroShift Host @@ -183,7 +183,7 @@ Configure Named Certificates ... \ \ \ \ names: ... \ \ \ \ - ${sni} END - Upload MicroShift Config ${subject_alt_names} + Drop In MicroShift Config ${subject_alt_names} 10-subjectAltNames Generate Random HostName [Documentation] Generate Random Hostname diff --git a/test/suites/tuned/workload-partitioning.robot b/test/suites/tuned/workload-partitioning.robot index 0bdeafabdd..66125e1e1a 100644 --- a/test/suites/tuned/workload-partitioning.robot +++ b/test/suites/tuned/workload-partitioning.robot @@ -41,7 +41,6 @@ Workload Partitioning Should Work *** Keywords *** Setup For Workload Partitioning [Documentation] Setup for Workload Partitioning - Save Default MicroShift Config Configure Kubelet For Workload Partitioning ${MANAGEMENT_CPU} Configure CRIO For Workload Partitioning ${MANAGEMENT_CPU} Configure CPUAffinity In Systemd ${MANAGEMENT_CPU} ${SYSTEMD_CRIO_DROPIN} @@ -62,7 +61,7 @@ Teardown For Workload Partitioning ... ${SYSTEMD_MICROSHIFT_DROPIN} ... ${CRIO_CONFIG_DROPIN} Systemctl Daemon Reload - Restore Default MicroShift Config + Remove Drop In MicroShift Config 10-kubelet Systemctl restart crio.service Restart MicroShift @@ -79,8 +78,7 @@ Configure Kubelet For Workload Partitioning ... \ \ \ \ full-pcpus-only: "true" ... \ \ cpuManagerReconcilePeriod: 5s - ${merged}= Extend MicroShift Config ${kubelet_config} - Upload MicroShift Config ${merged} + Drop In MicroShift Config ${kubelet_config} 10-kubelet ${kubelet_pinning_config}= CATENATE SEPARATOR=\n ... {