Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 73 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,80 @@
# devoops
CLI tool to facilitate EKS local development written in GOLANG
CLI tool with multiple useful commands to work with Kubernetes(EKS) and AWS.

# Install from git repo

[Download and install GO](https://go.dev/doc/install)
## Install

### Add GO executables to your PATH
### Linux
```bash
# Download the .tar.gz file
curl -LO https://github.com/adpg24/devoops/releases/download/0.0.1/devoops_0.0.1_linux_amd64.tar.gz
# Extract the executable and copy it to a destination of your choice
tar xvf -C /opt/bin devoops_0.0.1_linux_amd64.tar.gz
```

#### Dependency for Linux
This tool depends on this [clipboard package](https://pkg.go.dev/golang.design/x/clipboard)

- macOS: require Cgo, no dependency
- Linux: require X11 dev package. For instance, install libx11-dev or xorg-dev or libX11-devel to access X window system.
- Windows: no Cgo, no dependency
- iOS/Android: collaborate with gomobile

## Usage

#### Kubernetes tools

```bash
# Show the current context as defined in your kube config
devoops current-context
devoops cc

# Switch to another context defined in your kube config
devoops switch-context
devoops sc
```

#### AWS tools

##### login
Authenticate to AWS with MFA and generate short-term credentials.

Create an AWS profile(~/.aws/credentials) with suffix `-mfa`. E.g. my-profile-mfa
```ini
[my-profile-mfa]
aws_access_key_id=XXXXX
aws_secret_access_key=XXXX
aws_mfa_device=arn:aws:iam::123456789012:mfa/user
```
Login with the profile you created, leave out the `-mfa` suffix.\
This command will request short-term credentials and create a new profile `[my-profile]`.
```bash
devoops login -p my-profile
```

##### tag

Add a new tag for an existing image in an ECR repository.\
You must have selected the profile you want to use prior to using this command, e.g. `export AWS_PROFILE=my-profile`

```bash
devoops tag -r my-repository tag newTag
```

##### select-profile

Select a profile from the profiles defined in `~/.aws/credentials`. The export command (linux) will be copied to your clipboard.
```bash
devoops select-profile
devoops sp
```

## Development

Fork the projects

### Add GO executables to your PATH
```bash
# Discover the install path with
go list -f '{{.Target}}'
Expand All @@ -17,24 +85,11 @@ EXPORT PATH=$PATH:/path/to/your/install/dir
### Build tool
Inside project root directory
````bash
go build -o /path/to/your/install/dir/ku
go build -o /path/to/your/install/dir/devoops
````

### Use the tool
```bash
# login with your AWS credentials
ku login -p PROFILE

# get the current context
ku current-context
ku cc

# switch to another context defined in your kube config
ku switch-context
ku sc
```

### Cobra CLI
This project uses [Cobra CLI](https://github.com/spf13/cobra) for the interface.
```bash
cobra-cli -h
```
2 changes: 1 addition & 1 deletion cmd/aws_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (p *AwsProfile) String() string {

// awsProfileCmd represents the awsProfile command
var awsProfileCmd = &cobra.Command{
Use: "awsProfile",
Use: "select-profile",
Short: "Select an AWS profile",
Long: "Select an AWS profile from you local credentials file.",
Aliases: []string{"sp"},
Expand Down