liyuntao / kong-init

Declarative configuration tool for Kong
Apache License 2.0
38 stars 8 forks source link

Enterprise Edition support #10

Closed arthmoeros closed 5 years ago

arthmoeros commented 5 years ago

Hello!

I have an enterprise-edition installation and I was interested in using this tool to configure a kong instance, however it detects it as a kong version over 0.14.X community edition

INFO  kong_init > Kong version is 0.33-enterprise-edition
 ERROR kong_init > kong version >= 0.15.X, currently not supported.

The Admin API is essentially the same as 0.14.X community (it works with kongfig), I tested with this modification and it apparently works fine (tested the configured APIs and all)

in main.rs

                // version >= 0.15.X, currently not supported.
                error!("kong version >= 0.15.X, currently not supported.");
                //std::process::exit(1); <- skip this
                // post 0.13.X behavior
                context.support_api = true;
                context.support_service_route = true;
coopr commented 5 years ago

Note that Kong Enterprise 0.33 is built on Kong Community Edition 0.13.1 as noted here https://docs.konghq.com/enterprise/changelog/#0-33

liyuntao commented 5 years ago

I'll add a mapping between EE version and CE version, for judging the version by mapped CE version later, as follows:

let mapped_semver_ce_ver = if kong_ver.ends_with("enterprise-edition") {
    // 0.30 EE -> 0.12.1 CE
    // 0.31 EE -> 0.12.3 CE
    // 0.32 EE -> 0.13.1 CE
    // 0.33 EE -> 0.13.1 CE
    // https://docs.konghq.com/enterprise/changelog/#0-33-1
    let ee_ver = &kong_ver[0..4];
    let ce_ver = if "0.30" == ee_ver {
        "0.12.1"
    } else if "0.31" == ee_ver {
        "0.12.3"
    } else if "0.32" == ee_ver {
        "0.13.1"
    } else if "0.33" == ee_ver {
        "0.13.1"
    } else {
        "0.13.1" // FIXME
    }
    info!("detected EE version, regarded as the relevant CE version: {}", &ce_ver);
    ce_ver
} else {
    kong_ver
};

Is there a problem with this? @coopr

liyuntao commented 5 years ago

basic EE version support has been integrated in v0.8.0-rc-2