Skip to content

Commit

Permalink
Merge branch 'master' into lint-in-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
draychev authored May 11, 2022
2 parents 021acfd + f53f9e3 commit 2a2c607
Show file tree
Hide file tree
Showing 22 changed files with 96 additions and 64 deletions.
5 changes: 3 additions & 2 deletions api/v1alpha1/iamrole_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ package v1alpha1
import (
"context"
"fmt"
"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/pkg/log"
"strings"

"github.com/keikoproj/iam-manager/pkg/k8s"
Expand All @@ -31,6 +29,9 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/pkg/log"
)

const (
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 12 additions & 11 deletions controllers/iamrole_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,28 @@ import (
"encoding/json"
"errors"
"fmt"
"math"
"strings"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/internal/utils"
"github.com/keikoproj/iam-manager/pkg/awsapi"
"github.com/keikoproj/iam-manager/pkg/k8s"
"github.com/keikoproj/iam-manager/pkg/log"
"github.com/keikoproj/iam-manager/pkg/validation"
"github.com/pborman/uuid"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
apierrs "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/record"
"math"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"strings"
"time"

iammanagerv1alpha1 "github.com/keikoproj/iam-manager/api/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/internal/utils"
"github.com/keikoproj/iam-manager/pkg/awsapi"
"github.com/keikoproj/iam-manager/pkg/k8s"
"github.com/keikoproj/iam-manager/pkg/log"
"github.com/keikoproj/iam-manager/pkg/validation"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions controllers/iamrole_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package controllers_test

import (
iammanagerv1alpha1 "github.com/keikoproj/iam-manager/api/v1alpha1"
. "github.com/keikoproj/iam-manager/controllers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/event"

iammanagerv1alpha1 "github.com/keikoproj/iam-manager/api/v1alpha1"
. "github.com/keikoproj/iam-manager/controllers"
)

var _ = Describe("IamroleController", func() {
Expand Down
12 changes: 7 additions & 5 deletions internal/config/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ package config
import (
"context"
"fmt"
"github.com/keikoproj/iam-manager/pkg/awsapi"
"github.com/keikoproj/iam-manager/pkg/k8s"
"github.com/keikoproj/iam-manager/pkg/log"
"k8s.io/api/core/v1"
"k8s.io/client-go/tools/cache"
"os"
"strconv"
"strings"

"k8s.io/api/core/v1"
"k8s.io/client-go/tools/cache"

"github.com/keikoproj/iam-manager/pkg/awsapi"
"github.com/keikoproj/iam-manager/pkg/k8s"
"github.com/keikoproj/iam-manager/pkg/log"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions internal/config/properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package config

import (
"context"
"strings"
"testing"

"github.com/golang/mock/gomock"
"gopkg.in/check.v1"
"k8s.io/api/core/v1"
"strings"
"testing"
)

type PropertiesSuite struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/utils/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"crypto/x509"
"errors"
"fmt"
"net/url"

"github.com/keikoproj/iam-manager/api/v1alpha1"
"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/pkg/log"

"net/url"
)

//GetIdpServerCertThumbprint gets the Thumbbprint of the certificate which will be used to generate OIDC tokens
Expand Down
8 changes: 5 additions & 3 deletions internal/utils/oidc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package utils_test

import (
"context"
"testing"

"github.com/golang/mock/gomock"
"gopkg.in/check.v1"
"k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/keikoproj/iam-manager/api/v1alpha1"
"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/internal/utils"
"gopkg.in/check.v1"
"k8s.io/apimachinery/pkg/apis/meta/v1"
"testing"
)

type OIDCTestSuite struct {
Expand Down
8 changes: 5 additions & 3 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import (
"encoding/json"
"errors"
"fmt"
"strings"
"text/template"

"k8s.io/api/core/v1"

iammanagerv1alpha1 "github.com/keikoproj/iam-manager/api/v1alpha1"
"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/pkg/log"
"k8s.io/api/core/v1"
"strings"
"text/template"
)

//GetTrustPolicy constructs trust policy
Expand Down
10 changes: 6 additions & 4 deletions internal/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ package utils_test
import (
"context"
"encoding/json"
"testing"

"github.com/golang/mock/gomock"
"github.com/keikoproj/iam-manager/api/v1alpha1"
"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/internal/utils"
"gopkg.in/check.v1"
v12 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1"
"testing"

"github.com/keikoproj/iam-manager/api/v1alpha1"
"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/internal/utils"
)

type UtilsTestSuite struct {
Expand Down
15 changes: 8 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,25 @@ package main
import (
"context"
"flag"
"os"

// +kubebuilder:scaffold:imports
"k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
ctrl "sigs.k8s.io/controller-runtime"

iammanagerv1alpha1 "github.com/keikoproj/iam-manager/api/v1alpha1"
"github.com/keikoproj/iam-manager/controllers"
"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/internal/utils"
"github.com/keikoproj/iam-manager/pkg/awsapi"
"github.com/keikoproj/iam-manager/pkg/k8s"
"github.com/keikoproj/iam-manager/pkg/log"
"k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"os"
ctrl "sigs.k8s.io/controller-runtime"
// +kubebuilder:scaffold:imports
)

var (
scheme = runtime.NewScheme()
//setupLog = ctrl.Log.WithName("setup")
)

func init() {
Expand Down
2 changes: 2 additions & 0 deletions pkg/awsapi/eks.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ package awsapi

import (
"context"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/eks"
"github.com/aws/aws-sdk-go/service/eks/eksiface"

"github.com/keikoproj/iam-manager/pkg/log"
)

Expand Down
6 changes: 4 additions & 2 deletions pkg/awsapi/eks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ package awsapi_test
import (
"context"
"errors"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/eks"
"github.com/golang/mock/gomock"
"gopkg.in/check.v1"

"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/pkg/awsapi"
"github.com/keikoproj/iam-manager/pkg/awsapi/mocks"
"gopkg.in/check.v1"
"testing"
)

type EKSAPISuite struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/awsapi/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/iam/iamiface"

"github.com/keikoproj/iam-manager/pkg/log"
)

Expand Down
6 changes: 4 additions & 2 deletions pkg/awsapi/iam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ package awsapi_test
import (
"context"
"errors"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/golang/mock/gomock"
"gopkg.in/check.v1"

"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/pkg/awsapi"
"github.com/keikoproj/iam-manager/pkg/awsapi/mocks"
"gopkg.in/check.v1"
"testing"
)

type IAMAPISuite struct {
Expand Down
2 changes: 2 additions & 0 deletions pkg/awsapi/sts.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ package awsapi

import (
"context"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/aws/aws-sdk-go/service/sts/stsiface"

"github.com/keikoproj/iam-manager/pkg/log"
)

Expand Down
6 changes: 4 additions & 2 deletions pkg/awsapi/sts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ package awsapi_test
import (
"context"
"errors"
"testing"

"github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/golang/mock/gomock"
"gopkg.in/check.v1"

"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/pkg/awsapi"
mock_awsapi "github.com/keikoproj/iam-manager/pkg/awsapi/mocks"
"gopkg.in/check.v1"
"testing"
)

type STSAPISuite struct {
Expand Down
11 changes: 6 additions & 5 deletions pkg/k8s/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ package k8s
import (
"context"
"fmt"
"github.com/keikoproj/iam-manager/pkg/log"
"k8s.io/api/core/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/clientcmd"
"os"
"sigs.k8s.io/controller-runtime/pkg/client"
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -21,6 +16,12 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/record"
"k8s.io/klog"

"github.com/keikoproj/iam-manager/pkg/log"
"k8s.io/api/core/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/clientcmd"
"sigs.k8s.io/controller-runtime/pkg/client"
)

type Client struct {
Expand Down
5 changes: 3 additions & 2 deletions pkg/k8s/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"context"
"errors"
"fmt"
"github.com/keikoproj/iam-manager/pkg/log"
"k8s.io/apimachinery/pkg/apis/meta/v1"

corev1 "k8s.io/api/core/v1"
apierr "k8s.io/apimachinery/pkg/api/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/keikoproj/iam-manager/pkg/log"
)

//CreateServiceAccount adds the service account
Expand Down
1 change: 1 addition & 0 deletions pkg/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package log

import (
"context"

"github.com/go-logr/logr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
Expand Down
14 changes: 8 additions & 6 deletions pkg/validation/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ import (
"context"
"encoding/json"
"fmt"
"net/url"
"reflect"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/validation/field"

"github.com/keikoproj/iam-manager/api/v1alpha1"
"github.com/keikoproj/iam-manager/internal/config"
"github.com/keikoproj/iam-manager/internal/utils"
"github.com/keikoproj/iam-manager/pkg/awsapi"
"github.com/keikoproj/iam-manager/pkg/log"
"github.com/pkg/errors"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/validation/field"
"net/url"
"reflect"
"strings"
)

//ValidateIAMPolicyAction validates policy action
Expand Down
Loading

0 comments on commit 2a2c607

Please sign in to comment.