Skip to content

Commit

Permalink
chore: pleco upgrade to v0.9.19
Browse files Browse the repository at this point in the history
  • Loading branch information
MacLikorne committed Nov 10, 2021
1 parent 0fb80f1 commit 575c176
Show file tree
Hide file tree
Showing 32 changed files with 67 additions and 69 deletions.
4 changes: 2 additions & 2 deletions charts/pleco/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ name: pleco
description: Automatically removes Cloud managed services and Kubernetes resources based on tags with TTL
type: application
home: https://github.com/Qovery/pleco
version: 0.9.18
appVersion: 0.9.18
version: 0.9.19
appVersion: 0.9.19
icon: https://github.com/Qovery/pleco/raw/main/assets/pleco_logo.png
2 changes: 1 addition & 1 deletion charts/pleco/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ replicaCount: 1
image:
repository: qoveryrd/pleco
pullPolicy: IfNotPresent
plecoImageTag: "0.9.18"
plecoImageTag: "0.9.19"

cloudProvider: ""

Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ func init() {
}

func GetCurrentVersion() string {
return "0.9.18" // ci-version-check
return "0.9.19" // ci-version-check
}
2 changes: 1 addition & 1 deletion pkg/aws/db_documentdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func deleteDocumentDBCluster(svc rds.RDS, cluster documentDBCluster, dryRun bool
return nil
}

