Skip to content

Alpine: mount AlpineConfig.files into the primary container - #802

Open
abhishek-7 wants to merge 2 commits into
openconfig:mainfrom
abhishek-7:alpine-primary-container-files
Open

abhishek-7 wants to merge 2 commits into
openconfig:mainfrom
abhishek-7:alpine-primary-container-files

Conversation

@abhishek-7

@abhishek-7 abhishek-7 commented Nov 3, 2026 •

Copy link
Copy Markdown

Why this change is needed

Previously in topo/node/alpine/alpine.go (CreatePod):
Single-container ALPINE deployments had the <node>-files ConfigMap and pod volume created, but never mounted into the primary container.

Summary of changes

  1. topo/node/alpine/alpine.go:

    • Append extraMounts to alpineContainers[0].VolumeMounts when AlpineConfig.files is populated so that the configured file mounts are available in the primary Alpine container as well as any custom sidecar containers.
  2. topo/node/alpine/alpine_test.go:

    • Added a unit test.

Test Results

  1. Unit tests (go test -v ./topo/node/alpine/...)

  2. KNE cluster verification
    Deployed a single-container ALPINE topology with both config_db.json (in node.config) and attributes.json (in AlpineConfig.files mounted at /etc/files) on a Kind/KNE cluster:

    name: "poc-files"
    nodes: {
      name: "dut"
      type: ALPINE
      config: {
        image: "us-west1-docker.pkg.dev/gpins-av/kne/alpine/alpinevs:latest"
        config_path: "/etc/sonic"
        config_file: "config_db.json"
        file: "dut_config_db.json"
      }
      vendor_data: {
        [type.googleapis.com/alpine.AlpineConfig]: {
          files: {
            mount_dir: "/etc/files"
            files: {
              key: "attributes.json"
              value: {
                file: "attributes.json"
              }
            }
          }
        }
      }
    }

    Verified on the running pod (kubectl get pod -n poc-files dut and kubectl exec):

    • Pod Container VolumeMounts:

      [{"mountPath":"/etc/files","name":"files"},{"mountPath":"/etc/sonic/config_db.json","name":"startup-config-volume","readOnly":true,"subPath":"config_db.json"}]
    • Inside the container:

      $ kubectl exec -n poc-files dut -- ls -la /etc/files/attributes.json /etc/sonic/config_db.json
      lrwxrwxrwx 1 root root   27 Nov  3 08:27 /etc/files/attributes.json -> ..data/attributes.json
      -rw-r--r-- 1 root root 1157 Nov  3 08:27 /etc/sonic/config_db.json
      

@abhishek-7 abhishek-7 changed the title topo/node/alpine: mount AlpineConfig.files into the primary container Alpine: mount AlpineConfig.files into the primary container Nov 3, 2026
@manizzzz

manizzzz commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

/gcbrun

@manizzzz manizzzz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Abhishek, LGTM! Left a couple of small non-blocking notes below.

Comment thread topo/node/alpine/alpine.go Resolved
@abhishek-7
abhishek-7 force-pushed the alpine-primary-container-files branch from 3abff11 to 53afe36 Compare November 4, 2026 11:32
@manizzzz

manizzzz commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

/gcbrun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants