Skip to content

Commit cf063d3

Browse files
omerap12kruthika04
authored andcommitted
comment out TestUnchangedCAReloader test (flake)
Signed-off-by: Omer Aplatony <[email protected]> Added support for azure user assigned identity id Bumped chart version to 9.46.1 fix lint issue run helm docs bump chart doc(gce): Update manual MIG specification URL
1 parent ec8b605 commit cf063d3

File tree

7 files changed

+131
-119
lines changed

7 files changed

+131
-119
lines changed

charts/cluster-autoscaler/Chart.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ name: cluster-autoscaler
1111
sources:
1212
- https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler
1313
type: application
14-
version: 9.46.0
14+
version: 9.46.2
15+

charts/cluster-autoscaler/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ In the event you want to explicitly specify MIGs instead of using auto-discovery
187187

188188
```
189189
# where 'n' is the index, starting at 0
190-
--set autoscalingGroups[n].name=https://content.googleapis.com/compute/v1/projects/$PROJECTID/zones/$ZONENAME/instanceGroupManagers/$FULL-MIG-NAME,autoscalingGroups[n].maxSize=$MAXSIZE,autoscalingGroups[n].minSize=$MINSIZE
190+
--set autoscalingGroups[n].name=https://content.googleapis.com/compute/v1/projects/$PROJECTID/zones/$ZONENAME/instanceGroups/$FULL-MIG-NAME,autoscalingGroups[n].maxSize=$MAXSIZE,autoscalingGroups[n].minSize=$MINSIZE
191191
```
192192
193193
### Azure
@@ -438,6 +438,7 @@ vpa:
438438
| azureTenantID | string | `""` | Azure tenant where the resources are located. Required if `cloudProvider=azure` |
439439
| azureUseManagedIdentityExtension | bool | `false` | Whether to use Azure's managed identity extension for credentials. If using MSI, ensure subscription ID, resource group, and azure AKS cluster name are set. You can only use one authentication method at a time, either azureUseWorkloadIdentityExtension or azureUseManagedIdentityExtension should be set. |
440440
| azureUseWorkloadIdentityExtension | bool | `false` | Whether to use Azure's workload identity extension for credentials. See the project here: https://github.com/Azure/azure-workload-identity for more details. You can only use one authentication method at a time, either azureUseWorkloadIdentityExtension or azureUseManagedIdentityExtension should be set. |
441+
| azureUserAssignedIdentityID | string | `""` | When vmss has multiple user assigned identity assigned, azureUserAssignedIdentityID specifies which identity to be used |
441442
| azureVMType | string | `"vmss"` | Azure VM type. |
442443
| civoApiKey | string | `""` | API key for the Civo API. Required if `cloudProvider=civo` |
443444
| civoApiUrl | string | `"https://api.civo.com"` | URL for the Civo API. Required if `cloudProvider=civo` |

charts/cluster-autoscaler/README.md.gotmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ In the event you want to explicitly specify MIGs instead of using auto-discovery
187187

188188
```
189189
# where 'n' is the index, starting at 0
190-
--set autoscalingGroups[n].name=https://content.googleapis.com/compute/v1/projects/$PROJECTID/zones/$ZONENAME/instanceGroupManagers/$FULL-MIG-NAME,autoscalingGroups[n].maxSize=$MAXSIZE,autoscalingGroups[n].minSize=$MINSIZE
190+
--set autoscalingGroups[n].name=https://content.googleapis.com/compute/v1/projects/$PROJECTID/zones/$ZONENAME/instanceGroups/$FULL-MIG-NAME,autoscalingGroups[n].maxSize=$MAXSIZE,autoscalingGroups[n].minSize=$MINSIZE
191191
```
192192

193193
### Azure

charts/cluster-autoscaler/templates/deployment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ spec:
185185
{{- else if .Values.azureUseManagedIdentityExtension }}
186186
- name: ARM_USE_MANAGED_IDENTITY_EXTENSION
187187
value: "true"
188+
- name: ARM_USER_ASSIGNED_IDENTITY_ID
189+
valueFrom:
190+
secretKeyRef:
191+
key: azureUserAssignedIdentityID
192+
name: {{ template "cluster-autoscaler.fullname" . }}
188193
{{- else }}
189194
- name: ARM_TENANT_ID
190195
valueFrom:

