#137 Remove waitForVolumes function
This commit is contained in:
parent
3f801cd180
commit
eaf19a70d8
|
|
@ -77,16 +77,7 @@ func (r *ReconcileJenkinsBaseConfiguration) Reconcile() (reconcile.Result, jenki
|
||||||
}
|
}
|
||||||
r.logger.V(log.VDebug).Info("Kubernetes resources are present")
|
r.logger.V(log.VDebug).Info("Kubernetes resources are present")
|
||||||
|
|
||||||
result, err := r.waitForVolumes()
|
result, err := r.ensureJenkinsMasterPod(metaObject)
|
||||||
if err != nil {
|
|
||||||
return reconcile.Result{}, nil, err
|
|
||||||
}
|
|
||||||
if result.Requeue {
|
|
||||||
return result, nil, nil
|
|
||||||
}
|
|
||||||
r.logger.V(log.VDebug).Info("Jenkins master pod volumes are ready")
|
|
||||||
|
|
||||||
result, err = r.ensureJenkinsMasterPod(metaObject)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return reconcile.Result{}, nil, err
|
return reconcile.Result{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -206,26 +197,6 @@ func (r *ReconcileJenkinsBaseConfiguration) ensureResourcesRequiredForJenkinsPod
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ReconcileJenkinsBaseConfiguration) waitForVolumes() (reconcile.Result, error) {
|
|
||||||
for _, volume := range r.jenkins.Spec.Master.Volumes {
|
|
||||||
if volume.PersistentVolumeClaim != nil {
|
|
||||||
pvc := &corev1.PersistentVolumeClaim{}
|
|
||||||
err := r.k8sClient.Get(context.TODO(), types.NamespacedName{Name: volume.PersistentVolumeClaim.ClaimName, Namespace: r.jenkins.ObjectMeta.Namespace}, pvc)
|
|
||||||
if err != nil {
|
|
||||||
return reconcile.Result{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if pvc.Status.Phase != corev1.ClaimBound {
|
|
||||||
r.logger.V(log.VWarn).Info(fmt.Sprintf("PersistentVolumeClaim '%s' have invalid state '%s' - required '%s', volume '%v'",
|
|
||||||
volume.PersistentVolumeClaim.ClaimName, pvc.Status.Phase, corev1.ClaimBound, volume))
|
|
||||||
return reconcile.Result{Requeue: true, RequeueAfter: time.Second * 5}, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return reconcile.Result{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *ReconcileJenkinsBaseConfiguration) verifyPlugins(jenkinsClient jenkinsclient.Jenkins) (bool, error) {
|
func (r *ReconcileJenkinsBaseConfiguration) verifyPlugins(jenkinsClient jenkinsclient.Jenkins) (bool, error) {
|
||||||
allPluginsInJenkins, err := jenkinsClient.GetPlugins(fetchAllPlugins)
|
allPluginsInJenkins, err := jenkinsClient.GetPlugins(fetchAllPlugins)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ func TestValidatePlugins(t *testing.T) {
|
||||||
var userPlugins []v1alpha2.Plugin
|
var userPlugins []v1alpha2.Plugin
|
||||||
|
|
||||||
got := baseReconcileLoop.validatePlugins(requiredBasePlugins, basePlugins, userPlugins)
|
got := baseReconcileLoop.validatePlugins(requiredBasePlugins, basePlugins, userPlugins)
|
||||||
|
|
||||||
assert.Equal(t, got, []string{"invalid plugin version 'simple-plugin:invalid', must follow pattern '^[0-9\\\\.-]+$'"})
|
assert.Equal(t, got, []string{"invalid plugin version 'simple-plugin:invalid', must follow pattern '^[0-9\\\\.-]+$'"})
|
||||||
})
|
})
|
||||||
t.Run("valid user and base plugin version", func(t *testing.T) {
|
t.Run("valid user and base plugin version", func(t *testing.T) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue