-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CNI File watcher and pre applying rules setup (#1345)
* Add file watcher to CNI installer to watch for config file changes and repair breakages. * Wait for CNI config file to show up on the host file system before attempting to install consul-cni configuration. * Add some code to get ready for the next PR that applying iptables rules * Unit tests for installer and plugin scenarios
- Loading branch information
1 parent
46d138a
commit 07ccb89
Showing
36 changed files
with
2,105 additions
and
1,113 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,42 @@ | ||
package config | ||
|
||
const ( | ||
DefaultPluginName = "consul-cni" | ||
DefaultPluginType = "consul-cni" | ||
DefaultCNIBinDir = "/opt/cni/bin" | ||
DefaultCNINetDir = "/etc/cni/net.d" | ||
DefaultMultus = false | ||
// defaultKubeconfig is named ZZZ-.. as part of a convention that other CNI plugins use. | ||
DefaultKubeconfig = "ZZZ-consul-cni-kubeconfig" | ||
DefaultLogLevel = "info" | ||
) | ||
|
||
// CNIConfig is the configuration that both the CNI installer and plugin will use. | ||
type CNIConfig struct { | ||
// Name of the plugin | ||
// Name of the plugin. | ||
Name string `json:"name" mapstructure:"name"` | ||
// Type of plugin (consul-cni) | ||
// Type of plugin (consul-cni). | ||
Type string `json:"type" mapstructure:"type"` | ||
// CNIBinDir is the location of the cni config files on the node. Can bet as a cli flag. | ||
CNIBinDir string `json:"cni_bin_dir" mapstructure:"cni_bin_dir"` | ||
// CNINetDir is the locaion of the cni plugin on the node. Can be set as a cli flag. | ||
CNINetDir string `json:"cni_net_dir" mapstructure:"cni_net_dir"` | ||
// Multus is if the plugin is a multus plugin. Can be set as a cli flag. | ||
Multus bool `json:"multus" mapstructure:"multus"` | ||
// Kubeconfig file name. Can be set as a cli flag. | ||
Kubeconfig string `json:"kubeconfig" mapstructure:"kubeconfig"` | ||
// LogLevl is the logging level. Can be set as a cli flag. | ||
LogLevel string `json:"log_level" mapstructure:"log_level"` | ||
// Multus is if the plugin is a multus plugin. Can be set as a cli flag. | ||
Multus bool `json:"multus" mapstructure:"multus"` | ||
} | ||
|
||
func NewDefaultCNIConfig() *CNIConfig { | ||
return &CNIConfig{ | ||
Name: DefaultPluginName, | ||
Type: DefaultPluginType, | ||
CNIBinDir: DefaultCNIBinDir, | ||
CNINetDir: DefaultCNINetDir, | ||
Kubeconfig: DefaultKubeconfig, | ||
LogLevel: DefaultLogLevel, | ||
Multus: DefaultMultus, | ||
} | ||
} |
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
Oops, something went wrong.