charts/cluster-autoscaler/templates/secret.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ data:
1818
SubscriptionID: "{{ .Values.azureSubscriptionID | b64enc }}"
1919
TenantID: "{{ .Values.azureTenantID | b64enc }}"
2020
VMType: "{{ .Values.azureVMType | b64enc }}"
21+
azureUserAssignedIdentityID: "{{ .Values.azureUserAssignedIdentityID | b64enc }}"
2122
{{- else if $isAws }}
2223
AwsAccessKeyId: "{{ .Values.awsAccessKeyID | b64enc }}"
2324
AwsSecretAccessKey: "{{ .Values.awsSecretAccessKey | b64enc }}"

charts/cluster-autoscaler/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ azureTenantID: ""
101101
# azureUseManagedIdentityExtension -- Whether to use Azure's managed identity extension for credentials. If using MSI, ensure subscription ID, resource group, and azure AKS cluster name are set. You can only use one authentication method at a time, either azureUseWorkloadIdentityExtension or azureUseManagedIdentityExtension should be set.
102102
azureUseManagedIdentityExtension: false
103103

104+
# azureUserAssignedIdentityID -- When vmss has multiple user assigned identity assigned, azureUserAssignedIdentityID specifies which identity to be used
105+
azureUserAssignedIdentityID: ""
106+
104107
# azureUseWorkloadIdentityExtension -- Whether to use Azure's workload identity extension for credentials. See the project here: https://github.com/Azure/azure-workload-identity for more details. You can only use one authentication method at a time, either azureUseWorkloadIdentityExtension or azureUseManagedIdentityExtension should be set.
105108
azureUseWorkloadIdentityExtension: false
106109

vertical-pod-autoscaler/pkg/admission-controller/certs_test.go

Lines changed: 117 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -276,119 +276,120 @@ func TestChangedCAReloader(t *testing.T) {
276276
assert.NotEqual(t, oldCAEncodedString, newCAEncodedString, "expected CA to change")
277277
}
278278

