Skip to content

Commit

Permalink
fix: patch kubenix
Browse files Browse the repository at this point in the history
Relax requirement of required protocol in Container.ports because some
upstream sources, like Prometheus charts, don't actually specify it.

hall/kubenix#52
  • Loading branch information
schradert committed Jul 1, 2024
1 parent 6f2be65 commit 232b896
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
17 changes: 14 additions & 3 deletions modules/kubenix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@ with nix; {
pkgs,
system,
...
}: {
}: let
# TODO is there an even simpler way to do this?
kubenix-patched = pkgs.stdenv.mkDerivation rec {
inherit (src) name;
src = inputs.kubenix;
patches = [./kubenix.patch];
buildPhase = ''
mkdir -p $out
cp -r $src/* $out
'';
};
in {
config.canivete.devShell.apps.kubectl.script = "nix run \".#canivete.${system}.kubenix.clusters.$1.script\" -- \"\${@:2}\"";
config.canivete.opentofu.workspaces = mapAttrs (_: getAttr "opentofu") config.canivete.kubenix.clusters;
options.canivete.kubenix.clusters = mkOption {
Expand Down Expand Up @@ -39,7 +50,7 @@ with nix; {
type = package;
description = "Kubernetes configuration file for cluster";
default =
(inputs.kubenix.evalModules.${system} {
(kubenix-patched.evalModules.${system} {
specialArgs = {inherit nix;};
module = {
kubenix,
Expand Down Expand Up @@ -77,7 +88,7 @@ with nix; {

# Generate resource definitions with IFD x 2
definitions = let
generated = import "${inputs.kubenix}/pkgs/generators/k8s" {
generated = import "${kubenix-patched}/pkgs/generators/k8s" {
name = "kubenix-generated-for-crds";
inherit pkgs lib;
# Mirror K8s OpenAPI spec
Expand Down
5 changes: 5 additions & 0 deletions modules/kubenix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--- a/modules/generated/v1.30.nix
+++ a/modules/generated/v1.30.nix
@@ -6305,1 +6305,1 @@
- type = (types.nullOr (coerceAttrsOfSubmodulesToListByKey "io.k8s.api.core.v1.ContainerPort" "name" [ "containerPort" "protocol" ]));
+ type = (types.nullOr (coerceAttrsOfSubmodulesToListByKey "io.k8s.api.core.v1.ContainerPort" "name" [ "containerPort" ]));

0 comments on commit 232b896

Please sign in to comment.