Skip to content

Commit

Permalink
Merge pull request #824 from tailwarden/develop
Browse files Browse the repository at this point in the history
v3.0.17 release 🚀
  • Loading branch information
mlabouardy authored May 26, 2023
2 parents 6145d7e + d6a5698 commit 811cf10
Show file tree
Hide file tree
Showing 30 changed files with 1,671 additions and 252 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ bin
.env
dist/

*.go-e
*.go-e
.idea
vendor
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ brew install komiser
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [What is Komiser?](#what-is-komiser)
- [What is Komiser?](#what-is-komiser-)
- [Who is using it?](#who-is-using-it)
- [Getting started](#getting-started)
- [Getting started](#getting-started-)
- [Download](#download)
- [Installation on AWS](#installation-on-aws)
- [Connect Komiser CLI to your AWS account.](#connect-komiser-cli-to-your-aws-account)
Expand All @@ -54,12 +54,12 @@ brew install komiser
- [Installation on Linode](#installation-on-linode)
- [Installation on Tencent](#installation-on-tencent-cloud)
- [Installation on Scaleway](#installation-on-scaleway)
- [Documentation](#documentation)
- [Documentation](#documentation-)
- [Jump right in:](#jump-right-in)
- [Bugs and feature requests](#bugs-and-feature-requests)
- [Roadmap and Contributing](#roadmap-and-contributing)
- [Users](#users)
- [Versioning](#versioning)
- [Bugs and feature requests](#bugs-and-feature-requests-)
- [Roadmap and Contributing](#roadmap-and-contributing-%EF%B8%8F)
- [Users](#users-)
- [Versioning](#versioning-)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function useResourcesManagerChart({
datasets: [
{
data: sortByDescendingCosts?.map(item =>
Number(formatNumber(item.total))
item.total
) as number[],
backgroundColor: colors,
borderColor: '#FFFFFF',
Expand Down
2 changes: 1 addition & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "komiser-dashboard",
"version": "3.0.16",
"version": "3.0.17",
"private": true,
"scripts": {
"dev": "next dev -p 3002",
Expand Down
192 changes: 96 additions & 96 deletions internal/api/v1/template.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"Effect": "Allow",
"Action": [
"sns:List*",
"s3:Get*",
"lambda:List*",
"kms:List*",
"pricing:GetProducts",
Expand Down
5 changes: 2 additions & 3 deletions providers/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ func listOfSupportedServices() []providers.FetchDataFunction {
eks.KubernetesClusters,
cloudfront.Distributions,
dynamodb.Tables,
ecs.Tasks,
ecs.Services,
ecs.Clusters,
ecr.Repositories,
sns.Topics,
Expand All @@ -64,6 +62,7 @@ func listOfSupportedServices() []providers.FetchDataFunction {
rds.Clusters,
rds.Instances,
rds.Snapshots,
rds.ProxyEndpoints,
elb.LoadBalancers,
efs.ElasticFileStorage,
apigateway.Apis,
Expand All @@ -83,7 +82,7 @@ func listOfSupportedServices() []providers.FetchDataFunction {
systemsmanager.MaintenanceWindows,
ec2.VpcEndpoints,
ec2.VpcPeeringConnections,
kinesis.Shards,
kinesis.Streams,
}
}

Expand Down
1 change: 1 addition & 0 deletions providers/aws/ec2/keypair.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func KeyPairs(ctx context.Context, client providers.ProviderClient) ([]models.Re

resources = append(resources, models.Resource{
Provider: "AWS",
Account: client.Name,
Service: "EC2 KeyPair",
ResourceId: aws.ToString(keypair.KeyPairId),
Region: client.AWSClient.Region,
Expand Down
66 changes: 0 additions & 66 deletions providers/aws/ecs/services.go

This file was deleted.

66 changes: 0 additions & 66 deletions providers/aws/ecs/tasks.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,29 @@ import (
. "github.com/tailwarden/komiser/providers"
)

func Shards(ctx context.Context, client ProviderClient) ([]Resource, error) {
func Streams(ctx context.Context, client ProviderClient) ([]Resource, error) {
resources := make([]Resource, 0)
var config kinesis.ListShardsInput
var config kinesis.ListStreamsInput
kinesisClient := kinesis.NewFromConfig(*client.AWSClient)

for {
output, err := kinesisClient.ListShards(ctx, &config)
output, err := kinesisClient.ListStreams(ctx, &config)
if err != nil {
return resources, err
}

for _, shard := range output.Shards {
for _, stream := range output.StreamSummaries {
resources = append(resources, Resource{
Provider: "AWS",
Account: client.Name,
Service: "Kinesis Shard",
ResourceId: *shard.ShardId,
Service: "Kinesis Stream",
ResourceId: *stream.StreamARN,
Region: client.AWSClient.Region,
Name: *shard.ShardId,
Name: *stream.StreamName,
Cost: 0,
CreatedAt: *stream.StreamCreationTimestamp,
FetchedAt: time.Now(),
Link: fmt.Sprintf("https://%s.console.aws.amazon.com/kinesis/home?region=%s#/streams/details/%s", client.AWSClient.Region, client.AWSClient.Region, *shard.ShardId),
Link: fmt.Sprintf("https://%s.console.aws.amazon.com/kinesis/home?region=%s#/streams/details/%s", client.AWSClient.Region, client.AWSClient.Region, *stream.StreamName),
})
}

Expand All @@ -49,7 +50,7 @@ func Shards(ctx context.Context, client ProviderClient) ([]Resource, error) {
"provider": "AWS",
"account": client.Name,
"region": client.AWSClient.Region,
"service": "Kinesis Shard",
"service": "Kinesis Stream",
"resources": len(resources),
}).Info("Fetched resources")

Expand Down
90 changes: 90 additions & 0 deletions providers/aws/rds/db_proxy_endpoints.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package rds

import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/rds"
log "github.com/sirupsen/logrus"
"github.com/tailwarden/komiser/models"
"github.com/tailwarden/komiser/providers"
"time"
)

func ProxyEndpoints(ctx context.Context, client providers.ProviderClient) ([]models.Resource, error) {
config := rds.DescribeDBProxyEndpointsInput{
MaxRecords: aws.Int32(100),
}
resources := make([]models.Resource, 0)
rdsClient := rds.NewFromConfig(*client.AWSClient)

for {
output, err := rdsClient.DescribeDBProxyEndpoints(ctx, &config)
if err != nil {
return resources, fmt.Errorf("error describing DB proxy endpoints: %w", err)
}

for _, endpoint := range output.DBProxyEndpoints {

if endpoint.DBProxyEndpointName == nil {
log.Warn("DBProxyEndpointName is nil")
continue
}

if endpoint.DBProxyEndpointArn == nil {
log.Warn("DBProxyEndpointArn is nil")
continue
}

_endpointName := *endpoint.DBProxyEndpointName

// Fetch tags
tagConfig := rds.ListTagsForResourceInput{
ResourceName: endpoint.DBProxyEndpointArn,
}

tagOutput, err := rdsClient.ListTagsForResource(ctx, &tagConfig)
if err != nil {
return resources, fmt.Errorf("error listing tags for resource %s: %w", *endpoint.DBProxyEndpointArn, err)
}

tags := make([]models.Tag, 0)
for _, tag := range tagOutput.TagList {
if tag.Key != nil && tag.Value != nil {
tags = append(tags, models.Tag{
Key: *tag.Key,
Value: *tag.Value,
})
}
}

resources = append(resources, models.Resource{
Provider: "AWS",
Account: client.Name,
Service: "RDS DB Proxy Endpoint",
Region: client.AWSClient.Region,
ResourceId: *endpoint.DBProxyEndpointArn,
Name: _endpointName,
FetchedAt: time.Now(),
Tags: tags,
Link: fmt.Sprintf("https://%s.console.aws.amazon.com/rds/home?region=%s#db-proxy-details:id=%s", client.AWSClient.Region, client.AWSClient.Region, *endpoint.DBProxyEndpointName),
})
}

if output.Marker == nil || *output.Marker == "" {
break
}

config.Marker = output.Marker
}

log.WithFields(log.Fields{
"provider": "AWS",
"account": client.Name,
"region": client.AWSClient.Region,
"service": "RDS DB Proxy Endpoint",
"resources": len(resources),
}).Info("Fetched resources")

return resources, nil
}
2 changes: 1 addition & 1 deletion providers/gcp/compute/disks.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"google.golang.org/api/option"

compute "cloud.google.com/go/compute/apiv1"
computepb "cloud.google.com/go/compute/apiv1/computepb"
"cloud.google.com/go/compute/apiv1/computepb"
)

func Disks(ctx context.Context, client providers.ProviderClient) ([]models.Resource, error) {
Expand Down
Loading

0 comments on commit 811cf10

Please sign in to comment.