Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip kube-api-access Volume Comparison #550

Merged
merged 2 commits into from
Apr 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions pkg/configuration/base/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,25 @@ func CompareContainerVolumeMounts(expected corev1.Container, actual corev1.Conta

// compareVolumes returns true if Jenkins pod and Jenkins CR volumes are the same
func (r *JenkinsBaseConfigurationReconciler) compareVolumes(actualPod corev1.Pod) bool {
var withoutServiceAccount []corev1.Volume
var toCompare []corev1.Volume
for _, volume := range actualPod.Spec.Volumes {
if !strings.HasPrefix(volume.Name, actualPod.Spec.ServiceAccountName) {
withoutServiceAccount = append(withoutServiceAccount, volume)
// filter out service account
if strings.HasPrefix(volume.Name, actualPod.Spec.ServiceAccountName) {
continue
}

// hotfix for k8s 1.21 - filter out kube-api-access-<random-suffix>
const kubeAPIAccessPrefix = "kube-api-access-"
if strings.HasPrefix(volume.Name, kubeAPIAccessPrefix) {
continue
}

toCompare = append(toCompare, volume)
}

return reflect.DeepEqual(
append(resources.GetJenkinsMasterPodBaseVolumes(r.Configuration.Jenkins), r.Configuration.Jenkins.Spec.Master.Volumes...),
withoutServiceAccount,
toCompare,
)
}

Expand Down