Code Monkey home page Code Monkey logo

Comments (5)

hbagdi avatar hbagdi commented on August 23, 2024 1

Update: I'm making some slow progress towards this issue. #87 will fix (3) in the above list.

I've still to look into a fix for (2). I'm going to tackle it after v0.6.0 is out.

from deck.

hbagdi avatar hbagdi commented on August 23, 2024 1

This is no longer a problem with Kong 1.4.0.
Kong works fine with empty/null values present in the config file.

from deck.

hbagdi avatar hbagdi commented on August 23, 2024

Adding the header by default when writing, ignore during reading

This is already done and will be available in v0.5.0

Empty/null values should actually be omitted from the dump

Could you give an example of when this was problematic? decK already omits writing anything that has is null.

SNI must be in the format name: sni-value instead of just the sni value as it is currently, because Kong "expecst a record".

Kong should have been able to handle this out of the box.
I'll talk to the Kong team to see if we can include this in Kong itself or add it to decK.

Thank you for the feedback!

from deck.

cristichiru avatar cristichiru commented on August 23, 2024

Thanks for the quick reply.

  1. 👍

  2. It actually does not omit them :) A snippet from the deck dump:

    plugins:
    - name: cors
        config:
        credentials: false
        exposed_headers: null
        headers: null
        max_age: null

    using deck sync works without any issues, however, loading this yaml in a dbless deployment (tried with Kong 1.2), Kong will complain that expects a numeric value, or whatever data type the null field is supposed to be.

  3. Kong fails to handle this, and in my opinion, since Kong is the more complex piece of software, it makes more sense that deck accommodate to Kong requirements sooner, rather than having Kong team fix this :)


Currently I have an ugly but working shell script, that depends on yq utility:

FILE=output.yaml

## Get the snis of the first element in the certificates array, prefix it with 'name: ' and prepare it as a yq merge script
## $1 - filename
## $2 - certificates array index
yq_snis() {
    OUT=`yq r $1 "certificates[$2].snis" | grep -vP '^null$'`
    [[ -z "$OUT" ]] && return
    echo "$OUT" | sed -E 's,^- ,- name: ,' | sed "1i certificates[$2].snis:"
}

deck --kong-addr $KONG_ADMIN_URL dump -o $FILE
[[ $? -ne 0 ]] && \
    echo "[WARNING] Deck dump failed for $KONG_ADMIN_URL, proceeding to process existing $FILE"

echo '_format_version: "1.1"' > $FILE.dbless
sed -E 's,(.*-)?\s*[^:]+:\s*null,\1 ,g' $FILE | yq r - >> $FILE.dbless
IDX=0
OUT=`yq_snis $FILE.dbless $IDX`
while [[ -n "$OUT" ]]; do
    ## Update the yaml in place
    echo "$OUT" | yq w -i -s - $FILE.dbless
    IDX=`expr $IDX + 1`
    OUT=`yq_snis $FILE.dbless $IDX`
done

from deck.

hbagdi avatar hbagdi commented on August 23, 2024

Thank you for sharing the configuration.
Let me try to experiment what can be done here.

Meanwhile, Kong 1.3 is shipping this week and it contains kong config db_export command to export all your entities, which can then be consumed by a DB-less Kong node.

from deck.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.