feat(istio): fixes and add simple test

This commit is contained in:
Jaka Hudoklin 2019-02-27 14:18:38 +01:00
parent 33a344119b
commit e1e6173a2c
No known key found for this signature in database
GPG key ID: 6A08896BFD32BD95
6 changed files with 1112 additions and 1040 deletions

View file

@ -4697,7 +4697,7 @@ let
};
};
};
} // (import ./overrides.nix {inherit definitions lib;});
in {
kubernetes.customResources = [
{

View file

@ -317,7 +317,7 @@ let
") value.config)}};
"}};
") definitions)}
};
} // (import ./overrides.nix {inheirt definitions lib;}));
in {
kubernetes.customResources = [
${concatMapStrings (resource: ''{

15
istio/overrides.nix Normal file
View file

@ -0,0 +1,15 @@
{ lib, definitions }:
with lib;
{
"istio_networking_v1alpha3_StringMatch" = recursiveUpdate (recursiveUpdate
definitions."istio_networking_v1alpha3_StringMatch_Exact"
definitions."istio_networking_v1alpha3_StringMatch_Prefix"
)
definitions."istio_networking_v1alpha3_StringMatch_Regex";
"istio_networking_v1alpha3_PortSelector" = recursiveUpdate
definitions."istio_networking_v1alpha3_PortSelector_Name"
definitions."istio_networking_v1alpha3_PortSelector_Number";
}

View file

@ -7,7 +7,7 @@ let
getDefaults = resource: group: version: kind:
catAttrs "default" (filter (default:
(default.resource == null || default.resource == resource) &&
(resource == null || default.resource == null || default.resource == resource) &&
(default.group == null || default.group == group) &&
(default.version == null || default.version == version) &&
(default.kind == null || default.kind == kind)
@ -185,7 +185,8 @@ in {
resource = mkOption {
description = "Custom resource definition resource name";
type = types.str;
type = types.nullOr types.str;
default = null;
};
description = mkOption {

View file

@ -32,6 +32,7 @@ let
./k8s/1.13/crd.nix
./k8s/submodule.nix
./k8s/defaults.nix
./istio/bookinfo.nix
./submodules/simple.nix
./submodules/defaults.nix
];

55
tests/istio/bookinfo.nix Normal file
View file

@ -0,0 +1,55 @@
{ config, test, kubenix, k8s, ... }:
with k8s;
{
imports = [
kubenix.k8s
kubenix.istio
];
test = {
name = "istio-bookinfo";
description = "Simple istio bookinfo application (WIP)";
};
kubernetes.api."networking.istio.io"."v1alpha3" = {
Gateway."bookinfo-gateway" = {
spec = {
selector.istio = "ingressgateway";
servers = [{
port = {
number = 80;
name = "http";
protocol = "HTTP";
};
hosts = ["*"];
}];
};
};
VirtualService.bookinfo = {
spec = {
hosts = ["*"];
gateways = ["bookinfo-gateway"];
http = [{
match = [{
uri.exact = "/productpage";
} {
uri.exact = "/login";
} {
uri.exact = "/logout";
} {
uri.prefix = "/api/v1/products";
}];
route = [{
destination = {
host = "productpage";
port.number = 9080;
};
}];
}];
};
};
};
}