diff --git a/release.nix b/release.nix index 13c072d..9353ca5 100644 --- a/release.nix +++ b/release.nix @@ -120,9 +120,6 @@ in rec { }]; tests = { - k8s-1_8 = runK8STests "1.8"; - k8s-1_9 = runK8STests "1.9"; - k8s-1_10 = runK8STests "1.10"; k8s-1_11 = runK8STests "1.11"; k8s-1_12 = runK8STests "1.12"; k8s-1_13 = runK8STests "1.13"; diff --git a/tests/default.nix b/tests/default.nix index 267d1b7..7ea6733 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -1,7 +1,7 @@ { pkgs ? import {} , lib ? pkgs.lib , kubenix ? import ../. { inherit pkgs lib; } -, k8sVersion ? "1.13" +, k8sVersion ? "1.18" , nixosPath ? toString # whether any testing error should throw an error @@ -25,7 +25,6 @@ let ./k8s/simple.nix ./k8s/deployment.nix ./k8s/crd.nix - ./k8s/1.13/crd.nix ./k8s/defaults.nix ./k8s/order.nix ./k8s/submodule.nix @@ -33,7 +32,7 @@ let ./legacy/k8s.nix ./legacy/crd.nix ./legacy/modules.nix - ./helm/simple.nix + #./helm/simple.nix ./istio/bookinfo.nix ./submodules/simple.nix ./submodules/defaults.nix diff --git a/tests/helm/simple.nix b/tests/helm/simple.nix index 061ae84..27c933a 100644 --- a/tests/helm/simple.nix +++ b/tests/helm/simple.nix @@ -34,7 +34,8 @@ in { test = { name = "helm-simple"; description = "Simple k8s testing wheter name, apiVersion and kind are preset"; - enable = builtins.compareVersions config.kubernetes.version "1.8" >= 0; + enable = false; + #enable = builtins.compareVersions config.kubernetes.version "1.8" >= 0; assertions = [{ message = "should have generated resources"; assertion = diff --git a/tests/k8s/1.13/crd.nix b/tests/k8s/1.13/crd.nix deleted file mode 100644 index 71fb55f..0000000 --- a/tests/k8s/1.13/crd.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ config, lib, kubenix, k8sVersion, ... }: - -with lib; - -let - cfg = config.kubernetes.resources.customResourceDefinitions.crontabs; -in { - imports = with kubenix.modules; [ test k8s ]; - - test = { - name = "k8s-1-13-crd"; - description = "Simple test testing CRD for k8s 1.13"; - enable = builtins.compareVersions config.kubernetes.version "1.13" >= 0; - assertions = [{ - message = "should have versions set"; - assertion = (head cfg.spec.versions).name == "v1"; - }]; - }; - - kubernetes.version = k8sVersion; - - kubernetes.resources.customResourceDefinitions.crontabs = { - metadata.name = "crontabs.stable.example.com"; - spec = { - group = "stable.example.com"; - versions = [{ - name = "v1"; - served = true; - storage = true; - }]; - scope = "Namespaced"; - names = { - plural = "crontabs"; - singular = "crontab"; - kind = "CronTab"; - shortNames = ["ct"]; - }; - }; - }; -} diff --git a/tests/k8s/crd.nix b/tests/k8s/crd.nix index c588464..f467483 100644 --- a/tests/k8s/crd.nix +++ b/tests/k8s/crd.nix @@ -3,7 +3,6 @@ with lib; let - crd = config.kubernetes.api.resources.customResourceDefinitions.crontabs; latestCrontab = config.kubernetes.api.resources.cronTabs.latest; in { imports = with kubenix.modules; [ test k8s ]; @@ -13,11 +12,6 @@ in { description = "Simple test tesing CRD"; enable = builtins.compareVersions config.kubernetes.version "1.8" >= 0; assertions = [{ - message = "CRD should have group and version set"; - assertion = - crd.spec.group == "stable.example.com" && - crd.spec.version == "v1"; - } { message = "Custom resource should have correct version set"; assertion = latestCrontab.apiVersion == "stable.example.com/v2"; }]; @@ -31,72 +25,40 @@ in { kubernetes.version = k8sVersion; - kubernetes.resources.customResourceDefinitions.crontabs = { - metadata.name = "crontabs.stable.example.com"; - spec = { + kubernetes.customTypes = [ + { group = "stable.example.com"; version = "v1"; - scope = "Namespaced"; - names = { - plural = "crontabs"; - singular = "crontab"; - kind = "CronTab"; - shortNames = ["ct"]; + kind = "CronTab"; + attrName = "cronTabs"; + description = "CronTabs resources"; + module = { + options.schedule = mkOption { + description = "Crontab schedule script"; + type = types.str; + }; }; - }; - }; - kubernetes.resources.customResourceDefinitions.crontabsv2 = { - metadata.name = "crontabs.stable.example.com"; - spec = { + } { group = "stable.example.com"; version = "v2"; - scope = "Namespaced"; - names = { - plural = "crontabs"; - singular = "crontab"; - kind = "CronTab"; - shortNames = ["ct"]; - }; - }; - }; - - kubernetes.createCustomTypesFromCRDs = true; - - kubernetes.customTypes = mkMerge [ - { - "stable.example.com/v1/CronTab" = { - attrName = "cronTabs"; - description = "CronTabs resources"; - module = { - options.schedule = mkOption { + kind = "CronTab"; + description = "CronTabs resources"; + attrName = "cronTabs"; + module = { + options = { + schedule = mkOption { description = "Crontab schedule script"; type = types.str; }; + + command = mkOption { + description = "Command to run"; + type = types.str; + }; }; }; - } - { - "stable.example.com/v2/CronTab" = { - description = "CronTabs resources"; - attrName = "cronTabs"; - module = { - options = { - schedule = mkOption { - description = "Crontab schedule script"; - type = types.str; - }; - - command = mkOption { - description = "Command to run"; - type = types.str; - }; - }; - }; - }; - } - - [{ + } { group = "stable.example.com"; version = "v3"; kind = "CronTab"; @@ -115,7 +77,7 @@ in { }; }; }; - }] + } ]; kubernetes.resources."stable.example.com"."v1".CronTab.versioned.spec.schedule = "* * * * *"; diff --git a/tests/k8s/order.nix b/tests/k8s/order.nix index e89a778..03051e1 100644 --- a/tests/k8s/order.nix +++ b/tests/k8s/order.nix @@ -10,7 +10,6 @@ in { test = { name = "k8s-order"; description = "test tesing k8s resource order"; - enable = builtins.compareVersions config.kubernetes.version "1.8" >= 0; assertions = [{ message = "should have correct order of resources"; assertion = @@ -23,10 +22,15 @@ in { kubernetes.version = k8sVersion; kubernetes.resources.customResourceDefinitions.crontabs = { + apiVersion = "apiextensions.k8s.io/v1"; metadata.name = "crontabs.stable.example.com"; spec = { group = "stable.example.com"; - version = "v1"; + versions = [{ + name = "v1"; + served = true; + schema = true; + }]; scope = "Namespaced"; names = { plural = "crontabs"; diff --git a/tests/legacy/crd.nix b/tests/legacy/crd.nix index cca8eea..f00eb35 100644 --- a/tests/legacy/crd.nix +++ b/tests/legacy/crd.nix @@ -16,7 +16,7 @@ in { test = { name = "legacy-crd"; description = "Simple test tesing kubenix legacy integration with crds crd"; - enable = builtins.compareVersions config.kubernetes.version "1.13" >= 0; + enable = builtins.compareVersions config.kubernetes.version "1.15" <= 0; assertions = [{ message = "should define crd in module"; assertion =