Skip to content

Commit

Permalink
chore 🧹: upgrade k8s to 1.31.0
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Hang <vhvictorhang@gmail.com>
  • Loading branch information
Banh-Canh committed Oct 4, 2024
1 parent 20bd1f6 commit 4d3d280
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 10 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-frieren.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,5 @@ jobs:
- name: Build
run: nix-build '<nixpkgs/nixos>' -A config.system.build.toplevel -I nixos-config=profiles/frieren/configuration.nix
- name: Push
if: github.ref == 'refs/heads/main'
run: |
cachix push didactiklabs ./result
1 change: 0 additions & 1 deletion .github/workflows/build-gojo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,5 @@ jobs:
- name: Build
run: nix-build '<nixpkgs/nixos>' -A config.system.build.toplevel -I nixos-config=profiles/gojo/configuration.nix
- name: Push
if: github.ref == 'refs/heads/main'
run: |
cachix push didactiklabs ./result
14 changes: 12 additions & 2 deletions base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
let
sources = import ./npins;
pkgs = import sources.nixpkgs { };
kubelet-pkgs = import sources.kubelet-pkgs { };
kubeadm-pkgs = import sources.kubeadm-pkgs { };
hostProfile = import ./profiles/${hostname} {
inherit
lib
Expand All @@ -22,7 +24,15 @@ in
./tools.nix
(import "${sources.nixbook}//nixosModules/caCertificates.nix")
./nixosModules/k3s
./nixosModules/kubernetes
(import ./nixosModules/kubernetes {
inherit
pkgs
config
lib
kubelet-pkgs
kubeadm-pkgs
;
})
(import ./nixosModules/networkManager.nix { inherit lib config pkgs; })
(import "${sources.home-manager}/nixos")
hostProfile
Expand Down Expand Up @@ -141,7 +151,7 @@ in
};
environment.systemPackages = [
pkgs.git
pkgs.kubectl
kubelet-pkgs.kubectl
pkgs.cilium-cli
pkgs.coreutils
pkgs.procps
Expand Down
24 changes: 20 additions & 4 deletions nixosModules/kubernetes/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
config,
pkgs,
kubelet-pkgs,
kubeadm-pkgs,
lib,
...
}:
Expand All @@ -18,8 +20,22 @@ in
};
};
imports = [
./kubeadm.nix
./kubelet.nix
(import ./kubeadm.nix {
inherit
pkgs
kubeadm-pkgs
config
lib
;
})
(import ./kubelet.nix {
inherit
pkgs
kubelet-pkgs
config
lib
;
})
];
config = lib.mkIf cfg.kubernetes.enable {
system = {
Expand All @@ -34,7 +50,7 @@ in
# CSI expects "some" binaries to be included in "real" FHS path
copyCSIbins.text = ''
mkdir -p /usr/bin
cp ${pkgs.kubectl}/bin/kubectl /usr/bin/kubectl
cp ${kubelet-pkgs.kubectl}/bin/kubectl /usr/bin/kubectl
cp ${pkgs.util-linux}/bin/blkid /usr/bin/blkid
cp ${pkgs.util-linux}/bin/blockdev /usr/bin/blockdev
cp ${pkgs.coreutils}/bin/cat /usr/bin/cat
Expand Down Expand Up @@ -100,7 +116,7 @@ in
"-/etc/sysconfig/kubelet"
];
ExecStart = [
"${pkgs.kubernetes}/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS"
"${kubelet-pkgs.kubernetes}/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS"
];
};
wantedBy = [ "multi-user.target" ];
Expand Down
3 changes: 2 additions & 1 deletion nixosModules/kubernetes/kubeadm.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
config,
pkgs,
kubeadm-pkgs,
lib,
...
}:
let
cfg = config.customNixOSModules;
kubeadm = pkgs.runCommand "get-kubeadm" { nativeBuildInputs = [ ]; } ''
mkdir -p $out/bin
cp ${pkgs.kubernetes}/bin/kubeadm $out/bin/
cp ${kubeadm-pkgs.kubernetes}/bin/kubeadm $out/bin/
'';
in
{
Expand Down
3 changes: 2 additions & 1 deletion nixosModules/kubernetes/kubelet.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
config,
pkgs,
kubelet-pkgs,
lib,
...
}:
let
cfg = config.customNixOSModules;
kubelet = pkgs.runCommand "get-kubelet" { nativeBuildInputs = [ ]; } ''
mkdir -p $out/bin
cp ${pkgs.kubernetes}/bin/kubelet $out/bin/
cp ${kubelet-pkgs.kubernetes}/bin/kubelet $out/bin/
'';
in
{
Expand Down
12 changes: 12 additions & 0 deletions npins/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
"url": "https://github.com/nix-community/home-manager/archive/2f23fa308a7c067e52dfcc30a0758f47043ec176.tar.gz",
"hash": "00wp0s9b5nm5rsbwpc1wzfrkyxxmqjwsc1kcibjdbfkh69arcpsn"
},
"kubeadm-pkgs": {
"type": "Channel",
"name": "nixos-unstable",
"url": "https://releases.nixos.org/nixos/unstable/nixos-24.11pre687768.27e30d177e57/nixexprs.tar.xz",
"hash": "17m6gfb9bwhdl679f1s2ish4j14q8m8c05c8gvzh7i5hcki51s1l"
},
"kubelet-pkgs": {
"type": "Channel",
"name": "nixos-unstable",
"url": "https://releases.nixos.org/nixos/unstable/nixos-24.11pre687768.27e30d177e57/nixexprs.tar.xz",
"hash": "17m6gfb9bwhdl679f1s2ish4j14q8m8c05c8gvzh7i5hcki51s1l"
},
"nixbook": {
"type": "Git",
"repository": {
Expand Down

0 comments on commit 4d3d280

Please sign in to comment.