Skip to content

Commit

Permalink
Add Image Credential Provider flags for Kubelet on Azure
Browse files Browse the repository at this point in the history
  • Loading branch information
theobarberbany committed Mar 4, 2024
1 parent 398c171 commit 286623c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/controller/template/render.go
Expand Up @@ -467,6 +467,8 @@ func credentialProviderConfigFlag(cfg RenderConfig) interface{} {
switch cfg.Infra.Status.PlatformStatus.Type {
case configv1.AWSPlatformType:
return fmt.Sprintf("%s %s%s", credentialProviderBinDirFlag, credentialProviderConfigFlag, "ecr-credential-provider.yaml")
case configv1.AzurePlatformType:
return fmt.Sprintf("%s %s%s", credentialProviderBinDirFlag, credentialProviderConfigFlag, "acr-credential-provider.yaml")
default:
return ""
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/template/render_test.go
Expand Up @@ -311,7 +311,7 @@ func TestCredentialProviderConfigFlag(t *testing.T) {
},
{
platform: configv1.AzurePlatformType,
res: "",
res: "--image-credential-provider-bin-dir=/usr/libexec/kubelet-image-credential-provider-plugins --image-credential-provider-config=/etc/kubernetes/credential-providers/acr-credential-provider.yaml",
},
{
platform: configv1.GCPPlatformType,
Expand Down
@@ -0,0 +1,18 @@
mode: 0644
path: "/etc/kubernetes/credential-providers/acr-credential-provider.yaml"
contents:
inline: |
apiVersion: kubelet.config.k8s.io/v1
kind: CredentialProviderConfig
providers:
- name: acr-credential-provider
apiVersion: credentialprovider.kubelet.k8s.io/v1
defaultCacheDuration: "10m"
matchImages:
- "*.azurecr.io"
- "*.azurecr.cn"
- "*.azurecr.de"
- "*.azurecr.us"
args:
- /etc/kubernetes/cloud.conf

0 comments on commit 286623c

Please sign in to comment.