From de5114cfc0017e1abce1cde92b542e9a75b48d03 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Tue, 12 Feb 2019 10:42:38 +0100 Subject: [PATCH] refactor: remove old tests --- test/configMap.json | 8 ---- test/cr.json | 11 ----- test/crd.json | 20 -------- test/daemonset.json | 67 -------------------------- test/default.nix | 7 --- test/deployment.json | 38 --------------- test/deployment.nix | 24 ---------- test/modules.nix | 110 ------------------------------------------- test/namespace.json | 10 ---- test/service.json | 26 ---------- 10 files changed, 321 deletions(-) delete mode 100644 test/configMap.json delete mode 100644 test/cr.json delete mode 100644 test/crd.json delete mode 100644 test/daemonset.json delete mode 100644 test/default.nix delete mode 100644 test/deployment.json delete mode 100644 test/deployment.nix delete mode 100644 test/modules.nix delete mode 100644 test/namespace.json delete mode 100644 test/service.json diff --git a/test/configMap.json b/test/configMap.json deleted file mode 100644 index b6390bf..0000000 --- a/test/configMap.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "apiVersion": "v1", - "data": { - "game.properties": "enemies=aliens\nlives=3\nenemies.cheat=true\nenemies.cheat.level=noGoodRotten\nsecret.code.passphrase=UUDDLRLRBABAS\nsecret.code.allowed=true\nsecret.code.lives=30\n", - "ui.properties": "color.good=purple\ncolor.bad=yellow\nallow.textmode=true\nhow.nice.to.look=fairlyNice\n" - }, - "kind": "ConfigMap" -} diff --git a/test/cr.json b/test/cr.json deleted file mode 100644 index 7bcaed2..0000000 --- a/test/cr.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "apiVersion": "stable.example.com/v1", - "kind": "CronTab", - "metadata": { - "name": "my-new-cron-object" - }, - "spec": { - "cronSpec": "* * * * */5", - "image": "my-awesome-cron-image" - } -} diff --git a/test/crd.json b/test/crd.json deleted file mode 100644 index 699fc9b..0000000 --- a/test/crd.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "apiVersion": "apiextensions.k8s.io/v1beta1", - "kind": "CustomResourceDefinition", - "metadata": { - "name": "crontabs.stable.example.com" - }, - "spec": { - "group": "stable.example.com", - "version": "v1", - "scope": "Namespaced", - "names": { - "plural": "crontabs", - "singular": "crontab", - "kind": "CronTab", - "shortNames": [ - "ct" - ] - } - } -} diff --git a/test/daemonset.json b/test/daemonset.json deleted file mode 100644 index e6be0f9..0000000 --- a/test/daemonset.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "kind": "DaemonSet", - "metadata": { - "labels": { - "k8s-app": "fluentd-logging" - }, - "name": "fluentd-elasticsearch", - "namespace": "kube-system" - }, - "spec": { - "selector": { - "matchLabels": { - "name": "fluentd-elasticsearch" - } - }, - "template": { - "metadata": { - "labels": { - "name": "fluentd-elasticsearch" - } - }, - "spec": { - "containers": [ - { - "image": "gcr.io/google-containers/fluentd-elasticsearch:1.20", - "name": "fluentd-elasticsearch", - "resources": { - "limits": { - "memory": "200Mi" - }, - "requests": { - "cpu": "100m", - "memory": "200Mi" - } - }, - "volumeMounts": [ - { - "mountPath": "/var/log", - "name": "varlog" - }, - { - "mountPath": "/var/lib/docker/containers", - "name": "varlibdockercontainers", - "readOnly": true - } - ] - } - ], - "terminationGracePeriodSeconds": 30, - "volumes": [ - { - "hostPath": { - "path": "/var/log" - }, - "name": "varlog" - }, - { - "hostPath": { - "path": "/var/lib/docker/containers" - }, - "name": "varlibdockercontainers" - } - ] - } - } - } -} diff --git a/test/default.nix b/test/default.nix deleted file mode 100644 index aa56478..0000000 --- a/test/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, ... }: - -{ - kubernetes.version = "1.9"; - - require = [./modules.nix ./deployment.nix]; -} diff --git a/test/deployment.json b/test/deployment.json deleted file mode 100644 index 8967f3e..0000000 --- a/test/deployment.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "metadata": { - "name": "nginx-deployment", - "labels": { - "app": "nginx" - } - }, - "spec": { - "selector": { - "matchLabels": { - "app": "nginx" - } - }, - "template": { - "metadata": { - "labels": { - "app": "nginx" - } - }, - "spec": { - "containers": { - "nginx": { - "name": "nginx", - "image": "nginx:1.7.9", - "ports": { - "80": {} - }, - "resources": { - "requests": { - "cpu": "100m" - } - } - } - } - } - } - } -} diff --git a/test/deployment.nix b/test/deployment.nix deleted file mode 100644 index aae4950..0000000 --- a/test/deployment.nix +++ /dev/null @@ -1,24 +0,0 @@ -{lib, k8s, ...}: - -with lib; - -{ - config = { - kubernetes.resources = { - deployments.deployment = mkMerge [ - (k8s.loadJSON ./deployment.json) - { - metadata.name = "abcd"; - nix.dependencies = ["configMaps/configmap"]; - } - ]; - configMaps.configmap = k8s.loadJSON ./configMap.json; - namespaces.namespace = k8s.loadJSON ./namespace.json; - daemonSets.daemonset = k8s.loadJSON ./daemonset.json; - services.service = k8s.loadJSON ./service.json; - customResourceDefinitions.cron = k8s.loadJSON ./crd.json; - }; - - kubernetes.customResources.cron.my-awesome-cron-object = k8s.loadJSON ./cr.json; - }; -} diff --git a/test/modules.nix b/test/modules.nix deleted file mode 100644 index 762f9c5..0000000 --- a/test/modules.nix +++ /dev/null @@ -1,110 +0,0 @@ -{lib, k8s, config, ...}: - -with k8s; -with lib; - -{ - config = { - kubernetes.moduleDefinitions.nginx.module = {name, config, ...}: { - options = { - port = mkOption { - description = "Port for nginx to listen on"; - type = types.int; - default = 80; - }; - - password = mkSecretOption { - description = "Nginx simple auth credentials"; - default = null; - }; - }; - - config = { - kubernetes.resources.deployments.nginx = mkMerge [ - (loadJSON ./deployment.json) - { - metadata.name = "${name}-nginx"; - - spec.template.spec.containers.nginx.ports."80" = { - containerPort = config.port; - }; - - spec.template.spec.containers.nginx.env.name = - mkIf (config.password != null) (secretToEnv config.password); - } - ]; - - kubernetes.resources.configMaps.nginx = mkMerge [ - (loadJSON ./configMap.json) - { - metadata.name = mkForce "${name}-nginx"; - } - ]; - }; - }; - - kubernetes.modules.app-v1 = { - module = "nginx"; - configuration.password.name = "test2"; - configuration.password.key = "password"; - - configuration.kubernetes.resources.customResourceDefinitions.secret-claims = { - kind = "CustomResourceDefinition"; - apiVersion = "apiextensions.k8s.io/v1beta1"; - metadata.name = "secretclaims.vaultproject.io"; - spec = { - group = "vaultproject.io"; - version = "v1"; - scope = "Namespaced"; - names = { - plural = "secretclaims"; - kind = "SecretClaim"; - shortNames = ["scl"]; - }; - }; - }; - - configuration.kubernetes.customResources.secret-claims.claim = { - metadata.name = "test"; - }; - - }; - kubernetes.modules.app-v2 = { - module = "nginx"; - configuration.port = 8080; - - configuration.kubernetes.modules.subsubmodule = { - module = "nginx"; - configuration.kubernetes.resources.customResourceDefinitions.secret-claims = { - kind = "CustomResourceDefinition"; - apiVersion = "apiextensions.k8s.io/v1beta1"; - metadata.name = "secretclaims.vaultproject.io"; - spec = { - group = "vaultproject.io"; - version = "v1"; - scope = "Namespaced"; - names = { - plural = "secretclaims"; - kind = "SecretClaim"; - shortNames = ["scl"]; - }; - }; - }; - - configuration.kubernetes.customResources.secret-claims.claim = { - metadata.name = "test"; - }; - }; - }; - - kubernetes.resources.services.nginx = loadJSON ./service.json; - - kubernetes.defaultModuleConfiguration.all = [{ - config.kubernetes.defaults.deployments.spec.replicas = mkDefault 3; - }]; - - kubernetes.defaultModuleConfiguration.nginx = {config, name, ...}: { - kubernetes.defaults.deployments.spec.replicas = 4; - }; - }; -} diff --git a/test/namespace.json b/test/namespace.json deleted file mode 100644 index fa49507..0000000 --- a/test/namespace.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "kind": "Namespace", - "apiVersion": "v1", - "metadata": { - "name": "openshift-origin", - "labels": { - "name": "openshift-origin" - } - } -} diff --git a/test/service.json b/test/service.json deleted file mode 100644 index 017221c..0000000 --- a/test/service.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "nginx" - }, - "spec": { - "selector": { - "app": "nginx" - }, - "ports": [ - { - "name": "http", - "protocol": "TCP", - "port": 80, - "targetPort": 80 - }, - { - "name": "https", - "protocol": "TCP", - "port": 443, - "targetPort": 443 - } - ] - } -}