Code Monkey home page Code Monkey logo

kdk's People

Contributors

adamdmharvey avatar dcwangmit01 avatar erikburgess avatar hangxie avatar hangxie-cisco avatar josdotso avatar liggitt avatar marsavela avatar prabdeb avatar raoulbhatia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kdk's Issues

SSH keys permission error

SSH keys are currently generated as root giving a permission denied on ./kdk ssh.

ssh kdk@localhost -A -p 2022 -i ~/.kdk/ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
Warning: Permanently added '[localhost]:2022' (ECDSA) to the list of known hosts.
Load key "/home/kdk/.kdk/ssh/id_rsa": Permission denied
kdk@localhost's password:

(I've executed the commands as user kdk with uid 1002. uid 1000 is a different user on the same system.)

kdk@rb:~$ ls -aln ./.kdk/ssh/
total 16
drwxr-xr-x 2 1002 1002 4096 Jun 29 12:12 .
drwxr-xr-x 3 1002 1002 4096 Jun 29 12:12 ..
-rw------- 1    0    0 3247 Jun 29 12:12 id_rsa
-rw------- 1 1000 1000  743 Jun 29 12:12 id_rsa.pub

Upgrade Executor to work around Python 3.7 incompatibility

KDK doesn't work when using Python 3.7 i.e. via MacOS Homebew and Executor 20.0 due to asyncbeing a reserved keyword in Python 3.7 [1].

Traceback (most recent call last):
  File "./kdk", line 12, in <module>
    from executor import execute
  File "/Users/raobhati/Dev/kdk/.venv/lib/python3.7/site-packages/executor/__init__.py", line 199
    if command.async:
                   ^
SyntaxError: invalid syntax

See Python 3.7 reserved word: async #9

[1] https://docs.python.org/3.7/reference/lexical_analysis.html?highlight=reserved%20word#keywords

"kdk update" runtime error when no configuration file is present

Running kdk update without a valid config file results in the following runtime error:
panic: runtime error: invalid memory address or nil pointer dereference.

kdk update                                                                                                                                            
WARN[0000] Failed to load KDK config.                    configFileUsed=/Users/user/.kdk/kdk/config.yaml err="open /Users/user/.kdk/kdk/config.yaml: no such file or directory"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x90 pc=0x15fd04a]

goroutine 1 [running]:
github.com/cisco-sso/kdk/pkg/kdk.needsUpdateConfig(...)
	/home/travis/gopath/src/github.com/cisco-sso/kdk/pkg/kdk/update.go:81
github.com/cisco-sso/kdk/pkg/kdk.Update(0x1df1880)
	/home/travis/gopath/src/github.com/cisco-sso/kdk/pkg/kdk/update.go:94 +0x95a
github.com/cisco-sso/kdk/cmd/kdk.glob..func11(0x1de3de0, 0x1e0e5b8, 0x0, 0x0)
	/home/travis/gopath/src/github.com/cisco-sso/kdk/cmd/kdk/update.go:27 +0x2d
github.com/spf13/cobra.(*Command).execute(0x1de3de0, 0x1e0e5b8, 0x0, 0x0, 0x1de3de0, 0x1e0e5b8)
	/home/travis/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:766 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0x1de2880, 0xffffffffffffffff, 0x0, 0xc0004a9e08)
	/home/travis/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x2ea
github.com/spf13/cobra.(*Command).Execute(...)
	/home/travis/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:800
github.com/cisco-sso/kdk/cmd/kdk.Execute()
	/home/travis/gopath/src/github.com/cisco-sso/kdk/cmd/kdk/kdk.go:49 +0x42
main.main()
	/home/travis/gopath/src/github.com/cisco-sso/kdk/main.go:20 +0x20

Golang KDK fails to start if it already has stopped before without a destroy

Had to manually remove the stopped container.

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
$ kdk up
FATA[0000] Failed to create KDK container                command=up error="Error response from daemon: Conflict. The container name \"/kdk\" is already in use by container \"60c11804a8d6e7353e2d5407be026375a93a0c9013b63baa51934781e1cce07c\". You have to remove (or rename) that container to be able to reuse that name."
$ docker ps -a
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                      PORTS                    NAMES
60c11804a8d6        ciscosso/kdk:debian-latest   "/lib/systemd/systemd"   5 days ago          Exited (255) 23 hours ago   0.0.0.0:2022->2022/tcp   kdk
$ kdk destroy
INFO[0000] No KDK containers found. Nothing to destroy...  command=destroy
$ docker rm -f kdk
kdk
$ kdk up
INFO[0000] Successfully started KDK container            command=up

