mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-21 07:24:19 +00:00
Add imagePullSecrets inheritage for VGDP pod and maintenance job. (#9096)
Run the E2E test on kind / build (push) Failing after 8m21s
Run the E2E test on kind / setup-test-matrix (push) Successful in 4s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 42s
Close stale issues and PRs / stale (push) Successful in 21s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 1m49s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-aws, main) (push) Failing after 1m17s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-gcp, main) (push) Failing after 3m30s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-microsoft-azure, main) (push) Failing after 3m12s
Run the E2E test on kind / build (push) Failing after 8m21s
Run the E2E test on kind / setup-test-matrix (push) Successful in 4s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 42s
Close stale issues and PRs / stale (push) Successful in 21s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 1m49s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-aws, main) (push) Failing after 1m17s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-gcp, main) (push) Failing after 3m30s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-microsoft-azure, main) (push) Failing after 3m12s
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
This commit is contained in:
@@ -89,6 +89,11 @@ func GetServiceAccountFromVeleroServer(deployment *appsv1api.Deployment) string
|
||||
return deployment.Spec.Template.Spec.ServiceAccountName
|
||||
}
|
||||
|
||||
// GetImagePullSecretsFromVeleroServer get the image pull secrets from the Velero server deployment
|
||||
func GetImagePullSecretsFromVeleroServer(deployment *appsv1api.Deployment) []corev1api.LocalObjectReference {
|
||||
return deployment.Spec.Template.Spec.ImagePullSecrets
|
||||
}
|
||||
|
||||
// getVeleroServerImage get the image of the Velero server deployment
|
||||
func GetVeleroServerImage(deployment *appsv1api.Deployment) string {
|
||||
return deployment.Spec.Template.Spec.Containers[0].Image
|
||||
|
||||
@@ -679,6 +679,63 @@ func TestGetServiceAccountFromVeleroServer(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetImagePullSecretsFromVeleroServer(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
deploy *appsv1api.Deployment
|
||||
want []corev1api.LocalObjectReference
|
||||
}{
|
||||
{
|
||||
name: "no image pull secrets",
|
||||
deploy: &appsv1api.Deployment{
|
||||
Spec: appsv1api.DeploymentSpec{
|
||||
Template: corev1api.PodTemplateSpec{
|
||||
Spec: corev1api.PodSpec{
|
||||
ServiceAccountName: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
want: nil,
|
||||
},
|
||||
{
|
||||
name: "image pull secrets",
|
||||
deploy: &appsv1api.Deployment{
|
||||
Spec: appsv1api.DeploymentSpec{
|
||||
Template: corev1api.PodTemplateSpec{
|
||||
Spec: corev1api.PodSpec{
|
||||
ImagePullSecrets: []corev1api.LocalObjectReference{
|
||||
{
|
||||
Name: "imagePullSecret1",
|
||||
},
|
||||
{
|
||||
Name: "imagePullSecret2",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
want: []corev1api.LocalObjectReference{
|
||||
{
|
||||
Name: "imagePullSecret1",
|
||||
},
|
||||
{
|
||||
Name: "imagePullSecret2",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
got := GetImagePullSecretsFromVeleroServer(test.deploy)
|
||||
|
||||
require.Equal(t, test.want, got)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetVeleroServerImage(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user