Skip to content

Commit

Permalink
Release v0.0.2 #patch
Browse files Browse the repository at this point in the history
  • Loading branch information
happytreees committed Jun 11, 2024
1 parent c78b5e4 commit 9a211da
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"log"
"net/url"
"os"
"regexp"
"strings"
)

Expand Down Expand Up @@ -74,14 +73,12 @@ func extractRepo(imageName string) string {
}

func extractHostname(imageName string) string {
regexPattern := `^(?:https?://)?(?:[^@/\n]+@)?(?:www\.)?([^:/\n]+)`
regex := regexp.MustCompile(regexPattern)
match := regex.FindStringSubmatch(imageName)
var hostname string
if len(match) > 1 {
hostname = match[1]
u, err := url.Parse(imageName)
if err != nil {
panic(err)
}
return hostname

return u.Host
}

func readCredentialProviderRequestFromStdin() CredentialProviderRequest {
Expand All @@ -105,7 +102,7 @@ func readCredentialProviderRequestFromStdin() CredentialProviderRequest {
}

func (d *Driver) GetVultrCRCredentialResponse(ctx context.Context) {
expireSecond := 60
expireSecond := 43200
writeAccess := false
vcrID := ""

Expand Down Expand Up @@ -163,7 +160,7 @@ func (d *Driver) GetVultrCRCredentialResponse(ctx context.Context) {
APIVersion: "credentialprovider.kubelet.k8s.io/v1",
Kind: "CredentialProviderResponse",
CacheKeyType: "Registry",
CacheDuration: "1m0s",
CacheDuration: "12h",
Auth: map[string]AuthConfig{
registryHostname: {
Username: credArr[0],
Expand Down

0 comments on commit 9a211da

Please sign in to comment.