Implement `kdk cp`

  • Use scp to copy files to/from host and a kdk container.
  • Should support naming one of multiple kdk containers.

kdk up fails because of incompatable Dokan library

kdk up fails on Windows because keybase requires Dokan 1.2.0 and the kdk expects 1.1.0. Downgrading Dokan to 1.1.0 causes keybase filesystem integration to be disabled.

The system cannot find the file C:\Program Files\Dokan\Dokan Library-1.1.0\sample\mirror\mirror.exe.
"Unrecognized parameter start. You must pass either start or stop"
INFO[0019] An exited KDK container exists

Keybase Client: 2.11.0-20181203203419+ec71fb1ab3

Add jwt-cli

https://github.com/mike-engel/jwt-cli

Example usage:

foo get token | jwt decode -

Token header
------------
{
  "typ": "JWT",
  "alg": "HS256"
}

Token claims
------------
{
  "aud": "api",
  "exp": 0,
  "https://example.org": {},
  "iat": 1582668632,
  "id": "b74647fd-cecd-5a7e-b672-5f00a1163eaf",
  "iss": "api",
  "role": "boss"
}

Dockerfile for running awake based chart update

Is it a good idea to have a Dockerfile that can help to update chart repo (cisco-sso/charts)?

Mainly the Dockerfile will have awake, helm, kubectl, ansible installed.

Current KDK Dockerfile might be little big for that!

I have tried to build it, size is coming close to 300MB.

Add cfssl tool

go get -u github.com/cloudflare/cfssl/cmd/cfssljson
go get -u github.com/cloudflare/cfssl/cmd/cfssl

Improve first run of "kdk init" for new users

When doing a fresh install on MacOS 10.15.4, $HOME/.kdk/ does not exist.

The first run of kdk init is therefore generating warnings that are confusing to new users, specifically [...] "open /Users/user/.kdk/kdk/config.yaml: no such file or directory".

Additional information and/or clarification that this error is OK in such a case would improve the user experience.

Thanks,
Raoul

Full output of kdk init:

$ kdk init                                                                                                                                              
WARN[0000] Failed to load KDK config.                    configFileUsed=/Users/user/.kdk/kdk/config.yaml err="open /Users/user/.kdk/kdk/config.yaml: no such file or directory"
WARN[0000] Failed to add keybase mount:Failed to detect potential keybase filesystem mounts
Would you like to mount additional docker host directories into the KDK? [y/n] n
Would you like to enable SOCKS proxy? [y/n] n
INFO[0103] Set SOCKS port 8000
WARN[0103] KDK config does not exist
INFO[0103] Creating KDK config
WARN[0103] KDK ssh key pair not found.
INFO[0103] Generating ssh key pair...
INFO[0105] Successfully generated ssh key pair.
INFO[0105] KDK config written to /Users/user/.kdk/kdk/config.yaml. Modify this file to suit your needs.

KDK host-mount filesystem slowness on Mac

We need to bring docker lib to newer version to support cached, ref: https://docs.docker.com/docker-for-mac/osxfs-caching/

Performance test was done with kubernetes repo under golang docker container and go list

for D in $(seq 1 5); do cd /perftest/ && time go list ./... > /dev/null; done 2>&1 | grep real | tail -3

Comparision:

  1. linux does not have much difference:
  • docker run -it --rm -v `pwd`/kubernetes:/perftest golang

real 0m4.099s
real 0m4.101s
real 0m3.981s

  • docker run -it --rm -v `pwd`/kubernetes:/perftest:cached golang

real 0m3.807s
real 0m3.843s
real 0m4.031s

  1. mac: w/ cached is about 3 times faster than w/o cached
  • docker run -it --rm -v `pwd`/kubernetes:/perftest golang

real 2m8.093s
real 2m12.504s
real 2m34.471s

  • docker run -it --rm -v `pwd`/kubernetes:/perftest:cached golang

real 0m40.561s
real 0m41.422s
real 0m41.870s

Allow common parameters to kdk to be passed as a string or from a file

I destroy and recreate kdk containers quite often. It would be nice if we could allow the users to pass in the configuration as a string or from a file and avoid the interactive prompts alltogether.

something like this...

