Skip to content

Commit

Permalink
Removes images in k0s config create by default
Browse files Browse the repository at this point in the history
Fixes k0sproject#2587

Signed-off-by: Juan Luis de Sousa-Valadas Castaño <[email protected]>
  • Loading branch information
juanluisvaladas committed Jan 20, 2023
1 parent 0ed0597 commit 9f02f27
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 36 deletions.
10 changes: 9 additions & 1 deletion cmd/config/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,26 @@ import (
)

func NewCreateCmd() *cobra.Command {
var includeImages bool

cmd := &cobra.Command{
Use: "create",
Short: "Output the default k0s configuration yaml to stdout",
RunE: func(cmd *cobra.Command, args []string) error {
cfg, err := yaml.Marshal(v1beta1.DefaultClusterConfig())
config := v1beta1.DefaultClusterConfig()
if !includeImages {
config.Spec.Images = nil
}

cfg, err := yaml.Marshal(config)
if err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "%s", cfg)
return nil
},
}
cmd.Flags().BoolVar(&includeImages, "include-images", false, "include the default images in the output")
cmd.PersistentFlags().AddFlagSet(config.GetPersistentFlagSet())
return cmd
}
36 changes: 2 additions & 34 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,40 +56,6 @@ spec:
storage:
create_default_storage_class: false
type: external_storage
images:
default_pull_policy: IfNotPresent
calico:
cni:
image: docker.io/calico/cni
version: v3.24.5
kubecontrollers:
image: docker.io/calico/kube-controllers
version: v3.24.5
node:
image: docker.io/calico/node
version: v3.24.5
coredns:
image: docker.io/coredns/coredns
version: 1.10.0
konnectivity:
image: quay.io/k0sproject/apiserver-network-proxy-agent
version: 0.0.33-k0s
kubeproxy:
image: registry.k8s.io/kube-proxy
version: v1.26.1
kuberouter:
cni:
image: docker.io/cloudnativelabs/kube-router
version: v1.5.1
cniInstaller:
image: quay.io/k0sproject/cni-node
version: 1.1.1-k0s.0
metricsserver:
image: registry.k8s.io/metrics-server/metrics-server
version: v0.6.2
pushgateway:
image: quay.io/k0sproject/pushgateway-ttl
version: edge@sha256:7031f6bf6c957e2fdb496161fe3bea0a5bde3de800deeba7b2155187196ecbd9
installConfig:
users:
etcdUser: etcd
Expand Down Expand Up @@ -412,6 +378,8 @@ spec:
version: v1.7.0
```

If you want to get the default values or the full struct, use `k0s config create --include-images`.

#### Available keys

- `spec.images.konnectivity`
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/k0s.k0sproject.io/v1beta1/clusterconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type ClusterSpec struct {
WorkerProfiles WorkerProfiles `json:"workerProfiles,omitempty"`
Telemetry *ClusterTelemetry `json:"telemetry"`
Install *InstallSpec `json:"installConfig,omitempty"`
Images *ClusterImages `json:"images"`
Images *ClusterImages `json:"images,omitempty"`
Extensions *ClusterExtensions `json:"extensions,omitempty"`
Konnectivity *KonnectivitySpec `json:"konnectivity,omitempty"`
}
Expand Down

0 comments on commit 9f02f27

Please sign in to comment.