Skip to content

Commit

Permalink
cluster: fix a bug in k3d 5.4+ (#266)
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Santos <[email protected]>

Signed-off-by: Nick Santos <[email protected]>
  • Loading branch information
nicks authored Dec 6, 2022
1 parent f66abd9 commit 10ef972
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
sudo mv ./kind-linux-amd64 /usr/local/bin/kind
- run: |
set -ex
export TAG=v5.2.2
export TAG=v5.4.6
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash
- run: |
set -ex
Expand Down
6 changes: 5 additions & 1 deletion pkg/api/k3dv1alpha4/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ type TypeMeta struct {
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
}

type ObjectMeta struct {
Name string `mapstructure:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty"`
}

type VolumeWithNodeFilters struct {
Volume string `mapstructure:"volume" yaml:"volume,omitempty" json:"volume,omitempty"`
NodeFilters []string `mapstructure:"nodeFilters" yaml:"nodeFilters,omitempty" json:"nodeFilters,omitempty"`
Expand Down Expand Up @@ -94,7 +98,7 @@ type SimpleConfigRegistries struct {
// SimpleConfig describes the toplevel k3d configuration file.
type SimpleConfig struct {
TypeMeta `yaml:",inline"`
Name string `mapstructure:"name" yaml:"name,omitempty" json:"name,omitempty"`
ObjectMeta `mapstructure:"metadata" yaml:"metadata,omitempty" json:"metadata,omitempty"`
Servers int `mapstructure:"servers" yaml:"servers,omitempty" json:"servers,omitempty"` //nolint:lll // default 1
Agents int `mapstructure:"agents" yaml:"agents,omitempty" json:"agents,omitempty"` //nolint:lll // default 0
ExposeAPI SimpleExposureOpts `mapstructure:"kubeAPI" yaml:"kubeAPI,omitempty" json:"kubeAPI,omitempty"`
Expand Down
17 changes: 17 additions & 0 deletions pkg/api/k3dv1alpha4/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/cluster/admin_k3d_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ func TestK3DStartFlagsV5(t *testing.T) {
}, f.runner.LastArgs)
assert.Equal(t, f.runner.LastStdin, `kind: Simple
apiVersion: k3d.io/v1alpha4
name: my-cluster
metadata:
name: my-cluster
network: bar
registries:
use:
Expand Down

0 comments on commit 10ef972

Please sign in to comment.