-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Produce proper standard images with k3s/k0s versions
USes a provider flag and a defualt empty version flag to provide the specific version that you want. It goes directly to k0s installer and generates the service files itself so it doesnt need to run anything For k3s it uses the installers with some flags to generate the services directly. Signed-off-by: Itxaka <[email protected]>
- Loading branch information
Showing
6 changed files
with
291 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,62 @@ | ||
package config | ||
|
||
import "fmt" | ||
|
||
// Config is the struct to track the config of the init image | ||
// So we can access it from anywhere | ||
type Config struct { | ||
Level string | ||
Stage string | ||
Model string | ||
FrameworkVersion string | ||
Variant string | ||
Registry string | ||
TrustedBoot bool | ||
Fips bool | ||
Level string | ||
Stage string | ||
Model string | ||
FrameworkVersion string | ||
Variant Variant | ||
Registry string | ||
TrustedBoot bool | ||
Fips bool | ||
KubernetesProvider KubernetesProvider | ||
KubernetesVersion string | ||
} | ||
|
||
var DefaultConfig = Config{} | ||
|
||
type Variant string | ||
|
||
func (v Variant) Equal(s string) bool { | ||
return string(v) == s | ||
} | ||
|
||
func (v Variant) String() string { | ||
return string(v) | ||
} | ||
|
||
func (v *Variant) FromString(variant string) error { | ||
*v = Variant(variant) | ||
switch *v { | ||
case CoreVariant, StandardVariant: | ||
return nil | ||
default: | ||
return fmt.Errorf("invalid variant: %s, possible values are %s", variant, ValidVariants) | ||
} | ||
} | ||
|
||
const CoreVariant Variant = "core" | ||
const StandardVariant Variant = "standard" | ||
|
||
var ValidVariants = []Variant{CoreVariant, StandardVariant} | ||
|
||
type KubernetesProvider string | ||
|
||
func (v *KubernetesProvider) FromString(provider string) error { | ||
*v = KubernetesProvider(provider) | ||
switch *v { | ||
case K3sProvider, K0sProvider: | ||
return nil | ||
default: | ||
return fmt.Errorf("invalid Kubernetes provider: %s, possible values are %s", provider, ValidProviders) | ||
} | ||
} | ||
|
||
const K3sProvider KubernetesProvider = "k3s" | ||
const K0sProvider KubernetesProvider = "k0s" | ||
|
||
var ValidProviders = []KubernetesProvider{K3sProvider, K0sProvider} |
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.