kdk init --config '{"Name": "kdk0", "DotfilesRepo": "https://github.com/rtluckie/work-dotfiles.git", "Shell": "/usr/local/bin/zsh", "KeybaseMount": true, "ExtraMounts": [{"Source": "/User/jdoe/projects", "Target": "/home/jdoe/projects"}, {"Source": "/User/jdoe/docs", "Target": "/home/jdoe/docs"}], "socks": {"enable": true, "port": 8000}}'
kdk init --config-from-file my-kdk-config.yaml
# my-kdk-config.yaml
Name: kdk0
DotfilesRepo: https://github.com/rtluckie/work-dotfiles.git
Dhell: "/usr/local/bin/zsh"
DeybaseMount: true
ExtraMounts:
- Source: "/User/jdoe/projects"
  Target: "/home/jdoe/projects"
- Source: "/User/jdoe/docs"
  Target: "/home/jdoe/docs"
Socks:
  enable: true
  port: 8000

We also may want to consider enabling the user to override elements of ContainerConfig or HostConfig, but that would take some more thought.

Add go-task

https://github.com/go-task/task/releases

To demonstrate this tool works, here is very basic example Taskfile.yml:

version: "2"

tasks:

  default:
    cmds:
      - task: install

  install:
    desc: Install to Kubernetes.
    deps:
      - tiller
      - nginx-ingress
      - consul

  tiller:
    desc: Install Helm Tiller.
    cmds:
      - helm init --wait

  nginx-ingress:
    desc: Install Helm Chart for Nginx Ingress.
    cmds:
      - helm upgrade --install --recreate-pods
          --namespace nginx-ingress
          --values nginx-ingress/values.yaml
          nginx-ingress stable/nginx-ingress

  consul:
    desc: Install Helm Chart for Consul.
    cmds:
      - helm upgrade --install --recreate-pods
          --namespace consul
          --values consul/values.yaml
          consul stable/consul

Apple Silicon ARM64 support

Currently, the installation does not work with Macs with M1 chips.
I tried bypassing the installation.sh script and installed the amd64 version and was getting the following error with kdk ssh

kex_exchange_identification: Connection closed by remote host
Connection closed by ::1 port 59033
FATA[0011] Failed to ssh to KDK container.               error="exit status 255"

Also attempted to build the Docker Image locally, but was getting various errors within provision.sh due to outdated Go, and the Go packages.

Thanks

Fix CI

We need to get fully automated CI sorted out. The manual pushing of the docker containers is a serious PITA.

I would advocate moving from travis to circleci.

I am getting this problem and not able to setup KDK.

Run the following command to continue once this error has been fixed:
direnv allow
######################### DEPENDENCY ERROR #########################
######################### DEPENDENCY ERROR #########################
You must be registered on keybase.io and added to the team cisco_sso.honjo

Run the following command to continue once this error has been fixed:
direnv allow
######################### DEPENDENCY ERROR #########################
######################### DEPENDENCY ERROR #########################
Failed to find /keybase/team/cisco_sso.honjo/kubeconfig/honjo1-dev.csco.cloud

This error may be benign if the cluster hasn't been created yet

Run the following command to continue once this error has been fixed:
direnv allow

KDK contianer is not starting after upgrade to 1.8

Hi Team,

I upgraded the KDK from 1.6.1 to 1.8.0 yesterday. Now the KDK container is not getting started. Getting the below error.


$ kdk ssh -d
time="2019-03-19T09:30:49+05:30" level=warning msg="Upgrade Available\n***************************************\nSome KDK components are out of date.\n Latest Version: 1.9.0\n Binary Version: 1.8.0\n Image Tag: 1.8.0\n Container Present at Config Version: false\n\nPlease upgrade the KDK with the commands:\n kdk update\n kdk destroy\n kdk ssh\n***************************************"
time="2019-03-19T09:30:49+05:30" level=info msg="Connecting to KDK container"
time="2019-03-19T09:30:49+05:30" level=info msg="KDK is not currently running. Starting..."
time="2019-03-19T09:30:49+05:30" level=debug msg="Not pulling already present KDK Image" tag=1.8.0
time="2019-03-19T09:30:49+05:30" level=info msg="Keybase mirror already started"
time="2019-03-19T09:30:50+05:30" level=fatal msg="Failed to create KDK container" error="Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /host_mnt/c/Users/soupradh/.kdk/ssh/id_rsa.pub"


Not sure where it is taking the /host_mnt/.

I have updated to 1.9.0, but also getting the same error.

Thanks,
Soubhayga

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.