• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

binbashar / leverage / 12975712471

26 Jan 2025 02:50PM UTC coverage: 60.559% (+0.5%) from 60.101%
12975712471

Pull #281

github

Franr
Merge branch '599-kubeconfig-helper' of github.com:binbashar/leverage into 599-kubeconfig-helper
Pull Request #281: [BV-599] Kubeconfig helper

198 of 464 branches covered (42.67%)

Branch coverage included in aggregate %.

55 of 74 new or added lines in 4 files covered. (74.32%)

44 existing lines in 4 files now uncovered.

2532 of 4044 relevant lines covered (62.61%)

0.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.0
/leverage/modules/kubectl.py
1
from leverage._internals import pass_state
1✔
2
from leverage._internals import pass_container
1✔
3
from leverage.container import get_docker_client
1✔
4
from leverage.containers.kubectl import KubeCtlContainer
1✔
5

6
import click
1✔
7

8
from leverage.modules.utils import _handle_subcommand
1✔
9

10
CONTEXT_SETTINGS = {"ignore_unknown_options": True}
1✔
11

12

13
@click.group(invoke_without_command=True, context_settings={"ignore_unknown_options": True})
1✔
14
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
1✔
15
@pass_state
1✔
16
@click.pass_context
1✔
17
def kubectl(context, state, args):
1✔
18
    """Run Kubectl commands in a custom containerized environment."""
19
    state.container = KubeCtlContainer(get_docker_client())
×
NEW
20
    if not args or (args and args[0] != 'discover'):
×
NEW
21
        state.container.paths.check_for_layer_location()
×
22
    state.container.ensure_image()
×
23
    _handle_subcommand(context=context, cli_container=state.container, args=args)
×
24

25

26
@kubectl.command(context_settings=CONTEXT_SETTINGS)
1✔
27
@pass_container
1✔
28
def shell(kctl: KubeCtlContainer):
1✔
29
    """Spawn a shell with the kubectl credentials pre-configured."""
30
    kctl.start_shell()
×
31

32

33
@kubectl.command(context_settings=CONTEXT_SETTINGS)
1✔
34
@pass_container
1✔
35
def configure(kctl: KubeCtlContainer):
1✔
36
    """Automatically add the EKS cluster from the layer into your kubectl config file."""
37
    kctl.configure()
×
38

39

40
@kubectl.command(context_settings=CONTEXT_SETTINGS)
1✔
41
@pass_container
1✔
42
def discover(kctl: KubeCtlContainer):
1✔
NEW
43
    kctl.discover()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc