Changes to remove hashi-corp library
@@ -24,7 +24,7 @@ import (
log "github.com/sirupsen/logrus"
- version "github.com/projectcalico/felix/versionparse"
+ "github.com/projectcalico/felix/versionparse"
)
var (
@@ -32,17 +32,17 @@ var (
// iptables versions:
// v1Dot4Dot7 is the oldest version we've ever supported.
- v1Dot4Dot7, _ = version.NewVersion("1.4.7")
+ v1Dot4Dot7 = versionparse.MustParseVersion("1.4.7")
// v1Dot6Dot0 added --random-fully to SNAT.
- v1Dot6Dot0, _ = version.NewVersion("1.6.0")
+ v1Dot6Dot0 = versionparse.MustParseVersion("1.6.0")
// v1Dot6Dot2 added --random-fully to MASQUERADE and the xtables lock to iptables-restore.
- v1Dot6Dot2, _ = version.NewVersion("1.6.2")
+ v1Dot6Dot2 = versionparse.MustParseVersion("1.6.2")
// Linux kernel versions:
// v3Dot10Dot0 is the oldest version we support at time of writing.
- v3Dot10Dot0, _ = version.NewVersion("3.10.0")
+ v3Dot10Dot0 = versionparse.MustParseVersion("3.10.0")
// v3Dot14Dot0 added the random-fully feature on the iptables interface.
- v3Dot14Dot0, _ = version.NewVersion("3.14.0")
+ v3Dot14Dot0 = versionparse.MustParseVersion("3.14.0")
)
type Features struct {
@@ -67,7 +67,7 @@ type FeatureDetector struct {
func NewFeatureDetector() *FeatureDetector {
return &FeatureDetector{
- GetKernelVersionReader: version.GetKernelVersionReader,
+ GetKernelVersionReader: versionparse.GetKernelVersionReader,
NewCmd: NewRealCmd,
}
}
@@ -113,7 +113,7 @@ func (d *FeatureDetector) refreshFeaturesLockHeld() {
}
}
-func (d *FeatureDetector) getIptablesVersion() *version.Version {
+func (d *FeatureDetector) getIptablesVersion() *versionparse.Version {
cmd := d.NewCmd("iptables", "--version")
out, err := cmd.Output()
if err != nil {
@@ -128,7 +128,7 @@ func (d *FeatureDetector) getIptablesVersion() *version.Version {
"Failed to parse iptables version, assuming old version with no optional features")
return v1Dot4Dot7
}
- parsedVersion, err := version.NewVersion(matches[1])
+ parsedVersion, err := versionparse.NewVersion(matches[1])
if err != nil {
log.WithField("rawVersion", s).WithError(err).Warn(
"Failed to parse iptables version, assuming old version with no optional features")
@@ -138,13 +138,13 @@ func (d *FeatureDetector) getIptablesVersion() *version.Version {
return parsedVersion
}
-func (d *FeatureDetector) getKernelVersion() *version.Version {
+func (d *FeatureDetector) getKernelVersion() *versionparse.Version {
reader, err := d.GetKernelVersionReader()
if err != nil {
log.WithError(err).Warn("Failed to get the kernel version reader, assuming old version with no optional features")
return v3Dot10Dot0
}
- kernVersion, err := version.GetKernelVersion(reader)
+ kernVersion, err := versionparse.GetKernelVersion(reader)
if err != nil {
log.WithError(err).Warn("Failed to get kernel version, assuming old version with no optional features")
return v3Dot10Dot0
