Skip to content

[feature-request] provide patch and apply [sub-]commands #308

Description

@TLINDEN

In cloudctl, just like with kubectl, you can work either with commands and params or directly edit manifests. However, that's the only way to manipulate manifests.

A patch and apply command (or subcommand to other commands) would be very nice to have.

Consider this hack to be able to scale up/down a posgres instance:

pgscale() {
    local value=$1
    local uid=$2

    if test -z "$uid"; then
        echo "Usage: pgscale <value> <postgres-id>"
        return
    fi
    
    pgpatch .numberofinstances $value $uid
}

pgpatch() {
    local attribute=$1
    local value=$2
    local uid=$3

    if test -z "$uid"; then
        echo "Usage: pgpatch <yaml-attr> <value> <postgres-id>"
        return
    fi

    script="/tmp/pgpatch-$$"
    echo "#!/bin/sh
file=\$1
yq e -i '$attribute |= $value' \$file
" > $script

    chmod 700 $script
    
    EDITOR="$script" c postgres edit $uid

    rm -f $script
}

How much better would it be to just call cloudctl postgres patch..., wouldn't it?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions