Open DrummyFloyd opened 1 month ago
⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}
) and force push them to this branch (git push --force-with-lease
).
If you're new to commit signing, there are different ways to set it up:
gpg
ssh-agent
Thanks for the PR @DrummyFloyd 🎉
This PR will close https://github.com/kubefirst/kubefirst/issues/2146 .
I will try to test it today, but it will probably have to be tomorrow, sorry.
We won't be able to merge this yet as to add the GitHub support, we also need to update the https://github.com/kubefirst/kubefirst-api and https://github.com/kubefirst/kubefirst-api unless it was done already when you added K3s support. I need to check that first.
We won't be able to merge this yet as to add the GitHub support, we also need to update the https://github.com/kubefirst/kubefirst-api and https://github.com/kubefirst/kubefirst-api unless it was done already when you added K3s support. I need to check that first.
if i remember well, it should already be on the code
but yes could be great to check =)
EDIT: https://github.com/kubefirst/kubefirst-api/blob/5ba2497ec8f15c4f7380ff23c52d7648f83f17e7/internal/controller/git.go#L95 https://github.com/kubefirst/kubefirst/blob/986fea4d7576d1b495e949b4ec0795ec2a9ed08d/cmd/k3s/command.go#L101C119-L101C140
I was trying again the GitLab one before to ensure everything is fine on my side before trying this PR, but I get his error with the latest kubefirst release (not this branch):
{"level":"debug","time":"2024-05-30T18:23:52Z","message":"ERR: \u001b[31m╷\u001b[0m\u001b[0m"}
{"level":"debug","time":"2024-05-30T18:23:52Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[1m\u001b[31mError: \u001b[0m\u001b[0m\u001b[1mMissing newline after argument\u001b[0m"}
{"level":"debug","time":"2024-05-30T18:23:52Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m"}
{"level":"debug","time":"2024-05-30T18:23:52Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[0m on terraform.tfvars line 1:"}
{"level":"debug","time":"2024-05-30T18:23:52Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m 1: list_servers_private_ips = \"[\"\u001b[4m192.168.1.6\u001b[0m\",\"192.168.1.3\",\"192.168.1.5\"]\"\u001b[0m"}
{"level":"debug","time":"2024-05-30T18:23:52Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m"}
{"level":"debug","time":"2024-05-30T18:23:52Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mAn argument definition must end with a newline."}
{"level":"debug","time":"2024-05-30T18:23:52Z","message":"ERR: \u001b[31m╵\u001b[0m\u001b[0m"}
The command is how I wrote it at https://docs.kubefirst.io/k3s/quick-start/install/cli#create-your-new-kubefirst-cluster right?
If so, maybe something changed in the Terraform provider.
the K3S tf provider is pinned so not a version provider issue
but if you took the exact same command as the doc say , there is some issue upon some parameters
github
stuff with gitlab
stuff, dunno
EDIT: from what i recall, @jarededwards did a TF provider to create the requirement stuff on CIVO VM maybe something with TF version on your host ?
Oh yeah no, I use the correct GitLab parameters. I'll fix the docs. My question was mostly about the IPs since it's where the errors are. I created the VMs on Civo also, but it should work with any VMs anyway no? I would have assumed the issue was on my side, but the error is from Terraform while running the kubefirst command, not the script Jared created.
Oh yeah no, I use the correct GitLab parameters. I'll fix the docs. My question was mostly about the IPs since it's where the errors are. I created the VMs on Civo also, but it should work with any VMs anyway no? I would have assumed the issue was on my side, but the error is from Terraform while running the kubefirst command, not the script Jared created.
if something change, upon the detokenize
stuff, for me it should be related to this PR
https://github.com/kubefirst/kubefirst-api/commit/c9da2b8cc10d60b63960b6635242bd1e36b1c53d
But i don't see any relveant error ^^' so tbh dunno atm , what happn
Hi! Any News?
Hi! Any News?
i think it's still review =/ can't do nothing about it ^^ will ask to K1 team to have look asap if they have time =)
Sorry, the team is super busy, and I was on vacation. I had an issue with this integration when I tested. We quickly checked before I left, and I think we found the issue. I'll give it another go as soon as I'm done catching up on the last weeks.
@maxiar : note that you can try it yourself if you really need it asap. You'll need to use a custom gitops-template
repository pointing to that branch. See https://docs.kubefirst.io/k3s/explore/gitops#using-your-own-gitops-template-repository-fork
Sorry, the team is super busy, and I was on vacation. I had an issue with this integration when I tested. We quickly checked before I left, and I think we found the issue. I'll give it another go as soon as I'm done catching up on the last weeks.
@maxiar : note that you can try it yourself if you really need it asap. You'll need to use a custom
gitops-template
repository pointing to that branch. See https://docs.kubefirst.io/k3s/explore/gitops#using-your-own-gitops-template-repository-fork
Perfect! Good Vacations well deserved!! I will try to install the cluster using this branch "add-k3s-github", but we have a question, what version of the kuberfirst cli must be use? the latest? or compile from another WIP branch? Sorry for the dummy comment.. :)
When adding GitLab support, Drummy made sure GitHub was functional with the kubefirst CLI, so you only need to use this branch. To do so, add these flags (more information on the flags in the docs link I shared in my previous message) to the command for K3s (see https://docs.kubefirst.io/k3s/quick-start/install/cli/#create-your-new-kubefirst-cluster)
--gitops-template-url https://github.com/DrummyFloyd/gitops-template --gitops-template-branch add-k3s-github
I'm testing it right now, and with the fix I made before leaving for vacation, I'm passed the step where it was failing. So far so good, I'll keep you posted.
With the k3s PR, I have now an issue with the SSH key. The file is readable, and exist, but it seems like k1 can't find it.
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m╷\u001b[0m\u001b[0m"}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[1m\u001b[31mError: \u001b[0m\u001b[0m\u001b[1mInvalid function argument\u001b[0m"}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m"}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[0m on main.tf line 24, in module \"k3s\":"}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m 24: private_key = file(\u001b[4mvar.ssh_private_key\u001b[0m)\u001b[0m"}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m \u001b[90m├────────────────\u001b[0m"}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[0m \u001b[90m│\u001b[0m \u001b[1mvar.ssh_private_key\u001b[0m is \"/Users/fharper/.ssh/id_ed25519\""}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[0m"}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mInvalid value for \"path\" parameter: no file exists at"}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\"/Users/fharper/.ssh/id_ed25519\"; this function works only with files that"}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mare distributed as part of the configuration source code, so if this file"}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mwill be created by a resource in this configuration you must instead obtain"}
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mthis result from an attribute of that resource."}
Any idea what is going on here?
I'll give a try to the GitLab one as it's been a while, to see if it's a GitHub issue, a k3s one, or probably a code 18 😅
With the k3s PR, I have now an issue with the SSH key. The file is readable, and exist, but it seems like k1 can't find it.
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m╷\u001b[0m\u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[1m\u001b[31mError: \u001b[0m\u001b[0m\u001b[1mInvalid function argument\u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[0m on main.tf line 24, in module \"k3s\":"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m 24: private_key = file(\u001b[4mvar.ssh_private_key\u001b[0m)\u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m \u001b[90m├────────────────\u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[0m \u001b[90m│\u001b[0m \u001b[1mvar.ssh_private_key\u001b[0m is \"/Users/fharper/.ssh/id_ed25519\""} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mInvalid value for \"path\" parameter: no file exists at"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\"/Users/fharper/.ssh/id_ed25519\"; this function works only with files that"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mare distributed as part of the configuration source code, so if this file"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mwill be created by a resource in this configuration you must instead obtain"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mthis result from an attribute of that resource."}
Any idea what is going on here?
I'll give a try to the GitLab one as it's been a while, to see if it's a GitHub issue, a k3s one, or probably a code 18 😅
will check this asap , will ping you on slack when it's done ) surely a template issue here like before !
EDIT: still debugging atm i don't know where this issue come from
@maxiar can you please try on your end and tell me if you can reproduce ?
ok i reproduced and found the issue issue , need to discuss with k1 teams, about solutions , once i 've discussed ith them will push a hotfix for that =) and the template should be fine !
With the k3s PR, I have now an issue with the SSH key. The file is readable, and exist, but it seems like k1 can't find it.
{"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m╷\u001b[0m\u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[1m\u001b[31mError: \u001b[0m\u001b[0m\u001b[1mInvalid function argument\u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[0m on main.tf line 24, in module \"k3s\":"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m 24: private_key = file(\u001b[4mvar.ssh_private_key\u001b[0m)\u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m \u001b[90m├────────────────\u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[0m \u001b[90m│\u001b[0m \u001b[1mvar.ssh_private_key\u001b[0m is \"/Users/fharper/.ssh/id_ed25519\""} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\u001b[0m"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mInvalid value for \"path\" parameter: no file exists at"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0m\"/Users/fharper/.ssh/id_ed25519\"; this function works only with files that"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mare distributed as part of the configuration source code, so if this file"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mwill be created by a resource in this configuration you must instead obtain"} {"level":"debug","time":"2024-06-26T17:16:44Z","message":"ERR: \u001b[31m│\u001b[0m \u001b[0mthis result from an attribute of that resource."}
Any idea what is going on here? I'll give a try to the GitLab one as it's been a while, to see if it's a GitHub issue, a k3s one, or probably a code 18 😅
will check this asap , will ping you on slack when it's done ) surely a template issue here like before !
EDIT: still debugging atm i don't know where this issue come from
@maxiar can you please try on your end and tell me if you can reproduce ?
Sorry for the delay, I have some problems with my cloud hosting services, but it's ready to test when you want...
@maxiar: wait for the next fix on this PR. As @DrummyFloyd wrote, he identified the issue, and we discussed the solutions, so a fix in coming.
@maxiar: wait for the next fix on this PR. As @DrummyFloyd wrote, he identified the issue, and we discussed the solutions, so a fix in coming.
Perfect...
hot fix made here https://github.com/kubefirst/kubefirst-api/pull/353
seems to work on my end, but will ask for some test on k1 team to confirm that =)
The API changes are merged, will test this PR today.
Hi! I try to test the fix using this command:
export GITHUB_TOKEN=XXXXXX
kubefirst beta k3s create \
--servers-args "--disable traefik,--write-kubeconfig-mode 0644" \
--alerts-email eduardoojimenez@gmail.com \
--domain-name maxiar.dev \
--git-provider github \
--servers-private-ips 10.0.1.2,10.0.1.3,10.0.1.1 \
--servers-public-ips 65.21.63.182,95.217.216.146,37.27.15.187 \
--ssh-privatekey ~/.ssh-tf-hetzner-cloud/id_rsa.key \
--ssh-user root \
--cluster-name kubefirst \
--gitops-template-url https://github.com/DrummyFloyd/gitops-template \
--gitops-template-branch add-k3s-github
but I get and error: Error: please provide a github organization using the --github-org flag because I've a personal account (https://github.com/maxiar) is not an organizacion.. It's mandatory? When I added --github-org maxiar but not works...
kubefirst beta k3s create \
--servers-args "--disable traefik,--write-kubeconfig-mode 0644" \
--alerts-email eduardoojimenez@gmail.com \
--domain-name maxiar.dev \
--git-provider github \
--github-org maxiar \
--servers-private-ips 10.0.1.2,10.0.1.3,10.0.1.1 \
--servers-public-ips 65.21.63.182,95.217.216.146,37.27.15.187 \
--ssh-privatekey ~/.ssh-tf-hetzner-cloud/id_rsa.key \
--ssh-user root \
--cluster-name kubefirst \
--gitops-template-url https://github.com/DrummyFloyd/gitops-template \
--gitops-template-branch add-k3s-github
Error: something went wrong calling GitHub API during org lookup, http status code is: 404, and response is: "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/orgs/members#get- organization-membership-for-a-user\",\"status\":\"404\"}"
EDIT:: Another thing: I ommited the --dns-provider cloudflare parameter because I haven't a cloudfare account is it ok?? Can you help me? Thanks in advanced
It's mandatory? When I added --github-org maxiar but not works...
It is for clouds support that aren't k3d. You can create a free one with a free account on GitHub.
It's mandatory? When I added --github-org maxiar but not works...
It is for clouds support that aren't k3d. You can create a free one with a free account on GitHub.
--ssh-privatekey $(cat ~/.ssh/id_rsa)
and the dns-provider is mandatory
Since it's using an API code that isn't released, not used within the CLI until our next release, you also need to run it manually, or point the CLI to a local fork of main.
At that point, unless you tried kubefirst from code already, I would suggest you let us tests @maxiar , and once everything is good, we will merge and release a new kubefirst version with this new implementation.
Since it's using an API code that isn't released, not used within the CLI until our next release, you also need to run it manually, or point the CLI to a local fork of main.
At that point, unless you tried kubefirst from code already, I would suggest you let us tests @maxiar , and once everything is good, we will merge and release a new kubefirst version with this new implementation.
oki...I understand.. while you test and prepare the new release.. during this time I will try to compile kuberfirst-cli, I already done, a few months ago...
Only two questions: 1) Do I need to use the latest version from this repo: https://github.com/kubefirst/kubefirst (main branch) ? the fix was already made or I waiting for it? only the kuberfirst-cli? or also de Kubefirst API https://github.com/kubefirst/kubefirst-api ?
2) As @DrummyFloyd tell me the dns-provider flag is mandatory, what happens if I already have all DNS working fine (managed by Hertzner DNS, not cloudfare) like console.maxiar.dev, kuberfirst.maxiar.dev, argo.maxiar.dev correctly pointed to a LoadBalancer (balancing behind the 3 publics IP where the kuberfist cluster is installed) It can be work?
Thanks!
Do I need to use the latest version from this repo: kubefirst/kubefirst (main branch) ?
For the CLI, you can, in theory, use main
or last published version as nothing was added to it for this PR. In practice, since you will need to use the latest API, you will need to run from main
locally.
the fix was already made or I waiting for it?
The SSH issue I had, is in theory fixed (I don't doubt Drummy when I say in theory, just that I didn't test it successfully yet) with this commit that was merged into the main
branch of the API.
only the kuberfirst-cli? or also de Kubefirst API kubefirst/kubefirst-api ?
Since a new CLI version using a new API version wasn't publish yet, you will also need to point the CLI to the latest from main
. Once I'm done with my tests, I will update our repository docs to write how to properly test that with the CLI, as we only have instructions to use a local API version if you use the console for UI installation.
As @DrummyFloyd tell me the dns-provider flag is mandatory,
AFAIK, it won't work as kubefirst is creating subdomains and pointing proper DNS for you and ensure it points to the right pods/nginx... in any clouds offering we have, hence why on public clouds you can choose to use their DNS or cloudflare. On k3s, since it can be created everywhere, you can only use Cloudflare. You always just need to provider the root domain name, we do the rest. With that said, you can create a free Cloudflare account which I think will let you manage one domain DNS without having to pay.
It may be a code 18 and I'm not using the latest API version, but when I tried I got this error (see screenshot), and no ssh_private_key\
was in ~/.k1/kubefirst-fred/gitops/terraform/k3s/terraform.tfvars
🤯
It's mandatory? When I added --github-org maxiar but not works...
It is for clouds support that aren't k3d. You can create a free one with a free account on GitHub.
- You will need make something like this for the sshbkey
--ssh-privatekey $(cat ~/.ssh/id_rsa)
and the dns-provider is mandatory
The correct way to pass the private key is:
--ssh-privatekey "$(cat ~/.ssh-tf-hetzner-cloud/id_rsa.key)"
with quotes to avoid the error:
Error: bad flag syntax: -----END Usage: executor [flags] The -----END is indicating the end of the private key text.
Do I need to use the latest version from this repo: kubefirst/kubefirst (main branch) ?
For the CLI, you can, in theory, use
main
or last published version as nothing was added to it for this PR. In practice, since you will need to use the latest API, you will need to run frommain
locally.the fix was already made or I waiting for it?
The SSH issue I had, is in theory fixed (I don't doubt Drummy when I say in theory, just that I didn't test it successfully yet) with this commit that was merged into the
main
branch of the API.only the kuberfirst-cli? or also de Kubefirst API kubefirst/kubefirst-api ?
Since a new CLI version using a new API version wasn't publish yet, you will also need to point the CLI to the latest from
main
. Once I'm done with my tests, I will update our repository docs to write how to properly test that with the CLI, as we only have instructions to use a local API version if you use the console for UI installation.As @DrummyFloyd tell me the dns-provider flag is mandatory,
AFAIK, it won't work as kubefirst is creating subdomains and pointing proper DNS for you and ensure it points to the right pods/nginx... in any clouds offering we have, hence why on public clouds you can choose to use their DNS or cloudflare. On k3s, since it can be created everywhere, you can only use Cloudflare. You always just need to provider the root domain name, we do the rest. With that said, you can create a free Cloudflare account which I think will let you manage one domain DNS without having to pay.
Well, in my humble contribution ...
I did all.. download, compile, and run all locally: kuberfist & kuberfirst-api, create a cloudfare account, transfer my domain, all.. but continue no working, using the following command:
export GITHUB_TOKEN=XXXXXXXXX
export CF_API_TOKEN=XXXXXXXXXX
export K1_LOCAL_DEBUG=true
export API_URL=http://localhost:8081
go run . beta k3s create \
--servers-args "--disable traefik,--write-kubeconfig-mode 0644" \
--alerts-email eduardoojimenez@gmail.com \
--dns-provider cloudflare \
--domain-name maxiar.dev \
--git-provider github \
--github-org maxiar-org \
--servers-private-ips 10.0.1.2,10.0.1.3,10.0.1.1 \
--servers-public-ips 65.21.63.182,95.217.216.146,37.27.15.187 \
--ssh-privatekey "$(cat ~/.ssh-tf-hetzner-cloud/id_rsa.key)" \
--ssh-user root \
--cluster-name maxiar \
--gitops-template-url https://github.com/DrummyFloyd/gitops-template \
--gitops-template-branch add-k3s-github
The latest erros are:
{"level":"debug","time":"2024-07-04T21:50:07-03:00","message":"unable to reach \"https://console.kubefirst.dev/api/proxyHealth\" (15/60)"}
Why the cluster name is kubefirst and not maxiar (as cluster-name paramerter)? Why I see in the logs.... "install k3d" or "Creating k3d cluster" instead k3s, it's very confusing..
I attach the my logs with multiples test to analyze. log_maxiar.log
NOTE: I get the same errors, using the latest kubefirst (binary, no compiled) and pass the --ssh-privatekey ~/.ssh/id_rsa (by file instead text), check this another logs.. log_kubefirst.log
If you need to test something, tell me... I've the local environment prepared.
Thanks!
becasue i saw many ppl asking for the github templates, there it is
still need some test especially on TF parts