Skip to content

Commit

Permalink
WIP: LXD integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred78290 committed Sep 1, 2024
1 parent 1073680 commit 15e4248
Show file tree
Hide file tree
Showing 15 changed files with 1,341 additions and 78 deletions.
103 changes: 99 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,30 @@
"--kubeconfig=${workspaceFolder}/.config/cloudstack/cloudstack-dev-k3s/config",
"--log-level=debug"
]
}, {
},
{
"preLaunchTask": "k3s lxd",
"name": "k3s lxd",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"cwd": "${env:HOME}/go/src/github.com/Fred78290/kubernetes-cloud-autoscaler",
"args": [
"--listen=unix:/tmp/autoscaler.sock",
"--request-timeout=120s",
"--grpc-provider=externalgrpc",
"--distribution=k3s",
"--plateform=lxd",
"--plateform-config=${workspaceFolder}/.config/lxd/lxd-dev-k3s/provider.json",
"--machines=${workspaceFolder}/.config/lxd/lxd-dev-k3s/machines.json",
"--config=${workspaceFolder}/.config/lxd/lxd-dev-k3s/autoscaler.json",
"--save=${workspaceFolder}/.config/lxd/lxd-dev-k3s/state.json",
"--kubeconfig=${workspaceFolder}/.config/lxd/lxd-dev-k3s/config",
"--log-level=debug"
]
},
{
"preLaunchTask": "k3s vsphere",
"name": "k3s vsphere",
"type": "go",
Expand Down Expand Up @@ -256,7 +279,31 @@
"--kubeconfig=${workspaceFolder}/.config/cloudstack/cloudstack-dev-kubeadm/config",
"--log-level=info"
]
}, {
},
{
"preLaunchTask": "kubeadm lxd",
"name": "kubeadm lxd",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"cwd": "${env:HOME}/go/src/github.com/Fred78290/kubernetes-cloud-autoscaler",
"args": [
"--listen=unix:/tmp/autoscaler.sock",
"--request-timeout=120s",
"--grpc-provider=externalgrpc",
"--distribution=kubeadm",
"--plateform=lxd",
"--plateform-config=${workspaceFolder}/.config/lxd/lxd-dev-kubeadm/provider.json",
"--cloud-provider=external",
"--machines=${workspaceFolder}/.config/lxd/lxd-dev-kubeadm/machines.json",
"--config=${workspaceFolder}/.config/lxd/lxd-dev-kubeadm/autoscaler.json",
"--save=${workspaceFolder}/.config/lxd/lxd-dev-kubeadm/state.json",
"--kubeconfig=${workspaceFolder}/.config/lxd/lxd-dev-kubeadm/config",
"--log-level=info"
]
},
{
"preLaunchTask": "kubeadm vsphere",
"name": "kubeadm vsphere",
"type": "go",
Expand Down Expand Up @@ -398,7 +445,31 @@
"--kubeconfig=${workspaceFolder}/.config/cloudstack/cloudstack-dev-rke2/config",
"--log-level=debug"
]
}, {
},
{
"preLaunchTask": "rke2 lxd",
"name": "rke2 lxd",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"cwd": "${env:HOME}/go/src/github.com/Fred78290/kubernetes-cloud-autoscaler",
"args": [
"--listen=unix:/tmp/autoscaler.sock",
"--request-timeout=120s",
"--grpc-provider=externalgrpc",
"--distribution=rke2",
"--plateform=lxd",
"--plateform-config=${workspaceFolder}/.config/lxd/lxd-dev-rke2/provider.json",
"--cloud-provider=external",
"--machines=${workspaceFolder}/.config/lxd/lxd-dev-rke2/machines.json",
"--config=${workspaceFolder}/.config/lxd/lxd-dev-rke2/autoscaler.json",
"--save=${workspaceFolder}/.config/lxd/lxd-dev-rke2/state.json",
"--kubeconfig=${workspaceFolder}/.config/lxd/lxd-dev-rke2/config",
"--log-level=debug"
]
},
{
"preLaunchTask": "rke2 vsphere",
"name": "rke2 vsphere",
"type": "go",
Expand Down Expand Up @@ -540,7 +611,31 @@
"--kubeconfig=${workspaceFolder}/.config/cloudstack/cloudstack-dev-microk8s/config",
"--log-level=debug"
]
}, {
},
{
"preLaunchTask": "microk8s lxd",
"name": "microk8s lxd",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"cwd": "${env:HOME}/go/src/github.com/Fred78290/kubernetes-cloud-autoscaler",
"args": [
"--listen=unix:/tmp/autoscaler.sock",
"--request-timeout=120s",
"--grpc-provider=externalgrpc",
"--distribution=microk8s",
"--plateform=lxd",
"--plateform-config=${workspaceFolder}/.config/lxd/lxd-dev-microk8s/provider.json",
"--cloud-provider=external",
"--machines=${workspaceFolder}/.config/lxd/lxd-dev-microk8s/machines.json",
"--config=${workspaceFolder}/.config/lxd/lxd-dev-microk8s/autoscaler.json",
"--save=${workspaceFolder}/.config/lxd/lxd-dev-microk8s/state.json",
"--kubeconfig=${workspaceFolder}/.config/lxd/lxd-dev-microk8s/config",
"--log-level=debug"
]
},
{
"preLaunchTask": "microk8s vsphere",
"name": "microk8s vsphere",
"type": "go",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/examples/multipass/k3s/managed-dhcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
- sample-annotation.acme.com=sample
network:
multipass:
- network: "lxdbr0"
- network: "cloudbr0"
dhcp: true
- network: "mpbr0"
dhcp: true
Expand Down
63 changes: 39 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/Fred78290/kubernetes-cloud-autoscaler

go 1.22.0
go 1.22.5

toolchain go1.22.3
toolchain go1.23.0

require (
github.com/alecthomas/kingpin v2.2.6+incompatible
Expand All @@ -13,16 +13,17 @@ require (
github.com/aws/aws-sdk-go-v2/service/ec2 v1.174.0
github.com/aws/aws-sdk-go-v2/service/route53 v1.42.3
github.com/aws/smithy-go v1.20.3
github.com/canonical/lxd v0.0.0-20240831143919-6c49827f4138
github.com/drone/envsubst v1.0.3
github.com/gophercloud/gophercloud/v2 v2.1.0
github.com/linki/instrumented_http v0.3.0
github.com/miekg/dns v1.1.61
github.com/miekg/dns v1.1.62
github.com/praserx/ipconv v1.2.2
github.com/sirupsen/logrus v1.9.3
github.com/stianwa/rndc v0.1.4
github.com/stretchr/testify v1.9.0
github.com/vmware/govmomi v0.39.0
golang.org/x/crypto v0.25.0
golang.org/x/crypto v0.26.0
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v2 v2.4.0
Expand All @@ -47,11 +48,14 @@ require (
github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dougm/pretty v0.0.0-20171025230240-2ee9d7453c02 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3 // indirect
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
Expand All @@ -63,40 +67,51 @@ require (
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/muhlemmer/gu v0.3.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/pkg/sftp v1.13.6 // indirect
github.com/pkg/xattr v0.4.10 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.20.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.22.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
github.com/zitadel/logging v0.6.0 // indirect
github.com/zitadel/oidc/v3 v3.28.2 // indirect
github.com/zitadel/schema v1.3.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.24.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading

0 comments on commit 15e4248

Please sign in to comment.