Skip to content

Commit

Permalink
Merge pull request #4785 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…4761-to-release-1.26

[release-1.26] Enable Windows for credential provider pipeline
  • Loading branch information
k8s-ci-robot authored Oct 13, 2023
2 parents afe5edb + 31af4a8 commit 6e8f4e7
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmd/acr-credential-provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func main() {

acrProvider, err := credentialprovider.NewAcrProvider(args[0])
if err != nil {
klog.Errorf("Failed to initialize ACR provider: %w", err)
klog.Errorf("Failed to initialize ACR provider: %v", err)
os.Exit(1)
}

Expand Down
13 changes: 13 additions & 0 deletions examples/out-of-tree/credential-provider-config-win.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
kind: CredentialProviderConfig
apiVersion: kubelet.config.k8s.io/v1
providers:
- name: acr-credential-provider
apiVersion: credentialprovider.kubelet.k8s.io/v1
defaultCacheDuration: 10m
matchImages:
- "*.azurecr.io"
- "*.azurecr.cn"
- "*.azurecr.de"
- "*.azurecr.us"
args:
- c:\k\azure.json
1 change: 0 additions & 1 deletion tests/e2e/auth/cred.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ var _ = Describe("Azure Credential Provider", Label(utils.TestSuiteLabelCredenti

testPull("mcr.microsoft.com/mirror/docker/library/nginx", "1.25", "linux")
if tc.HasWindowsNodes {
Skip("Skipping Windows test before further verification")
testPull("mcr.microsoft.com/windows/nanoserver", "ltsc2019", "windows")
}
})
Expand Down
16 changes: 10 additions & 6 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ const (
defaultReportDir = "_report/"
clusterProvisioningToolKey = "CLUSTER_PROVISIONING_TOOL"
clusterProvisioningToolCAPZ = "capz"
//nolint:gosec // G101 ignore this!
testOOTCredentialProvider = "TEST_ACR_CREDENTIAL_PROVIDER"
)

func TestAzureTest(t *testing.T) {
Expand All @@ -63,15 +65,17 @@ func TestAzureTest(t *testing.T) {
suiteConfig, reporterConfig := GinkgoConfiguration()
suiteConfig.Timeout = 0

labelFilters := []string{suiteConfig.LabelFilter}
if strings.EqualFold(os.Getenv(clusterProvisioningToolKey), clusterProvisioningToolCAPZ) {
additionalFilter := "!SLBOutbound"
if suiteConfig.LabelFilter == "" {
suiteConfig.LabelFilter = additionalFilter
} else {
suiteConfig.LabelFilter = suiteConfig.LabelFilter + " && " + additionalFilter
}
labelFilters = append(labelFilters, "!SLBOutbound")
}

if !strings.EqualFold(os.Getenv(testOOTCredentialProvider), utils.TrueValue) {
labelFilters = append(labelFilters, "!OOT-Credential")
}

suiteConfig.LabelFilter = strings.Join(labelFilters, " && ")

reporterConfig.Verbose = true
reporterConfig.JUnitReport = path.Join(reportDir, fmt.Sprintf("junit_%02d.xml", GinkgoParallelProcess()))
passed := RunSpecs(t, "Cloud provider Azure e2e suite", suiteConfig, reporterConfig)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/utils/container_registry_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func AZACRLogin(acrName string) (err error) {
if output, err = cmd.Output(); err != nil {
return fmt.Errorf("az failed to account show with output: %s\n error: %w", string(output), err)
}
Logf("az account show success %q.", output)
Logf("az account show success.")

Logf("Attempting az acr login with azure cred.")
cmd = exec.Command("az", "acr", "login",
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/utils/pod_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func WaitPodTo(phase v1.PodPhase, cs clientset.Interface, podTemplate *v1.Pod, n
return false, err
}
if pod.Status.Phase != phase {
Logf("waiting for the pod status to be %s, current status: %s", phase, pod.Status.Phase)
Logf("waiting for the pod status to be %s, on Node %q, current status: %s", phase, pod.Spec.NodeName, pod.Status.Phase)
return false, nil
}
return true, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@ spec:
image-credential-provider-bin-dir: /var/lib/kubelet/credential-provider
image-credential-provider-config: /var/lib/kubelet/credential-provider-config.yaml
cloud-provider: external
v: "4"
name: '{{ ds.meta_data["local_hostname"] }}'
joinConfiguration:
nodeRegistration:
kubeletExtraArgs:
image-credential-provider-bin-dir: /var/lib/kubelet/credential-provider
image-credential-provider-config: /var/lib/kubelet/credential-provider-config.yaml
cloud-provider: external
v: "4"
name: '{{ ds.meta_data["local_hostname"] }}'
mounts:
- - LABEL=etcd_disk
Expand Down Expand Up @@ -377,6 +379,7 @@ spec:
image-credential-provider-bin-dir: /var/lib/kubelet/credential-provider
image-credential-provider-config: /var/lib/kubelet/credential-provider-config.yaml
cloud-provider: external
v: "4"
name: '{{ ds.meta_data["local_hostname"] }}'
preKubeadmCommands:
- bash -c /tmp/kubeadm-bootstrap.sh
Expand Down Expand Up @@ -523,10 +526,10 @@ spec:
echo "Use OOT credential provider"
mkdir C:\var\lib\kubelet\credential-provider
# Update the link below
curl.exe --retry 10 --retry-delay 5 -L "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${IMAGE_TAG_ACR_CREDENTIAL_PROVIDER}/azure-acr-credential-provider.exe" --output C:\var\lib\kubelet\credential-provider\acr-credential-provider
curl.exe --retry 10 --retry-delay 5 -L "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${IMAGE_TAG_ACR_CREDENTIAL_PROVIDER}/azure-acr-credential-provider.exe" --output C:\var\lib\kubelet\credential-provider\acr-credential-provider.exe
# Update the link below
curl.exe --retry 10 --retry-delay 5 -L https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/examples/out-of-tree/credential-provider-config.yaml --output C:\var\lib\kubelet\credential-provider-config.yaml
curl.exe --retry 10 --retry-delay 5 -L https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/examples/out-of-tree/credential-provider-config-win.yaml --output C:\var\lib\kubelet\credential-provider-config.yaml
path: C:/use-oot-credential-provider.ps1
permissions: "0744"
joinConfiguration:
Expand All @@ -537,7 +540,7 @@ spec:
image-credential-provider-config: C:\var\lib\kubelet\credential-provider-config.yaml
cloud-provider: external
feature-gates: ${NODE_FEATURE_GATES:-""}
v: "2"
v: "4"
windows-priorityclass: ABOVE_NORMAL_PRIORITY_CLASS
name: '{{ ds.meta_data["local_hostname"] }}'
postKubeadmCommands:
Expand Down

0 comments on commit 6e8f4e7

Please sign in to comment.