func DeleteExpiredDocumentDBClusters(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredDocumentDBClusters(sessions AWSSessions, options AwsOptions) {
region := *sessions.RDS.Config.Region
expiredClusters := listExpiredDocumentDBClusters(*sessions.RDS, options.TagName)

Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/db_elasticache.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func getExpireddClusters(ECsession *elasticache.ElastiCache, tagName string) ([]
return expiredClusters, region
}

func DeleteExpiredElasticacheDatabases(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredElasticacheDatabases(sessions AWSSessions, options AwsOptions) {
expiredClusters, region := getExpireddClusters(sessions.ElastiCache, options.TagName)

count, start := common.ElemToDeleteFormattedInfos("expired Elasticache database", len(expiredClusters), region)
Expand Down
6 changes: 3 additions & 3 deletions pkg/aws/db_rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func GetRDSInstanceInfos(svc rds.RDS, databaseIdentifier string) (rdsDatabase, e
}, nil
}

func DeleteExpiredRDSDatabases(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredRDSDatabases(sessions AWSSessions, options AwsOptions) {
expiredDatabases := listExpiredRDSDatabases(*sessions.RDS, options.TagName)
region := *sessions.RDS.Config.Region

Expand Down Expand Up @@ -222,7 +222,7 @@ func getExpiredRDSSubnetGroups(svc rds.RDS, tagName string) []RDSSubnetGroup {
return expiredRDSSubnetGroups
}

func DeleteExpiredRDSSubnetGroups(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredRDSSubnetGroups(sessions AWSSessions, options AwsOptions) {
region := *sessions.RDS.Config.Region
expiredRDSSubnetGroups := getExpiredRDSSubnetGroups(*sessions.RDS, options.TagName)

Expand Down Expand Up @@ -302,7 +302,7 @@ func listExpiredCompleteRDSParameterGroups(svc rds.RDS, tagName string) []RDSPar
return expiredCompleteRDSParameterGroups
}

func DeleteExpiredCompleteRDSParameterGroups(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredCompleteRDSParameterGroups(sessions AWSSessions, options AwsOptions) {
expiredRDSParameterGroups := listExpiredCompleteRDSParameterGroups(*sessions.RDS, options.TagName)
region := *sessions.RDS.Config.Region

Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/ec2_ebs.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func listExpiredVolumes(eksSession eks.EKS, ec2Session ec2.EC2, tagName string)
return expiredVolumes, nil
}

func DeleteExpiredVolumes(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredVolumes(sessions AWSSessions, options AwsOptions) {
expiredVolumes, err := listExpiredVolumes(*sessions.EKS, *sessions.EC2, options.TagName)
region := *sessions.EC2.Config.Region
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/ec2_elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func deleteLoadBalancers(lbSession elbv2.ELBV2, loadBalancersList []ElasticLoadB
}
}

func DeleteExpiredLoadBalancers(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredLoadBalancers(sessions AWSSessions, options AwsOptions) {
expiredLoadBalancers, err := ListExpiredLoadBalancers(*sessions.EKS, *sessions.ELB, options.TagName)
region := *sessions.ELB.Config.Region
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/ec2_ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func deleteKeyPair(ec2session *ec2.EC2, keyId string) error {
return err
}

func DeleteExpiredKeyPairs(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredKeyPairs(sessions AWSSessions, options AwsOptions) {
keys := getSshKeys(sessions.EC2, options.TagName)
region := sessions.EC2.Config.Region
var expiredKeys []KeyPair
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/eks_ecr.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func getRepositoryImages(ecrSession *ecr.ECR, repositoryName string) []*ecr.Imag
return result.ImageDetails
}

func DeleteEmptyRepositories(sessions *AWSSessions, options *AwsOptions) {
func DeleteEmptyRepositories(sessions AWSSessions, options AwsOptions) {
repositories := getRepositories(sessions.ECR)
region := sessions.ECR.Config.Region
var emptyRepositoryNames []string
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/eks_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func deleteNodeGroupStatus(svc eks.EKS, cluster eksCluster, nodeGroupName string
return nil
}

func DeleteExpiredEKSClusters(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredEKSClusters(sessions AWSSessions, options AwsOptions) {
clusters, err := ListTaggedEKSClusters(*sessions.EKS, options.TagName)
region := *sessions.EKS.Config.Region
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/kms_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func handleKMSError(error error) {
}
}

func DeleteExpiredKeys(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredKeys(sessions AWSSessions, options AwsOptions) {
keys := getKeys(*sessions.KMS)
region := sessions.KMS.Config.Region
var expiredKeys []CompleteKey
Expand Down
4 changes: 2 additions & 2 deletions pkg/aws/logs_cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func handleCloudwatchLogsError(err error) {
}
}

func DeleteExpiredLogs(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredLogs(sessions AWSSessions, options AwsOptions) {
logs := getCloudwatchLogs(*sessions.CloudWatchLogs)
region := *sessions.CloudWatchLogs.Config.Region
var expiredLogs []CompleteLogGroup
Expand Down Expand Up @@ -150,7 +150,7 @@ func TagLogsForDeletion(svc cloudwatchlogs.CloudWatchLogs, tagName string, clust
return nil
}

func DeleteUnlinkedLogs(sessions *AWSSessions, options *AwsOptions) {
func DeleteUnlinkedLogs(sessions AWSSessions, options AwsOptions) {
region := *sessions.EKS.Config.Region
clusters, err := ListClusters(*sessions.EKS)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions pkg/aws/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ type AWSSessions struct {
ECR *ecr.ECR
}

type funcDeleteExpired func(sessions *AWSSessions, options *AwsOptions)
type funcDeleteExpired func(sessions AWSSessions, options AwsOptions)

func RunPlecoAWS(cmd *cobra.Command, regions []string, interval int64, wg *sync.WaitGroup, options *AwsOptions) {
func RunPlecoAWS(cmd *cobra.Command, regions []string, interval int64, wg *sync.WaitGroup, options AwsOptions) {
for _, region := range regions {
wg.Add(1)
go runPlecoInRegion(region, interval, wg, options)
Expand All @@ -63,10 +63,10 @@ func RunPlecoAWS(cmd *cobra.Command, regions []string, interval int64, wg *sync.
go runPlecoInGlobal(cmd, interval, wg, currentSession, options)
}

func runPlecoInRegion(region string, interval int64, wg *sync.WaitGroup, options *AwsOptions) {
func runPlecoInRegion(region string, interval int64, wg *sync.WaitGroup, options AwsOptions) {
defer wg.Done()

sessions := &AWSSessions{}
sessions := AWSSessions{}
currentSession := CreateSession(region)

logrus.Infof("Starting to check expired resources in region %s.", *currentSession.Config.Region)
Expand Down Expand Up @@ -165,7 +165,7 @@ func runPlecoInRegion(region string, interval int64, wg *sync.WaitGroup, options

}

func runPlecoInGlobal(cmd *cobra.Command, interval int64, wg *sync.WaitGroup, currentSession *session.Session, options *AwsOptions) {
func runPlecoInGlobal(cmd *cobra.Command, interval int64, wg *sync.WaitGroup, currentSession *session.Session, options AwsOptions) {
defer wg.Done()

logrus.Info("Starting to check global expired resources.")
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/s3_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func deleteS3Buckets(s3session s3.S3, bucket string) error {
return nil
}

func DeleteExpiredBuckets(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredBuckets(sessions AWSSessions, options AwsOptions) {
buckets, err := listTaggedBuckets(*sessions.S3, options.TagName)
region := sessions.S3.Config.Region
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/vpc_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func getExpiredEIPs(ec2Session *ec2.EC2, tagName string) []ElasticIp {
return expiredEips
}

func DeleteExpiredElasticIps(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredElasticIps(sessions AWSSessions, options AwsOptions) {
expiredEips := getExpiredEIPs(sessions.EC2, options.TagName)

count, start := common.ElemToDeleteFormattedInfos("expired EIP", len(expiredEips), *sessions.EC2.Config.Region)
Expand Down
4 changes: 2 additions & 2 deletions pkg/aws/vpc_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func listTaggedVPC(ec2Session ec2.EC2, tagName string) ([]VpcInfo, error) {
return taggedVPCs, nil
}

func deleteVPC(sessions *AWSSessions, VpcList []VpcInfo, dryRun bool) error {
func deleteVPC(sessions AWSSessions, VpcList []VpcInfo, dryRun bool) error {
if dryRun {
return nil
}
Expand Down Expand Up @@ -151,7 +151,7 @@ func deleteVPC(sessions *AWSSessions, VpcList []VpcInfo, dryRun bool) error {
return nil
}

func DeleteExpiredVPC(sessions *AWSSessions, options *AwsOptions) {
func DeleteExpiredVPC(sessions AWSSessions, options AwsOptions) {
VPCs, err := listTaggedVPC(*sessions.EC2, options.TagName)
region := sessions.EC2.Config.Region
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func run(cloudProvider string, dryRun bool, interval int64, cmd *cobra.Command,

func startAWS(cmd *cobra.Command, interval int64, dryRun bool, wg *sync.WaitGroup) {
regions, _ := cmd.Flags().GetStringSlice("aws-regions")
awsOptions := &aws.AwsOptions{
awsOptions := aws.AwsOptions{
DryRun: dryRun,
TagName: getCmdString(cmd, "tag-name"),
EnableRDS: getCmdBool(cmd, "enable-rds"),
Expand All @@ -70,7 +70,7 @@ func startAWS(cmd *cobra.Command, interval int64, dryRun bool, wg *sync.WaitGrou

func startScaleway(cmd *cobra.Command, interval int64, dryRun bool, wg *sync.WaitGroup) {
zones, _ := cmd.Flags().GetStringSlice("scw-zones")
scalewayOptions := &scaleway.ScalewayOptions{
scalewayOptions := scaleway.ScalewayOptions{
TagName: getCmdString(cmd, "tag-name"),
DryRun: dryRun,
EnableCluster: getCmdBool(cmd, "enable-cluster"),
Expand All @@ -87,7 +87,7 @@ func startScaleway(cmd *cobra.Command, interval int64, dryRun bool, wg *sync.Wai

func startDO(cmd *cobra.Command, interval int64, dryRun bool, wg *sync.WaitGroup) {
regions, _ := cmd.Flags().GetStringSlice("do-regions")
DOOptions := &do.DOOptions{
DOOptions := do.DOOptions{
TagName: getCmdString(cmd, "tag-name"),
DryRun: dryRun,
EnableCluster: getCmdBool(cmd, "enable-cluster"),
Expand Down
2 changes: 1 addition & 1 deletion pkg/do/bucket_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type DOBucket struct {
ObjectsInfos []minio.ObjectInfo
}

func DeleteExpiredBuckets(sessions *DOSessions, options *DOOptions) {
func DeleteExpiredBuckets(sessions DOSessions, options DOOptions) {
expiredBuckets := getExpiredBuckets(sessions.Bucket, options.TagName, options.Region)

count, start := common.ElemToDeleteFormattedInfos("expired bucket", len(expiredBuckets), options.Region)
Expand Down
2 changes: 1 addition & 1 deletion pkg/do/cluster_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type DOCluster struct {
IsProtected bool
}

func DeleteExpiredClusters(sessions *DOSessions, options *DOOptions) {
func DeleteExpiredClusters(sessions DOSessions, options DOOptions) {
expiredClusters, region := getExpiredClusters(sessions.Client, options.TagName, options.Region)

count, start := common.ElemToDeleteFormattedInfos("expired cluster", len(expiredClusters), region)
Expand Down
2 changes: 1 addition & 1 deletion pkg/do/db_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type DODB struct {
IsProtected bool
}

func DeleteExpiredDatabases(sessions *DOSessions, options *DOOptions) {
func DeleteExpiredDatabases(sessions DOSessions, options DOOptions) {
expiredDatabases := getExpiredDatabases(sessions.Client, options.TagName, options.Region)

count, start := common.ElemToDeleteFormattedInfos("expired database", len(expiredDatabases), options.Region)
Expand Down
2 changes: 1 addition & 1 deletion pkg/do/lb_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type DOLB struct {
IsProtected bool
}

func DeleteExpiredLBs(sessions *DOSessions, options *DOOptions) {
func DeleteExpiredLBs(sessions DOSessions, options DOOptions) {
expiredLBs, region := getExpiredLBs(sessions.Client, options.TagName, options.Region)

count, start := common.ElemToDeleteFormattedInfos("expired load balancer", len(expiredLBs), region)
Expand Down
8 changes: 4 additions & 4 deletions pkg/do/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ type DOSessions struct {
Bucket *minio.Client
}

type funcDeleteExpired func(sessions *DOSessions, options *DOOptions)
type funcDeleteExpired func(sessions DOSessions, options DOOptions)

func RunPlecoDO(regions []string, interval int64, wg *sync.WaitGroup, options *DOOptions) {
func RunPlecoDO(regions []string, interval int64, wg *sync.WaitGroup, options DOOptions) {
for _, region := range regions {
wg.Add(1)
go runPlecoInRegion(region, interval, wg, options)
}
}

func runPlecoInRegion(region string, interval int64, wg *sync.WaitGroup, options *DOOptions) {
func runPlecoInRegion(region string, interval int64, wg *sync.WaitGroup, options DOOptions) {
defer wg.Done()
sessions := &DOSessions{}
sessions := DOSessions{}
sessions.Client = CreateSession()
options.Region = region

Expand Down
2 changes: 1 addition & 1 deletion pkg/do/volumes_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type DOVolume struct {
CreationDate time.Time
}

func DeleteExpiredVolumes(sessions *DOSessions, options *DOOptions) {
func DeleteExpiredVolumes(sessions DOSessions, options DOOptions) {
expiredVolumes := getDetachedVolumes(sessions.Client, options.Region)

count, start := common.ElemToDeleteFormattedInfos(fmt.Sprintf("detached (%d hours delay) volume", volumeTimeout()), len(expiredVolumes), options.Region)
Expand Down
2 changes: 1 addition & 1 deletion pkg/scaleway/bucket_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type ScalewatBucket struct {
ObjectsInfos []minio.ObjectInfo
}

func DeleteExpiredBuckets(sessions *ScalewaySessions, options *ScalewayOptions) {
func DeleteExpiredBuckets(sessions ScalewaySessions, options ScalewayOptions) {
expiredBuckets := getExpiredBuckets(sessions.Bucket, options.TagName, options.Region)

count, start := common.ElemToDeleteFormattedInfos("expired bucket", len(expiredBuckets), string(options.Region))
Expand Down
8 changes: 4 additions & 4 deletions pkg/scaleway/cluster_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type ScalewayCluster struct {
IsProtected bool
}

func DeleteExpiredClusters(sessions *ScalewaySessions, options *ScalewayOptions) {
expiredClusters, region := getExpiredClusters(sessions.Cluster, options.TagName)
func DeleteExpiredClusters(sessions ScalewaySessions, options ScalewayOptions) {
expiredClusters, _ := getExpiredClusters(sessions.Cluster, options.TagName)

count, start := common.ElemToDeleteFormattedInfos("expired cluster", len(expiredClusters), region)
count, start := common.ElemToDeleteFormattedInfos("expired cluster", len(expiredClusters), options.Zone, true)

log.Debug(count)

Expand Down Expand Up @@ -77,7 +77,7 @@ func getExpiredClusters(clusterAPI *k8s.API, tagName string) ([]ScalewayCluster,
func deleteCluster(clusterAPI *k8s.API, cluster ScalewayCluster) {
_, err := clusterAPI.DeleteCluster(
&k8s.DeleteClusterRequest{
ClusterID: cluster.ID,
ClusterID: cluster.ID,
WithAdditionalResources: true,
})

Expand Down
6 changes: 3 additions & 3 deletions pkg/scaleway/cr_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"time"
)

func DeleteEmptyContainerRegistries(sessions *ScalewaySessions, options *ScalewayOptions) {
emptyRegistries, region := getEmptyRegistries(sessions.Namespace)
func DeleteEmptyContainerRegistries(sessions ScalewaySessions, options ScalewayOptions) {
emptyRegistries, _ := getEmptyRegistries(sessions.Namespace)

count, start := common.ElemToDeleteFormattedInfos("empty Scaleway namespace", len(emptyRegistries), region)
count, start := common.ElemToDeleteFormattedInfos("empty Scaleway namespace", len(emptyRegistries), options.Zone, true)

log.Debug(count)

Expand Down
6 changes: 3 additions & 3 deletions pkg/scaleway/db_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type ScalewayDB struct {
IsProtected bool
}

func DeleteExpiredDatabases(sessions *ScalewaySessions, options *ScalewayOptions) {
expiredDatabases, region := getExpiredDatabases(sessions.Database, options.TagName)
func DeleteExpiredDatabases(sessions ScalewaySessions, options ScalewayOptions) {
expiredDatabases, _ := getExpiredDatabases(sessions.Database, options.TagName)

count, start := common.ElemToDeleteFormattedInfos("expired database", len(expiredDatabases), region)
count, start := common.ElemToDeleteFormattedInfos("expired database", len(expiredDatabases), options.Zone, true)

log.Debug(count)

Expand Down
Loading

0 comments on commit 575c176

Please sign in to comment.