containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.27k stars 2.37k forks source link

API: Reference of `NetworkConnectLibpod` lists `static_ips` and `static_mac` as wrong types #13342

Closed arctic-alpaca closed 5 months ago

arctic-alpaca commented 2 years ago

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

In the API reference for NetworkConnectLibpod, static_ips is listed as Array of Array of integers but it actually is Array of strings. static_mac is listed as Array of integers but instead is String. At least those are the types that worked in my testing. Trying something like "static_ips":[[192, 168 100, 10]] results in json: cannot unmarshal array into Go struct field NetworkConnectOptions.static_ips of type net.IP

Steps to reproduce the issue:

  1. Send request to API NetworkConnectLibpod with "static_ips":[[192, 168 100, 10]]

  2. Send request to API NetworkConnectLibpod with "static_ips":["192.168.100.10"]

Describe the results you received: 1 results in json: cannot unmarshal array into Go struct field NetworkConnectOptions.static_ips of type net.IP

Describe the results you expected: 2 results in the expected behavior.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Client:       Podman Engine
Version:      4.0.0
API Version:  4.0.0
Go Version:   go1.16.13

Built:      Mon Feb 21 19:31:38 2022
OS/Arch:    linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.24.1
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.0-2.fc35.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: '
  cpus: 12
  distribution:
    distribution: fedora
    variant: kde
    version: "35"
  eventLogger: journald
  hostname: arctic-alpaca-Desktop
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.16.9-200.fc35.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 711036928
  memTotal: 16689451008
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.4.2-1.fc35.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.12-2.fc35.x86_64
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 8587571200
  swapTotal: 8589930496
  uptime: 2h 11m 6.06s (Approximately 0.08 days)
plugins:
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /home/arctic-alpaca/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/arctic-alpaca/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 9
  runRoot: /run/user/1000/containers
  volumePath: /home/arctic-alpaca/.local/share/containers/storage/volumes
version:
  APIVersion: 4.0.0
  Built: 1645468298
  BuiltTime: Mon Feb 21 19:31:38 2022
  GitCommit: ""
  GoVersion: go1.16.13
  OsArch: linux/amd64
  Version: 4.0.0

Package info (e.g. output of rpm -q podman or apt list podman):

podman-4.0.0-10.fc35.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

No

Additional environment details (AWS, VirtualBox, physical, etc.): Fedora 35 using rhcontainerbot/podman4 copr.

Luap99 commented 2 years ago

@jwhonce Do you know how I can overwrite the swagger type of a struct field? Looking at https://github.com/containers/common/blob/main/libnetwork/types/network.go I used swagger:strfmt to convert the type to a string for ip and mac addresses.

Here https://github.com/containers/common/blob/e720b5cf39f50af623bfb923bba519ae2648705a/libnetwork/types/network.go#L202 I need a string array as type. I have no clue how I can change this. We cannot change the actual go type since they are stable and we cannot break this.

github-actions[bot] commented 2 years ago

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] commented 2 years ago

A friendly reminder that this issue had no activity for 30 days.

rhatdan commented 2 years ago

@Luap99 @jwhonce Any progress on this?

github-actions[bot] commented 2 years ago

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] commented 2 years ago

A friendly reminder that this issue had no activity for 30 days.

rhatdan commented 2 years ago

@flouthoc ptal

Luap99 commented 2 years ago

FYI I asked upstream https://github.com/go-swagger/go-swagger/discussions/2770 but no answer yet.

github-actions[bot] commented 2 years ago

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] commented 2 years ago

A friendly reminder that this issue had no activity for 30 days.

rhatdan commented 2 years ago

@Luap99 Is this complete now?

Luap99 commented 2 years ago

Not until we get a new swagger version into podman, see #15550

Luap99 commented 5 months ago

This should work now.