Skip to content

Latest commit

 

History

History
147 lines (109 loc) · 4.67 KB

readme.adoc

File metadata and controls

147 lines (109 loc) · 4.67 KB

Purpose

The tool will push local files into kubernetes containers to support local development in a kubernetes environment.

The tool will use 'kubectl cp' and 'kubectl exec' to push and validate files in the container. No installation of components in the cluster are needed. Only a basic commandset 'bash', 'ls', 'mkdir', 'rm' is recommended in the container.

Program Arguments

Usage:
 kpush [options] [cmd] [job filter]*

Argument/Option

Description

--help

Show usage

-c

Set the configuration directory or file, defaut ~/.kpush/config

-i

Global interval in milliseconds to wait between status output in watch mode, default 5000 (5sec)

-l <level>

Set the log level: trace, debug, info (default), warn, error, fatal

-t <period>

A period of time backward for the command touch, e.g. 2h, 1d, 2w, 30min

test

Test which files would be pushed, you can use also option t to modify the last update time.

push

Command push once

pushall

Command push all data

watch

Command push every second in a loop, press Ctrl-C to exit

touch

Command touch the update time to now, use option -t

reset

Command set the update time to 1970

info

Command to show current target configuration and the last update time

job filter

List of jobs to execute. All other jobs will be ignored. By default all jobs will be executed.

Configuration

For each job push a yaml file in the configuration folder.

Main Section

Parameter

Type

Description

name

Text

Name of the configuration, for log file (default is the file name without extension)

description

Text

Description of the configuration

namespace

Text

Kubernetes namespace

pod

*Text

Kubernetes name of the pod

container

Text

Kubernetes container inside of the pod

enabled

Boolean

Disable the job (default true)

Watch Section

Parameter

Type

Description

name

Text

Name of the configuration, for log file

source

*Text

Local path to the source directory

target

*Text

Remote path to the target directory

filter

List

List of filters to filter the local files and directories

algorithm

Text

Implementation to use to watch and transport files, default 'simple'

interval

Number

Interval in milliseconds to wait between file scans in watch mode, default global interval

enabled

Boolean

Disable the watch section (default true)

Filters

Parameter

Description

contains

Accept if path contains the value

notcontains

Deny if the path contains the value

regex

Accept if the path matches the value as regex

notregex

Deny if the path matches the value as regex

namecontains

Accept if the name contains the value

notnamecontains

Deny if the name contains the value

dircontains

Accept directory if the name contains the value

notdircontains

Deny directory if the name contains the value

Simple algorithm

Note
algorithm: simple

A algorithm using kubectl to transport files. It’s using kubectl cp and kubectl exec with ls, mkdir. The sync will store the last sync time beside the configuration file as *.kpush file. If no file is found the current time is used.

If init is enabled, initial it will transport only non existing files.

Parameter

Type

Description

ignoreInit

bool

Ignore initial process, default true

rememberLastUpdated

bool

default false

The additional parameter in Main Section named kubectl can be used to change the path to the kubectl binary.

Example

name: mhus to karaf
description: push all changes in local repository mhus into the karaf container

namespace: mhus
pod: server
container: karaf

properties:
- versions.properties

watch:
- name: Repo mhus
  source: ~/.m2/repository/de/mhus
  target: /home/user/.m2/repository/de/mhus
  filter:
  - contains ""

Examples

Create the file project1.yaml in ~/.kush/config:

pod: project-0
container: karaf

watch:
- name: MVN Repo
  source: ~/.m2/repository/de/mhus
  target: /home/user/.m2/repository/de/mhus
  filter:
  - contains "7."

This will push all files with version 7.* to the pod project-0.

  1. kpush push project1 will not push files because it’s the first start and the update timestamp will be now.

  2. compile some maven projects in /home/user/.m2/repository/de/mhus

  3. kpush push project1 will now push the compiled files

  4. kpush push project1 will not push any new files

  5. kpush -t 6h touch project1 set the update timestamp to 6 hours in the past

  6. kpush push project1 will now push the compiled files of the last 6 hours

kpush watch will continuous push files.