signifly/laravel-kubernetes

This package is abandoned and no longer maintained. No replacement package was suggested.

Integration helpers for running services in Kubernetes

dev-master 2021-09-09 12:32 UTC

This package is auto-updated.

Last update: 2024-04-09 18:11:58 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

TODO

  • Configurable liveness / readiness endpoints
  • Configurable liveness / readiness commands
  • Login / create user via X-Forwarded-User
  • Trust proxies

Installation

You can install the package via composer:

composer require signifly/laravel-kubernetes

You can publish and run the migrations with:

php artisan vendor:publish --provider="Signifly\Kubernetes\KubernetesServiceProvider" --tag="migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --provider="Signifly\Kubernetes\KubernetesServiceProvider" --tag="config"

This is the contents of the published config file:

return [
];

Initiate the integration by running;

php artisan kubernetes:install

This will automatically set up and inject the Http middleware needed for the integration to work.

Usage

You can provide a check callback, that's used when checking if the request is authenticated.

Kubernetes::useCheck(function ($request, $next) {
    return $request->ip() === '127.0.0.1';
});

The default check just calls Auth::check().

You should provide a login callback that logs in the user, given an email, and decices how to further process the request.

For example, redirecting back to the previous url;

Kubernetes::useLogin(function ($email) {
    Auth::login(User::firstOrCreate(['email' => $email]));

    return redirect()->intended();
});

or, just continuing the middleware chain;

Kubernetes::useLogin(function ($email, $request, $next) {
    Auth::login(User::firstOrCreate(['email' => $email]));

    return $next($request);
});

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.