279-
func TestUnchangedCAReloader(t *testing.T) {
280-
tempDir := t.TempDir()
281-
caCert := &x509.Certificate{
282-
SerialNumber: big.NewInt(0),
283-
Subject: pkix.Name{
284-
Organization: []string{"ca"},
285-
},
286-
NotBefore: time.Now(),
287-
NotAfter: time.Now().AddDate(2, 0, 0),
288-
IsCA: true,
289-
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},
290-
KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
291-
BasicConstraintsValid: true,
292-
}
293-
caKey, err := rsa.GenerateKey(rand.Reader, 4096)
294-
if err != nil {
295-
t.Error(err)
296-
}
297-
caBytes, err := x509.CreateCertificate(rand.Reader, caCert, caCert, &caKey.PublicKey, caKey)
298-
if err != nil {
299-
t.Error(err)
300-
}
301-
caPath := path.Join(tempDir, "ca.crt")
302-
caFile, err := os.Create(caPath)
303-
if err != nil {
304-
t.Error(err)
305-
}
306-
err = pem.Encode(caFile, &pem.Block{
307-
Type: "CERTIFICATE",
308-
Bytes: caBytes,
309-
})
310-
if err != nil {
311-
t.Error(err)
312-
}
313-
314-
testClientSet := fake.NewSimpleClientset()
315-
316-
selfRegistration(
317-
testClientSet,
318-
readFile(caPath),
319-
0*time.Second,
320-
"default",
321-
"vpa-service",
322-
"http://example.com/",
323-
true,
324-
int32(32),
325-
"",
326-
[]string{},
327-
false,
328-
"key1:value1,key2:value2",
329-
)
330-
331-
webhookConfigInterface := testClientSet.AdmissionregistrationV1().MutatingWebhookConfigurations()
332-
oldWebhookConfig, err := webhookConfigInterface.Get(context.TODO(), webhookConfigName, metav1.GetOptions{})
333-
if err != nil {
334-
t.Error(err)
335-
}
336-
337-
assert.Len(t, oldWebhookConfig.Webhooks, 1, "expected one webhook configuration")
338-
webhook := oldWebhookConfig.Webhooks[0]
339-
oldWebhookCABundle := webhook.ClientConfig.CABundle
340-
341-
var reloadWebhookCACalled, patchCalled atomic.Bool
342-
reloadWebhookCACalled.Store(false)
343-
patchCalled.Store(false)
344-
testClientSet.PrependReactor("get", "mutatingwebhookconfigurations", func(action k8stesting.Action) (bool, runtime.Object, error) {
345-
reloadWebhookCACalled.Store(true)
346-
return false, nil, nil
347-
})
348-
testClientSet.PrependReactor("patch", "mutatingwebhookconfigurations", func(action k8stesting.Action) (bool, runtime.Object, error) {
349-
patchCalled.Store(true)
350-
return false, nil, nil
351-
})
352-
353-
reloader := certReloader{
354-
clientCaPath: caPath,
355-
mutatingWebhookClient: testClientSet.AdmissionregistrationV1().MutatingWebhookConfigurations(),
356-
}
357-
stop := make(chan struct{})
358-
defer close(stop)
359-
if err := reloader.start(stop); err != nil {
360-
t.Error(err)
361-
}
362-
363-
originalCaFile, err := os.ReadFile(caPath)
364-
if err != nil {
365-
t.Error(err)
366-
}
367-
err = os.WriteFile(caPath, originalCaFile, 0666)
368-
if err != nil {
369-
t.Error(err)
370-
}
371-
372-
oldCAEncodedString := base64.StdEncoding.EncodeToString(oldWebhookCABundle)
373-
374-
for tries := 0; tries < 10; tries++ {
375-
if reloadWebhookCACalled.Load() {
376-
break
377-
}
378-
time.Sleep(1 * time.Second)
379-
}
380-
if !reloadWebhookCACalled.Load() {
381-
t.Error("expected reloadWebhookCA to be called")
382-
}
383-
384-
assert.False(t, patchCalled.Load(), "expected patch to not be called")
385-
386-
newWebhookConfig, err := webhookConfigInterface.Get(context.TODO(), webhookConfigName, metav1.GetOptions{})
387-
assert.Nil(t, err, "expected no error")
388-
assert.NotNil(t, newWebhookConfig, "expected webhook configuration")
389-
assert.Len(t, newWebhookConfig.Webhooks, 1, "expected one webhook configuration")
390-
391-
newWebhookCABundle := newWebhookConfig.Webhooks[0].ClientConfig.CABundle
392-
newCAEncodedString := base64.StdEncoding.EncodeToString(newWebhookCABundle)
393-
assert.Equal(t, oldCAEncodedString, newCAEncodedString, "expected CA to not change")
394-
}
279+
// TODO(omerap12): Temporary workaround for flakiness (#7831)
280+
// func TestUnchangedCAReloader(t *testing.T) {
281+
// tempDir := t.TempDir()
282+
// caCert := &x509.Certificate{
283+
// SerialNumber: big.NewInt(0),
284+
// Subject: pkix.Name{
285+
// Organization: []string{"ca"},
286+
// },
287+
// NotBefore: time.Now(),
288+
// NotAfter: time.Now().AddDate(2, 0, 0),
289+
// IsCA: true,
290+
// ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},
291+
// KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
292+
// BasicConstraintsValid: true,
293+
// }
294+
// caKey, err := rsa.GenerateKey(rand.Reader, 4096)
295+
// if err != nil {
296+
// t.Error(err)
297+
// }
298+
// caBytes, err := x509.CreateCertificate(rand.Reader, caCert, caCert, &caKey.PublicKey, caKey)
299+
// if err != nil {
300+
// t.Error(err)
301+
// }
302+
// caPath := path.Join(tempDir, "ca.crt")
303+
// caFile, err := os.Create(caPath)
304+
// if err != nil {
305+
// t.Error(err)
306+
// }
307+
// err = pem.Encode(caFile, &pem.Block{
308+
// Type: "CERTIFICATE",
309+
// Bytes: caBytes,
310+
// })
311+
// if err != nil {
312+
// t.Error(err)
313+
// }
314+
315+
// testClientSet := fake.NewSimpleClientset()
316+
317+
// selfRegistration(
318+
// testClientSet,
319+
// readFile(caPath),
320+
// 0*time.Second,
321+
// "default",
322+
// "vpa-service",
323+
// "http://example.com/",
324+
// true,
325+
// int32(32),
326+
// "",
327+
// []string{},
328+
// false,
329+
// "key1:value1,key2:value2",
330+
// )
331+
332+
// webhookConfigInterface := testClientSet.AdmissionregistrationV1().MutatingWebhookConfigurations()
333+
// oldWebhookConfig, err := webhookConfigInterface.Get(context.TODO(), webhookConfigName, metav1.GetOptions{})
334+
// if err != nil {
335+
// t.Error(err)
336+
// }
337+
338+
// assert.Len(t, oldWebhookConfig.Webhooks, 1, "expected one webhook configuration")
339+
// webhook := oldWebhookConfig.Webhooks[0]
340+
// oldWebhookCABundle := webhook.ClientConfig.CABundle
341+
342+
// var reloadWebhookCACalled, patchCalled atomic.Bool
343+
// reloadWebhookCACalled.Store(false)
344+
// patchCalled.Store(false)
345+
// testClientSet.PrependReactor("get", "mutatingwebhookconfigurations", func(action k8stesting.Action) (bool, runtime.Object, error) {
346+
// reloadWebhookCACalled.Store(true)
347+
// return false, nil, nil
348+
// })
349+
// testClientSet.PrependReactor("patch", "mutatingwebhookconfigurations", func(action k8stesting.Action) (bool, runtime.Object, error) {
350+
// patchCalled.Store(true)
351+
// return false, nil, nil
352+
// })
353+
354+
// reloader := certReloader{
355+
// clientCaPath: caPath,
356+
// mutatingWebhookClient: testClientSet.AdmissionregistrationV1().MutatingWebhookConfigurations(),
357+
// }
358+
// stop := make(chan struct{})
359+
// defer close(stop)
360+
// if err := reloader.start(stop); err != nil {
361+
// t.Error(err)
362+
// }
363+
364+
// originalCaFile, err := os.ReadFile(caPath)
365+
// if err != nil {
366+
// t.Error(err)
367+
// }
368+
// err = os.WriteFile(caPath, originalCaFile, 0666)
369+
// if err != nil {
370+
// t.Error(err)
371+
// }
372+
373+
// oldCAEncodedString := base64.StdEncoding.EncodeToString(oldWebhookCABundle)
374+
375+
// for tries := 0; tries < 10; tries++ {
376+
// if reloadWebhookCACalled.Load() {
377+
// break
378+
// }
379+
// time.Sleep(1 * time.Second)
380+
// }
381+
// if !reloadWebhookCACalled.Load() {
382+
// t.Error("expected reloadWebhookCA to be called")
383+
// }
384+
385+
// assert.False(t, patchCalled.Load(), "expected patch to not be called")
386+
387+
// newWebhookConfig, err := webhookConfigInterface.Get(context.TODO(), webhookConfigName, metav1.GetOptions{})
388+
// assert.Nil(t, err, "expected no error")
389+
// assert.NotNil(t, newWebhookConfig, "expected webhook configuration")
390+
// assert.Len(t, newWebhookConfig.Webhooks, 1, "expected one webhook configuration")
391+
392+
// newWebhookCABundle := newWebhookConfig.Webhooks[0].ClientConfig.CABundle
393+
// newCAEncodedString := base64.StdEncoding.EncodeToString(newWebhookCABundle)
394+
// assert.Equal(t, oldCAEncodedString, newCAEncodedString, "expected CA to not change")
395+
// }

0 commit comments

Comments
 (0)