GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    varx/tech (varx@infosec.exchange)'s status on Friday, 23-Jun-2023 01:38:35 JST varx/tech varx/tech

    Today I have experienced the horror that is #Helm.

    Helm chart templates make #Kubernetes manifests by string-templating #YAML.

    YAML has one of the most unfriendly syntaxes of any textual data structure language I've ever seen. There's a whole website just dedicated to the nine different ways you can write a multiline string.

    And Helm just... string-interpolates values into it. The most fragile syntax in the world, and you're just going to inject raw bytes straight into it. The only tool provided to alleviate this is the `quote` function, which... doesn't actually do what you want.

    Currently at work I'm trying to figure out how to insert an arbitrary string value into another string, which is a pretty normal thing to do. And four attempts later, nothing works. The most common "solution" on the web appears to be to use `{{ ... | indent 12 }}` where 12 has to match the template's current indentation level. Good luck if you ever want to reindent anything!

    In conversation Friday, 23-Jun-2023 01:38:35 JST from infosec.exchange permalink
    • Embed this notice
      feld (feld@bikeshed.party)'s status on Friday, 23-Jun-2023 01:38:34 JST feld feld
      in reply to
      > YAML has one of the most unfriendly syntaxes of any textual data structure language I've ever seen.

      JSON is a subset of YAML so you can just use JSON and YAML parsers understand it
      In conversation Friday, 23-Jun-2023 01:38:34 JST permalink
    • Embed this notice
      feld (feld@bikeshed.party)'s status on Friday, 23-Jun-2023 01:41:03 JST feld feld
      in reply to
      now I'm feeling the pain
      In conversation Friday, 23-Jun-2023 01:41:03 JST permalink
    • Embed this notice
      varx/tech (varx@infosec.exchange)'s status on Friday, 23-Jun-2023 01:41:05 JST varx/tech varx/tech
      in reply to
      • feld

      @feld Yeah, but the templating language also doesn't give you a way to interpolate into a JSON string. :-/

      In conversation Friday, 23-Jun-2023 01:41:05 JST permalink
    • Embed this notice
      varx/tech (varx@infosec.exchange)'s status on Tuesday, 27-Jun-2023 00:05:39 JST varx/tech varx/tech
      in reply to

      #YAML is endless fun.

      In conversation Tuesday, 27-Jun-2023 00:05:39 JST permalink

      Attachments


      1. https://media.infosec.exchange/infosecmediaeu/media_attachments/files/110/610/867/349/174/778/original/339ba6a992e688cf.png
    • Embed this notice
      varx/tech (varx@infosec.exchange)'s status on Tuesday, 27-Jun-2023 00:05:40 JST varx/tech varx/tech
      in reply to

      OK, here we go: A way to inject a string value inside a #YAML string in #Helm chart templates!

      You won't like this.

      "... {{ $someValue | quote | substr 1 (int (sub ($someValue | quote | len) 1)) }} ..."

      I promise you that this is one of *less* terrible ways of performing this extremely fundamental operation.

      EDIT: Good news! I've golfed it down to just two function calls:

      "... {{ regexReplaceAll "^\"|\"$" (quote $someValue) "" }} ..."

      This quotes and escapes the value, then uses a regex to remove just the beginning and ending quote, and finally interpolates it into the larger double-quoted flow scalar.

      In conversation Tuesday, 27-Jun-2023 00:05:40 JST permalink
      feld repeated this.

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.