Skip to content
This repository has been archived by the owner on Jan 8, 2023. It is now read-only.

Add podman network options to support use of static IP addresses #33

Conversation

laurent-indermuehle
Copy link
Contributor

This pull request adds Podman network options that allow usage of static IP in containers.

With the following molecule.yml you can write scenarios that tests communication between containers without relying on complicated DNS setup:

platforms:

  - name: node1
    registry: &redhat {url: registry.access.redhat.com}
    image: &image ubi8/ubi-init
    tmpfs: &tmpfs ['/run', '/tmp']
    volumes: &volumes ['/sys/fs/cgroup:/sys/fs/cgroup:ro']
    capabilities: &capabilities ['SYS_ADMIN', 'NET_ADMIN']
    command: &command "/usr/sbin/init"
    security_opts: &security_opts ['label=disable']
    network: &network setup_dedicated
    subnet: &subnet '10.90.0.0/16'
    etc_hosts: &etc_hosts
      "node1": "10.90.0.101"
      "node2": "10.90.0.102"
    ip: 10.90.0.101

  - name: node2
    registry: *redhat
    image: *image
    tmpfs: *tmpfs
    volumes: *volumes
    capabilities: *capabilities
    command: *command
    security_opts: *security_opts
    network: *network
    subnet: *subnet
    etc_hosts: *etc_hosts
    ip: 10.90.0.102
    

It is impossible to change the /etc/hosts file on a running container. This is why I edited the create.yml Playbook to add this feature.

@laurent-indermuehle laurent-indermuehle changed the title Lie podman networks Add podman network options to support use of static IP addresses Mar 5, 2021
@laurent-indermuehle
Copy link
Contributor Author

Closing to try to relaunch the checks

The real purpose of this commit it to try to unlock the checks in
the github PR:
ansible-community#33
@laurent-indermuehle
Copy link
Contributor Author

Nothing I did, helped rerun the checks. Maybe it's because Github-action says "This scheduled workflow is disabled because there hasn't been activity in this repository for at least 60 days."?
Anyway, I fixed a conflict in my branch and now it should be safe to merge.

@tadeboro tadeboro closed this Jun 14, 2021
@tadeboro tadeboro reopened this Jun 14, 2021
@laurent-indermuehle
Copy link
Contributor Author

Closing because Github-actions seems stuck. Will repopen.

ssbarnea pushed a commit that referenced this pull request Jun 16, 2021
* Add create podman network

This feature allow to use static IP in scenarios

* Add filter to IP of current node to prevent duplication in etc_hosts

* Fix published_ports by repeating the option instead of passing a list

* Add support for podman --detach option

* Add support for podman --ip option

* Reformat typo

The real purpose of this commit it to try to unlock the checks in
the github PR:
#33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants