func (c *AWSIAMRoleController) getCreds(role string, sessionDuration time.Duration) (*Credentials, map[string][]byte, error) {
	creds, err := c.creds.Get(role, sessionDuration)
	if err != nil {
		return nil, nil, err
	}
	credsFile := fmt.Sprintf(
		credentialsFileTemplate,
		creds.AccessKeyID,
		creds.SecretAccessKey,
		creds.SessionToken,
		creds.Expiration.Format(time.RFC3339),
	)
	processCreds := ProcessCredentials{
		Version:         1,
		AccessKeyID:     creds.AccessKeyID,
		SecretAccessKey: creds.SecretAccessKey,
		SessionToken:    creds.SessionToken,
		Expiration:      creds.Expiration,
	}
	processCredsData, err := json.Marshal(&processCreds)
	if err != nil {
		return nil, nil, err
	}
	return creds, map[string][]byte{
		roleARNKey:                []byte(creds.RoleARN),
		expireKey:                 []byte(creds.Expiration.Format(time.RFC3339)),
		credentialsFileKey:        []byte(credsFile),
		credentialsProcessFileKey: []byte(credentialsProcessFileContent),
		credentialsJSONFileKey:    processCredsData,
	}, nil
}
getCreds gets new credentials from the CredentialsGetter and converts them
to a secret data map.
package main
import (
	"context"
	"encoding/json"
	"fmt"
	"strconv"
	"time"
	log "github.com/sirupsen/logrus"
	av1 "github.com/zalando-incubator/kube-aws-iam-controller/pkg/apis/zalando.org/v1"
	"github.com/zalando-incubator/kube-aws-iam-controller/pkg/clientset"
	"github.com/zalando-incubator/kube-aws-iam-controller/pkg/recorder"
	v1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/client-go/tools/record"
)
const (
	awsIAMRoleGenerationKey = "awsiamrole-generation"
)
var (
	awsIAMRoleOwnerLabels = map[string]string{
		heritageLabelKey: awsIAMControllerLabelValue,
		"type":           "awsiamrole",
	}
)
type AWSIAMRoleController struct {
	client       clientset.Interface
	recorder     record.EventRecorder
	interval     time.Duration
	refreshLimit time.Duration
	creds        CredentialsGetter
	namespace    string
}
func NewAWSIAMRoleController(client clientset.Interface, interval, refreshLimit time.Duration, creds CredentialsGetter, namespace string) *AWSIAMRoleController {
	return &AWSIAMRoleController{
		client:       client,
		recorder:     recorder.CreateEventRecorder(client),
		interval:     interval,
		refreshLimit: refreshLimit,
		creds:        creds,
		namespace:    namespace,
	}
}