Skip to content

Commit

Permalink
Add IPv6 subnet and publicIP in the extension backend
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Buil <mbuil@suse.com>
  • Loading branch information
manuelbuil committed May 12, 2023
1 parent 12f639c commit 8f11385
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Documentation/extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ This backend has the following configuration
* `SubnetAddCommand` (string): Command to run when a subnet is added
* stdin - The output from `PreStartupCommand` is passed in.
* The following environment variables are set
* SUBNET - The subnet of the remote host that was added.
* SUBNET - The ipv4 subnet of the remote host that was added.
* IPV6SUBNET - The ipv6 subnet of the remote host that was added.
* PUBLIC_IP - The public IP of the remote host.
* PUBLIC_IPV6 - The public IPv6 of the remote host.
* `SubnetRemoveCommand`(string): Command to run when a subnet is removed
* stdin - The output from `PreStartupCommand` is passed in.
* The following environment variables are set
* SUBNET - The subnet of the remote host that was removed.
* SUBNET - The ipv4 subnet of the remote host that was removed.
* IPV6SUBNET - The ipv6 subnet of the remote host that was removed.
* PUBLIC_IP - The public IP of the remote host.
* PUBLIC_IPV6 - The public IPv6 of the remote host.

All commands are run through the `sh` shell and are run with the same permissions as the flannel daemon.

Expand Down
2 changes: 2 additions & 0 deletions pkg/backend/extension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ func (be *ExtensionBackend) RegisterNetwork(ctx context.Context, wg *sync.WaitGr
cmd_output, err := runCmd([]string{
fmt.Sprintf("NETWORK=%s", config.Network),
fmt.Sprintf("SUBNET=%s", lease.Subnet),
fmt.Sprintf("IPV6SUBNET=%s", lease.IPv6Subnet),
fmt.Sprintf("PUBLIC_IP=%s", attrs.PublicIP)},
fmt.Sprintf("PUBLIC_IPV6=%s", attrs.PublicIPv6)},
"", "sh", "-c", n.postStartupCommand)
if err != nil {
return nil, fmt.Errorf("failed to run command: %s Err: %v Output: %s", n.postStartupCommand, err, cmd_output)
Expand Down

0 comments on commit 8f11385

Please sign in to comment.