-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install iptables package based on the k0s version #547
Install iptables package based on the k0s version #547
Conversation
d27a913
to
ace0933
Compare
I've been trying to think of some clean way to use different strategies based on different k0s versions but haven't come up with a good one yet. Something like: strategy := versionstrategy.NewStrategy(
versionstrategy.LessThan("v1.25.0"), func() {
foofoo
},
func() {
barbar
},
)
strategy.Run() Or maybe just some helper like: if p.Config.Spec.K0s.VersionLessThan("v1.25.0") {
foofoo
} Or maybe better for readability: const k0sVersionWithFooFeature = version.MustCompile("v1.25.0")
...
...
if k0sVersionWithFooFeature.GreaterOrEqual(p.Config.Spec.K0s.Version) {
legacyfoofoo
} or perhaps: const fooFeatureConstraint = versionconstraint.MustCompile(">= v1.25.0")
...
...
if fooFeatureConstraint.SatisfiedBy(p.Config.Spec.K0s.Version) {
foofoo
} |
Maybe treat it as a general feature gate/flag thing? You could use it to enable/disable features too. I think a type FeatureRegistry struct {
// container for all flags
Version string // p.Config.Spec.K0s.Version
}
func (f *FeatureRegistry) IsEnabled(feature string) bool {
// fetch feature by its name from the registry
// version constrain code here
return true
}
func (f *FeatureRegistry) Add(feature FeatureGate) error {
// for initial/global setup
return nil
}
type FeatureGate struct {
Name string
Constraint versiontypestringsomething
} |
// Deprecated: iptables is only required for k0s versions that are unsupported | ||
// for a long time already (< v1.22.1+k0s.0). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think k0sctl still works for something like k0s v0.10.0 before the scheme switch.
The upgrade smoke currently starts from v1.21.6+k0s.0.
Should we start removing other stuff that was added to make k0sctl work with versions that are now unsupported? cc: @jnummelin
ace0933
to
1c9633d
Compare
Signed-off-by: Kimmo Lehto <[email protected]>
Only install iptables if the k0s version requires it. Mark the corresponding host method as deprecated, as that code path can probably be completely removed in upcoming versions. Signed-off-by: Tom Wieczorek <[email protected]> Signed-off-by: Kimmo Lehto <[email protected]>
Signed-off-by: Kimmo Lehto <[email protected]>
1c9633d
to
a0509d1
Compare
Only install
iptables
if the k0s version requires it. Mark the corresponding host method as deprecated, as that code path can probably be completely removed in upcoming versions.Fixes #363.