func (*tokenGetter) Token() (string, error) {
	options, err := openstack.AuthOptionsFromEnv()
	if err != nil {
		return "", fmt.Errorf("failed to read openstack env vars: %s", err)
	}
	client, err := openstack.AuthenticatedClient(options)
	if err != nil {
		return "", fmt.Errorf("authentication failed: %s", err)
	}
	return client.TokenID, nil
}
Token creates a token by authenticate with keystone.
package openstack
import (
	"fmt"
	"net/http"
	"sync"
	"time"
	"github.com/golang/glog"
	"github.com/gophercloud/gophercloud/openstack"
	"k8s.io/apimachinery/pkg/util/net"
	restclient "k8s.io/client-go/rest"
)
func init() {
	if err := restclient.RegisterAuthProviderPlugin("openstack", newOpenstackAuthProvider); err != nil {
		glog.Fatalf("Failed to register openstack auth plugin: %s", err)
	}
}
const DefaultTTLDuration = 10 * time.Minute
type openstackAuthProvider struct {
	ttl time.Duration
	tokenGetter TokenGetter
}
type TokenGetter interface {
	Token() (string, error)
}
type tokenGetter struct{}