PHP code example of kytoonlabs / laravel-helm

1. Go to this page and download the library: Download kytoonlabs/laravel-helm library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kytoonlabs / laravel-helm example snippets


composer 

use Kytoonlabs\LaravelHelm\Helm;
...
$helm = Helm::version();
$helm->run();
// Prints the command response for the command 'helm version'
$version = $helm->getOutput();
...

use Kytoonlabs\LaravelHelm\Helm;
...
$helm = Helm::install(
    'releasename',
    'oci://registry-1.docker.io/bitnamicharts/redis',
    [
        "--version" => '16.18.2'
    ]
);
$helm->run();
// To check the command was executed successfully
if ($helm->isSuccessful()) {
    // HELM app installed
    ...
}
...

use Kytoonlabs\LaravelHelm\Helm;
...
$helm = Helm::upgrade(
    'releasename',
    'oci://registry-1.docker.io/bitnamicharts/redis',
    [
        "--version" => '16.18.2',
        '--install'
    ]
);
$helm->run();
// To check the command was executed successfully
if ($helm->isSuccessful()) {
    // HELM app upgraded
    ...
}
...

use Kytoonlabs\LaravelHelm\Helm;
...
$helm = Helm::delete('releasename');
$helm->run();
// To check the command was executed successfully
if ($helm->isSuccessful()) {
    // HELM app uninstalled
    ...
}
...

use Kytoonlabs\LaravelHelm\Helm;
...
// Example using simple commands
$helm = Helm::rawCommand('list');
$helm->run();

// Example using commands with parameters
$helm = Helm::rawCommand('list --all');
$helm->run();

// Example combining with $options
$helm = Helm::rawCommand('list --output json', ['--all']);
$helm->run();
...

use Kytoonlabs\LaravelHelm\Helm;
...
// Define options array
$options = [
    '--version' => '1.0.0', //  from values.yaml file
    '-n' => 'default', // -name value parameters
    '-A', // single - parameters
    'dry-run' // fix invalid inputs 
];
$helm = Helm::install(
    'myredis',
    'oci://registry-1.docker.io/bitnamicharts/redis',
    $options
);
$helm->run();
// the command parsed will be:
// helm install myredis oci://registry-1.docker.io/bitnamicharts/redis --version=1.0.0 
//   --create-namespace --set app.host=https://10.0.0.1 -n default -A --dry-run
...

use Kytoonlabs\LaravelHelm\Helm;
...
// List all helm applications pointing to a different cluster
$helm = Helm::rawCommand(
    'list --all',
    [],
    [
        'KUBECONFIG' => '/path/to/another/cluster/kubeconfig'
    ]
);
// Executing helm with the KUBECONFIG env vars enabled
$helm->run();
...