Skip to content

Commit

Permalink
Replace cloudCredential references
Browse files Browse the repository at this point in the history
  • Loading branch information
rmweir committed Jul 14, 2020
1 parent 496bdca commit 0a3755c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions controller/eks-cluster-config-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ func (h *Handler) OnEksConfigRemoved(key string, config *v13.EKSClusterConfig) (
sess, eksService, err := h.startAWSSessions(config)
if err != nil {
if errors.IsNotFound(err) {
// if cloudCredential cannot be used then skip cleanup
logrus.Infof("cloudCredential [%s] not found for EKS Config [%s], AWS cleanup skipped", config.Spec.CloudCredential, config.Name)
// if AmazonCredentialSecret cannot be used then skip cleanup
logrus.Infof("AmazonCredentialSecret [%s] not found for EKS Config [%s], AWS cleanup skipped", config.Spec.AmazonCredentialSecret, config.Name)
return config, nil
}
return config, err
Expand Down Expand Up @@ -475,8 +475,8 @@ func (h *Handler) startAWSSessions(config *v13.EKSClusterConfig) (*session.Sessi
awsConfig.Region = aws.String(region)
}

id, ns := utils.Parse(config.Spec.CloudCredential)
if cloudCredential := config.Spec.CloudCredential; cloudCredential != "" {
id, ns := utils.Parse(config.Spec.AmazonCredentialSecret)
if amazonCredentialSecret := config.Spec.AmazonCredentialSecret; amazonCredentialSecret != "" {
secret, err := h.secretsCache.Get(ns, id)
if err != nil {
return nil, nil, err
Expand Down Expand Up @@ -876,7 +876,7 @@ func (h *Handler) importCluster(config *v13.EKSClusterConfig, eksService *eks.EK
}

upstreamSpec.DisplayName = config.Spec.DisplayName
upstreamSpec.CloudCredential = config.Spec.CloudCredential
upstreamSpec.AmazonCredentialSecret = config.Spec.AmazonCredentialSecret
upstreamSpec.Region = config.Spec.Region

config = config.DeepCopy()
Expand Down
2 changes: 1 addition & 1 deletion examples/create-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
kubernetesVersion: "1.15"
publicAccess: true
privateAccess: true
cloudCredential: "cc-zzzz"
amazonCredentialSecr: "cc-zzzz"
displayName: "my-cluster"
region: "us-east-2"
loggingTypes: ["audit"]
2 changes: 1 addition & 1 deletion examples/eks-cluster-config-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
type: boolean
privateAccess:
type: boolean
cloudCredential:
amazonCredentialSecr:
type: string
virtualNetwork:
type: string
Expand Down
2 changes: 1 addition & 1 deletion examples/import-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ metadata:
name: my-import-cluster
spec:
displayName: my-import-cluster
cloudCredential: "cc-zzzz"
amazonCredentialSecret: "cc-zzzz"
imported: true
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"flag"
"github.com/rancher/eks-controller/controller"
core2 "github.com/rancher/eks-controller/pkg/generated/controllers/core"
"github.com/rancher/eks-controller/pkg/generated/controllers/eks.cattle.io"
eksv1 "github.com/rancher/eks-controller/pkg/generated/controllers/eks.cattle.io"

"github.com/rancher/wrangler-api/pkg/generated/controllers/apps"
"github.com/rancher/wrangler/pkg/kubeconfig"
Expand Down Expand Up @@ -47,7 +47,7 @@ func main() {
}

// Generated sample controller
eks, err := ke.NewFactoryFromConfig(cfg)
eks, err := eksv1.NewFactoryFromConfig(cfg)
if err != nil {
logrus.Fatalf("Error building eks factory: %s", err.Error())
}
Expand All @@ -57,7 +57,7 @@ func main() {
// don't pass in something like kubeClient, apps, or sample
controller.Register(ctx,
core.Core().V1().Secret(),
eks.Ke().V1().EKSClusterConfig())
eks.Eks().V1().EKSClusterConfig())

// Start all the controllers
if err := start.All(ctx, 3, apps, eks, core); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/codegen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ func main() {
setOpenAPIEnum(obj.Spec.Validation.OpenAPIV3Schema.Properties, []interface{}{true}, "spec", "imported")
setOpenAPIAnyOf(obj.Spec.Validation.OpenAPIV3Schema.Properties, []v1beta1.JSONSchemaProps{
{
Required: []string{"imported", "cloudCredential", "displayName"},
Required: []string{"imported", "amazonCredentialSecr", "displayName"},
},
{
Required: []string{"publicAccess", "privateAccess", "cloudCredential", "displayName"},
Required: []string{"publicAccess", "privateAccess", "amazonCredentialSecr", "displayName"},
},
}, "spec")*/

Expand Down

0 comments on commit 0a3755c

Please sign in to comment.