srl-labs / srl-controller

k8s controller for SR Linux nodes scheduled by KNE
BSD 3-Clause "New" or "Revised" License
16 stars 3 forks source link

Support for CLI and JSON-styled startup configs #37

Closed hellt closed 1 year ago

hellt commented 1 year ago

This PR adds ability to provide startup configurations in both CLI and JSON formats.

Note, depends on https://github.com/openconfig/kne/pull/343

Configs are still mounted to the srl pods, but instead of being copied to /opt/srlinux/config.json they are being loaded via CLI command.

In case of CLI-styled config:

source /tmp/startup-config/config.cli

In case of JSON:

load file /tmp/startup-config/config.json

with the following commit now.

On the KNE side we provide the startup config file name, which is either config.cli or config.json. KNE checks if the provided file has .json extension, if yes - the file name is config.json, else it is config.cli.

Additionally in this PR some chaotic changes are made to the way we update status and track if the update is needed. Very chaotic changes...

codecov[bot] commented 1 year ago

Codecov Report

Merging #37 (4bf0fe6) into main (c42d638) will increase coverage by 50.79%. The diff coverage is 14.12%.

:exclamation: Current head 4bf0fe6 differs from pull request most recent head 5bf9dd5. Consider uploading reports for the commit 5bf9dd5 to get more accurate results

@@            Coverage Diff            @@
##           main      #37       +/-   ##
=========================================
+ Coverage      0   50.79%   +50.79%     
=========================================
  Files         0        8        +8     
  Lines         0      758      +758     
=========================================
+ Hits          0      385      +385     
- Misses        0      346      +346     
- Partials      0       27       +27     
Impacted Files Coverage Δ
api/v1/srlinux_types.go 100.00% <ø> (ø)
controllers/startup_config.go 0.00% <0.00%> (ø)
controllers/srlinux_controller.go 60.52% <54.54%> (ø)
controllers/pod.go 83.42% <81.25%> (ø)

... and 4 files with indirect coverage changes

hellt commented 1 year ago

send it, baby