Skip to content
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

[BUG] k3d config migrate $in [$out], options.kubeconfig shenanigans #1477

Open
christian-elsee opened this issue Aug 1, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@christian-elsee
Copy link

christian-elsee commented Aug 1, 2024

What did you do

Given the following config

$ cat config.yaml | sed '/^$/d'
apiVersion: k3d.io/v1alpha5
kind: Simple
metadata: 
  name: lab1
servers: 3
agents:  3
options:
  kubeconfig:
    updateDefaultKubeconfig: false 
    switchCurrentContext: false

And using k3d config migrate ./config.yaml, in order to validate, sanity-check, etc, config during orchestration workflow

$ dist/bin/k3d config migrate config.yaml --trace
DEBU[0000] DOCKER_SOCK=/var/run/docker.sock             
DEBU[0000] Runtime Info:
&{Name:docker Endpoint:/var/run/docker.sock Version:27.1.1 OSType:linux OS:Ubuntu 24.04 LTS Arch:x86_64 CgroupVersion:2 CgroupDriver:systemd Filesystem:extfs InfoName:lab1} 
DEBU[0000] Validating file config.yaml against default JSONSchema... 
DEBU[0000] JSON Schema Validation Result: &{errors:[] score:44} 
INFO[0000] Using config file config.yaml (k3d.io/v1alpha5#simple) 
TRAC[0000] Trying to read config apiVersion='k3d.io/v1alpha5', kind='simple' 
agents: 3
apiVersion: k3d.io/v1alpha5
kind: Simple
kubeAPI: {}
metadata:
  name: lab1
options:
  k3d:
    disableImageVolume: false
    disableLoadbalancer: false
    disableRollback: false
    loadbalancer: {}
    wait: false
  k3s: {}
  kubeconfig: {}
  runtime:
    HostPidMode: false
registries: {}
servers: 3

What did you expect to happen

I expected options.kubeconfig.updateDefaultKubeconfig and options.kubeconfig.switchCurrentContext to be declared and defined in resulting json object payload, regardless of boolean value.

Interestingly, when either field is defined as true

$ cat config.yaml | sed '/^$/d'
apiVersion: k3d.io/v1alpha5
kind: Simple
metadata: 
  name: lab1
servers: 3
agents:  3
options:
  kubeconfig:
    updateDefaultKubeconfig: true 
    switchCurrentContext: false

They make the cut

$ dist/bin/k3d config migrate config.yaml 
INFO[0000] Using config file config.yaml (k3d.io/v1alpha5#simple) 
agents: 3
apiVersion: k3d.io/v1alpha5
kind: Simple
kubeAPI: {}
metadata:
  name: lab1
options:
  k3d:
    disableImageVolume: false
    disableLoadbalancer: false
    disableRollback: false
    loadbalancer: {}
    wait: false
  k3s: {}
  kubeconfig:
    updateDefaultKubeconfig: true
  runtime:
    HostPidMode: false
registries: {}
servers: 3

Which OS & Architecture

Running k3d binary on old dev imac with DOCKER_HOST pointing to dedicated host on lan.

$ echo $DOCKER_HOST 
tcp://lab1:2375
$ uname -a
Darwin imac.lan 17.7.0 Darwin Kernel Version 17.7.0: Fri Oct 30 13:34:27 PDT 2020; root:xnu-4570.71.82.8~1/RELEASE_X86_64 x86_64 i386 Darwin

Dedicated host runtime

$ dist/bin/k3d runtime-info
arch: x86_64
cgroupdriver: systemd
cgroupversion: "2"
endpoint: /var/run/docker.sock
filesystem: extfs
infoname: lab1
name: docker
os: Ubuntu 24.04 LTS
ostype: linux
version: 27.1.1

Which version of k3d

 $ dist/bin/k3d version
k3d version v5.7.2
k3s version v1.29.6-k3s2 (default)

Which version of docker

$ docker info 
Client:
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc., v2.27.1)

Server:
 Containers: 8
  Running: 7
  Paused: 0
  Stopped: 1
 Images: 4
 Server Version: 27.1.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2bf793ef6dc9a18e00cb12efb64355c2c9d5eb41
 runc version: v1.1.13-0-g58aa920
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
  WARNING: You're not using the default seccomp profile
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-31-generic
 Operating System: Ubuntu 24.04 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 3.264GiB
 Name: lab1
 ID: 686df534-27a4-469a-898d-6825c8597d58
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

[DEPRECATION NOTICE]: API is accessible on http://0.0.0.0:2375 without encryption.
         Access to the remote API is equivalent to root access on the host. Refer
         to the 'Docker daemon attack surface' section in the documentation for
         more information: https://docs.docker.com/go/attack-surface/
In future versions this will be a hard failure preventing the daemon from starting! Learn more at: https://docs.docker.com/go/api-security/
$ docker version
Client: Docker Engine - Community
 Azure integration  0.1.15
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:41:33 2020
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          27.1.1
  API version:      1.46 (minimum version 1.24)
  Go version:       go1.21.12
  Git commit:       cc13f95
  Built:            Tue Jul 23 19:57:14 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.19
  GitCommit:        2bf793ef6dc9a18e00cb12efb64355c2c9d5eb41
 runc:
  Version:          1.7.19
  GitCommit:        v1.1.13-0-g58aa920
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Outside of the above, I've had no issues to speak of, which is to say good product guys and thank you for your efforts.

@christian-elsee christian-elsee added the bug Something isn't working label Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant