helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

Document how to migrate from docker or regular server

Open felipecrs opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe

I have a Jenkins server which is running since years via Docker in a static VM. I want to migrate it to K8s, but I'm not ready to port/redo all my configuration for this.

Describe the solution you'd like

I want to simply transfer my whole jenkins_home folder, which contains everything of my Jenkins, which includes Clouds configuration, jobs, plugins and everything else.

A section in the documentation that describes how to deactivate everything in order to make the chart behave like a docker installation would be great. For example, I thought of disabling JCasc and Agents, but I worry if there is more, or if there is any other unintended consequence in doing what I'm planning to.

Describe alternatives you've considered

N/A

Additional context

N/A

felipecrs avatar Jun 29 '22 21:06 felipecrs

@felipecrs, The chart does support mounting the controller's jobs directory using a PertistentVolumeClaim, so if you already have that stored somewhere that's a possibility. However, the goal of this helm chart/using jcasc in general is to be able to persistent configurations between runs, including plugins as well as settings and cloud configurations. I would recommend a hybrid approach where you leverage the persistent volume mount for your jobs but migrate the rest of your settings to be persistent and reproduceable. In terms of documenting, are you already using JCasC or configuring your cloud settings using groovy scripts?

miles-w-3 avatar Jul 17 '22 15:07 miles-w-3

I would recommend a hybrid approach where you leverage the persistent volume mount for your jobs but migrate the rest of your settings to be persistent and reproduceable.

And I cannot argue on how much that would be beneficial, but in my situation, we simply don't have enough resources to plan such a refactoring.

are you already using JCasC or configuring your cloud settings using groovy scripts?

No, in our Jenkins everything is configured manually in the Jenkins UI itself. No JCasC, no custom Groovy scripts, and no JobDSL either.


After all, this is how I managed to make the chart work for me:

# my.values.yaml

controller:
  adminSecret: false

  # Don't forget to also create the /var/jenkins_home/initialization-completed
  initializeOnce: true

  agentListenerEnabled: false

  # List of plugins to be install during Jenkins controller start
  installPlugins: false

  JCasC:
    defaultConfig: false

  sidecars:
    configAutoReload:
      enabled: false

agent:
  enabled: false

persistence:
  enabled: true
  existingClaim: jenkins

But as mentioned in the YAML, it's also important to pre-create the file at /var/jenkins_home/initialization-completed so that initializeOnce is honored even in the first initialization. I may be lacking some parameters, or may have set others that aren't actually required, but I succesfully made the migration this way.

Creating the PersistentVolumeClaim itself is also a separate challenge which would deserve some guidelines, I think:

  1. You must first create the PVC normally named jenkins
  2. Let the PVC auto-create a PV for you
  3. Patch the PV manually to ensure its ReclaimPolicy is Retain:
    kubectl patch pv <your-pv-name> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
    

felipecrs avatar Jul 18 '22 18:07 felipecrs