Skip to content

clabverter: failed to add configmap volume when using startup-config inside kinds #228

@italovalcy

Description

@italovalcy

when using startup-config inside kinds, clabverter fails to add the correspondent configmap to the created deployment:

name: my_lab
topology:
  defaults:
    kind: linux
    image: ghcr.io/srl-labs/alpine
    binds:
      - configs/client.sh:/config.sh
    exec:
      - "ash -c '/config.sh ${NODE_ID}'"
  kinds:
    srl:
      kind: nokia_srlinux
      type: ixrd3
      image: ghcr.io/nokia/srlinux:latest
      startup-config: configs/srl.cfg
  nodes:
    node1:
      kind: srl
    node2:
      kind: nokia_srlinux
      image: ghcr.io/nokia/srlinux:24.10.1
      startup-config: configs/srl.cfg
    host1:
      env:
        NODE_ID: "1"
    host2:
      env:
        NODE_ID: "2"

  links:
    # links between client1 and srl1
    - endpoints: [host1:eth1, node1:e1-1]

    # inter-switch link
    - endpoints: [node1:e1-10, node2:e1-10]

    # links between client2 and srl2
    - endpoints: [node2:e1-1, host2:eth1]

Then when I run clabverter (please notice the spec.deployment.filesFromConfigMap):

> docker run --user (id -u) -v (pwd):/clabernetes/work --rm ghcr.io/srl-labs/clabernetes/clabverter  --stdout --quiet
---
apiVersion: v1
kind: Namespace
metadata:
    name: c9s-my_lab
    labels:
        pod-security.kubernetes.io/enforce: privileged
---
apiVersion: v1
kind: ConfigMap
metadata:
    name: my_lab-node2-startup-config
    namespace: c9s-my_lab
data:
  startup-config: |-
    # no vlan tagging configured
    / interface ethernet-1/1 {
        admin-state enable
        subinterface 0 {
            type bridged
            admin-state enable
        }
    }

    / interface ethernet-1/10 {
        admin-state enable
        subinterface 0 {
            type bridged
            admin-state enable
        }
    }

    # bridge domain is like a L2 switch instance
    / network-instance bridge-1 {
        type mac-vrf
        admin-state enable
        interface ethernet-1/1.0 {
        }
        interface ethernet-1/10.0 {
        }
    }
---
apiVersion: clabernetes.containerlab.dev/v1alpha1
kind: Topology
metadata:
  name: my_lab
  namespace: c9s-my_lab
spec:
  deployment:
    filesFromConfigMap:
        node2:
          - filePath: configs/srl.cfg
            configMapName: my_lab-node2-startup-config
            configMapPath: startup-config
            mode: read
  naming: prefixed
  definition:
    containerlab: |-
          name: my_lab
          topology:
            defaults:
              kind: linux
              image: ghcr.io/srl-labs/alpine
            kinds:
              srl:
                kind: nokia_srlinux
                type: ixrd3
                image: ghcr.io/nokia/srlinux:latest
                startup-config: configs/srl.cfg
            groups:
              linux_hosts:
                binds:
                  - configs/client.sh:/config.sh
                exec:
                  - chmod +x /config.sh
                  - ash -c '/config.sh ${NODE_ID}'
            nodes:
              node1:
                kind: srl
              node2:
                kind: nokia_srlinux
                image: ghcr.io/nokia/srlinux:24.10.1
                startup-config: configs/srl.cfg
              host1:
                group: linux_hosts
                env:
                  NODE_ID: "101"
              host2:
                group: linux_hosts
                env:
                  NODE_ID: "200"

            links:
              # links between client1 and srl1
              - endpoints: [host1:eth1, node1:e1-1]

              # inter-switch link
              - endpoints: [node1:e1-10, node2:e1-10]

              # links between client2 and srl2
              - endpoints: [node2:e1-1, host2:eth1]

Not sure if this is a supported use case. Please advise!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions