Skip to content

Commit f61ff5c

Browse files
committed
release: v0.1.1
This version contains changes to the vlan network schema, as it wasn't properly picked up by nixidy.
1 parent 2d3b48a commit f61ff5c

36 files changed

+312
-343
lines changed

Makefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION ?= 0.0.0
1+
VERSION ?= 0.1.1
22
DOCKERHUB_USER ?= plan9better
33
LOCAL_REGISTRY ?= 192.168.10.201:5000
44

@@ -30,6 +30,20 @@ test:
3030
docker build -t $(LOCAL_REGISTRY)/vlan-interface:latest-dev --platform linux/amd64 --file ./interface.Dockerfile --build-arg PLATFORM=amd64 .
3131
docker push $(LOCAL_REGISTRY)/vlan-interface:latest-dev
3232

33+
test-local:
34+
docker build -t $(LOCAL_REGISTRY)/vlanman:$(VERSION) --platform linux/arm64 --file ./operator.Dockerfile --build-arg PLATFORM=arm64 .
35+
docker push $(LOCAL_REGISTRY)/vlanman:$(VERSION)
36+
37+
docker build -t $(LOCAL_REGISTRY)/vlan-manager:$(VERSION) --platform linux/arm64 --file ./manager.Dockerfile --build-arg PLATFORM=arm64 .
38+
docker push $(LOCAL_REGISTRY)/vlan-manager:$(VERSION)
39+
40+
docker build -t $(LOCAL_REGISTRY)/vlan-worker:$(VERSION) --platform linux/arm64 --file ./worker.Dockerfile --build-arg PLATFORM=arm64 .
41+
docker push $(LOCAL_REGISTRY)/vlan-worker:$(VERSION)
42+
43+
docker build -t $(LOCAL_REGISTRY)/vlan-interface:$(VERSION) --platform linux/arm64 --file ./interface.Dockerfile --build-arg PLATFORM=arm64 .
44+
docker push $(LOCAL_REGISTRY)/vlan-interface:$(VERSION)
45+
46+
3347
vlanman:
3448
docker build -t $(LOCAL_REGISTRY)/vlanman:latest-dev --platform linux/arm64 --file ./operator.Dockerfile .
3549
docker push $(LOCAL_REGISTRY)/vlanman:latest-dev

api/v1/vlanman.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ type VlanNetworkList struct {
2121
}
2222

2323
type VlanNetworkSpec struct {
24-
LocalGatewayIP string `json:"localGatewayIp"`
25-
RemoteGatewayIP string `json:"remoteGatewayIp"`
26-
LocalSubnet []string `json:"localSubnet"`
27-
RemoteSubnet []string `json:"remoteSubnet"`
28-
VlanID int `json:"vlanId"`
29-
ExcludedNodes []string `json:"excludedNodes,omitempty"`
30-
Pools map[string][]string `json:"pools"`
24+
LocalGatewayIP string `json:"localGatewayIp"`
25+
RemoteGatewayIP string `json:"remoteGatewayIp"`
26+
LocalSubnet []string `json:"localSubnet"`
27+
RemoteSubnet []string `json:"remoteSubnet"`
28+
VlanID int `json:"vlanId"`
29+
ExcludedNodes []string `json:"excludedNodes,omitempty"`
30+
Pools []VlanNetworkPool `json:"pools"`
31+
}
32+
33+
type VlanNetworkPool struct {
34+
Description string `json:"description"`
35+
Addresses []string `json:"addresses"`
36+
Name string `json:"name"`
3137
}
3238

3339
type VlanNetworkStatus struct {

cmd/manager/main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,13 @@ func getEnvs() Envs {
332332
func getValues() (int64, *time.Time) {
333333
cnt := leaderChanges.Load()
334334

335-
val, ok := lastLeaderChange.Load().(time.Time)
335+
val := lastLeaderChange.Load()
336+
change, ok := val.(time.Time)
336337
if !ok {
337-
panic("Last leader change metric is not of type time.Time")
338-
}
339-
if time.Unix(0, 0).Equal(val) {
340338
return cnt, nil
339+
// panic("Last leader change metric is not of type time.Time")
341340
}
342-
return cnt, &val
341+
return cnt, &change
343342
}
344343

345344
func interfaceSetup(ctx context.Context, e Envs) {

flake.lock

Lines changed: 8 additions & 136 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@
44
inputs = {
55
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
66
flake-utils.url = "github:numtide/flake-utils";
7-
nix2container.url = "github:nlewo/nix2container";
8-
nix-filter.url = "github:numtide/nix-filter";
9-
nixidy.url = "github:dialohq/nixidy/d010752e7f24ddaeedbdaf46aba127ca89d1483a";
7+
nixidy.url = "github:arnarg/nixidy";
108
};
119

1210
outputs = {
1311
nixpkgs,
1412
flake-utils,
15-
nix-filter,
16-
nix2container,
13+
nixidy,
1714
...
1815
}:
1916
flake-utils.lib.eachDefaultSystem (
@@ -22,44 +19,17 @@
2219
inherit system;
2320
config.allowUnfree = true;
2421
};
25-
n2cPkgs = nix2container.packages.${system};
26-
mkImg = n2cPkgs.nix2container.buildImage;
27-
in rec {
28-
packages = {
29-
cad =
30-
pkgs.runCommand "vlanman-as-dir" {}
31-
"${packages.operatorImage.copyTo}/bin/copy-to dir:$out";
32-
33-
operator = pkgs.buildGoModule {
34-
pname = "vlanman-operator";
35-
src = nix-filter {
36-
root = ./.;
37-
include = [
38-
"api"
39-
"internal"
40-
"cmd"
41-
"go.mod"
42-
"go.sum"
43-
];
44-
};
45-
doCheck = false;
46-
version = "0.0.1";
47-
vendorHash = "sha256-lynECpqy6ptfeMEawSNVlrVcd521OSXUZutSTI7g5e4=";
48-
env.CGO_ENABLED = 0;
49-
};
50-
operatorImage = mkImg {
51-
name = "plan9better/vlanman-operator";
52-
tag = "latest-dev";
53-
copyToRoot =
54-
pkgs.runCommand "operator-root" {
55-
buildInputs = [packages.operator pkgs.uutils-coreutils-noprefix];
56-
} ''
57-
mkdir -p $out/bin
58-
cp ${packages.operator}/bin/cmd $out/bin/manager
59-
cp ${pkgs.uutils-coreutils-noprefix}/bin/* $out/bin/
60-
'';
22+
in {
23+
nixidyEnvs = nixidy.lib.mkEnvs {
24+
inherit pkgs;
25+
envs = {
26+
env.modules = [./k8s/env.nix];
6127
};
6228
};
29+
30+
packages = {
31+
nixidy = nixidy.packages.${system}.default;
32+
};
6333
devShells.default = pkgs.mkShell {
6434
packages = [
6535
# go

func.nu

100644100755
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
print "Uninstalling vm"
22
helm list -o json | from json | where name =~ "vm" | get name | each {|it| helm uninstall $it}
3+
try {
4+
kubectl delete -f samples/10.yaml -f samples/20.yaml -f samples/pod10.yaml -f samples/2pod10.yaml -f samples/3pod10.yaml -f samples/pod20.yaml -f samples/2pod20.yaml -f samples/3pod20.yaml
5+
}
6+
print "making docker"
7+
make all
38
print "Waiting"
49
loop { let exists = (kubectl get ns -o json | from json | get items.metadata.name | where $it =~ "vlanman-system" | length); if $exists == 0 { print "done"; break } else { print "..."; sleep 0.5sec } }
510
print "Installing"
6-
helm install vm ./helm
11+
helm install vm ./helm --set global.monitoring.enabled=true --set global.monitoring.release=kps
712
813
print "Waiting for controller"
914
loop {let running = (kubectl get pods -n vlanman-system -o json | from json | get items | where $it.metadata.name =~ vm-vlanman | get status.phase | where $it =~ "Running" | length); if $running == 1 { print "Running"; break;} else {print "..."}}
1015
print "Done"
16+
17+
# kubectl apply -f samples/10.yaml -f samples/20.yaml -f samples/pod10.yaml -f samples/2pod10.yaml -f samples/3pod10.yaml -f samples/pod20.yaml -f samples/2pod20.yaml -f samples/3pod20.yaml
18+
kubectl apply -f samples/20.yaml

helm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ appVersion: 1.16.0
33
description: VLAN network manager
44
name: vlanman
55
type: application
6-
version: 0.1.0
6+
version: 0.1.1
77
annotations:
88
artifacthub.io/category: "networking"
99
artifacthub.io/crds: |

0 commit comments

Comments
 (0)