forked from cri-o/cri-o
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] Add new parameter disable_hostport_mapping in CRI-O
Add DisableHostportMapping option to configuration, allowing users to disable hostport mapping for pods, which can be useful when other services provide it other than kube-proxy (like Cillium) Closes: cri-o#3914 Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
- Loading branch information
Showing
14 changed files
with
147 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package hostport | ||
|
||
import "github.com/sirupsen/logrus" | ||
|
||
// This interface implements, when hostport mapping is disabled in CRI-O | ||
type noopHostportManager struct{} | ||
|
||
// NewNoopHostportManager creates a new HostPortManager | ||
func NewNoopHostportManager() HostPortManager { | ||
logrus.Info("HostPort Mapping is Disabled in CRI-O") | ||
return &noopHostportManager{} | ||
} | ||
|
||
func (mh *noopHostportManager) Add(id string, podPortMapping *PodPortMapping, natInterfaceName string) error { | ||
logrus.Debug("HostPort Mapping is Disabled in CRI-O") | ||
return nil | ||
} | ||
|
||
func (mh *noopHostportManager) Remove(id string, podPortMapping *PodPortMapping) error { | ||
logrus.Debug("HostPort Mapping is Disabled in CRI-O") | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package hostport | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// To make CodeCov happy | ||
func TestNoopHostportManager(t *testing.T) { | ||
manager := NewNoopHostportManager() | ||
assert.NotNil(t, manager) | ||
|
||
err := manager.Add("id", nil, "") | ||
assert.NoError(t, err) | ||
|
||
err = manager.Remove("id", nil) | ||
assert.NoError(t, err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters