fabric8-services / fabric8-tenant-jenkins

Generates Jenkins tenant namespace YAML
Apache License 2.0
2 stars 14 forks source link

Delete PV that was used to cache mvn builds. #86

Closed jaseemabid closed 6 years ago

jaseemabid commented 6 years ago

Fixes https://github.com/openshiftio/openshift.io/issues/3333

The current deployment looks like this.

Image: fabric8/jenkins-openshift:vd9a0b29
Ports: 8080/TCP (http), 50000/TCP (slave)
Mount: jenkins-home → /var/lib/jenkins read-write
Mount: jenkins-config → /opt/openshift/configuration/ read-write
CPU: 0 cores to 2 cores
Memory: 512 MiB limit
Readiness Probe: GET /login on port 8080 (HTTP) 10s delay, 10s timeout
Liveness Probe: GET /login on port 8080 (HTTP) 420s delay, 10s timeout

Post update it looks like this.

Image: fabric8/jenkins-openshift:v38d21c0
Ports: 8080/TCP (http), 50000/TCP (slave)
Mount: jenkins-home → /var/lib/jenkins read-write
Mount: jenkins-config → /opt/openshift/configuration/ read-write
CPU: 0 cores to 2 cores
Memory: 512 MiB limit
Readiness Probe: GET /login on port 8080 (HTTP) 10s delay, 10s timeout
Liveness Probe: GET /login on port 8080 (HTTP) 420s delay, 10s timeout

The images are updated, and the PVC is not mounted before and after. The config is of the form

- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{"maven.fabric8.io/source-url":"jar:file:/home/jenkins/workspace/bric8-tenant-jenkins_master-AGRITQKDOGHX6ZQLEFCNJVZP7VWPA5P7B6D2RTTKZ2KN4XI2LSCA/apps/jenkins/target/jenkins-4.0.63.jar!/META-INF/fabric8/openshift.yml"},"labels":{"app":"jenkins","group":"io.fabric8.tenant.apps","provider":"fabric8","version":"4.0.63"},"name":"jenkins-mvn-local-repo","namespace":"jabid5-jenkins"},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"1Gi"}}}}
      maven.fabric8.io/source-url: jar:file:/home/jenkins/workspace/bric8-tenant-jenkins_master-AGRITQKDOGHX6ZQLEFCNJVZP7VWPA5P7B6D2RTTKZ2KN4XI2LSCA/apps/jenkins/target/jenkins-4.0.63.jar!/META-INF/fabric8/openshift.yml
      pv.kubernetes.io/bind-completed: "yes"
      pv.kubernetes.io/bound-by-controller: "yes"
    creationTimestamp: 2018-05-02T10:03:42Z
    labels:
      app: jenkins
      group: io.fabric8.tenant.apps
      provider: fabric8
      version: 4.0.63
    name: jenkins-mvn-local-repo
    namespace: jabid5-jenkins
    resourceVersion: "188546238"
    selfLink: /api/v1/namespaces/jabid5-jenkins/persistentvolumeclaims/jenkins-mvn-local-repo
    uid: 18339e94-4df0-11e8-ac6b-029a5a55534e
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 1Gi
    storageClassName: gluster-subvol
    volumeName: 60e14bb9-4116-4295-a6a1-7024c82669ce-06-94
  status:
    accessModes:
    - ReadWriteOnce
    capacity:
      storage: 1Gi
    phase: Bound
kind: List
metadata: {}
resourceVersion: ""
selfLink: ""

As far as I understand, this patch ensures that the PVC won't be recreated for a user after another tenant reset. To make sure that nothing goes wrong, I'm manually deleting the PVC from my console and running a quickstart.

Does the approach makes sense @jfchevrette?

fabric8cd commented 6 years ago

PR now available for testing: Launch in OpenShift.io and click the update tenant button

fabric8cd commented 6 years ago

PR now available for testing: Launch in OpenShift.io and click the update tenant button

fabric8cd commented 6 years ago

PR now available for testing: Launch in OpenShift.io and click the update tenant button

jaseemabid commented 6 years ago

I was able to run a quickstart and deploy it post removing the PVC, so I'm assuming this change wont break anything.

jfchevrette commented 6 years ago

LGTM! Thanks @jaseemabid !

jaseemabid commented 6 years ago
  1. Now resetting the tenant post merge should not recreate the PVC, I'll test it out once after merging this to master and deploying it.
  2. For existing users, JF's script will delete the PVC and since its not mounted anywhere, should not cause any troubles.
jaseemabid commented 6 years ago
  1. Master build seems to have gone well.
  2. tenant-jenkins 4.0.71 released and available in maven central
  3. Opened PR https://github.com/fabric8-services/fabric8-tenant/pull/585 automatically
  4. Opened https://github.com/openshiftio/saas-openshiftio/pull/844 and deployed to prod
  5. I see this after a reset tenant
    fabric8.io/git-branch: release-v4.0.71
    fabric8.io/git-commit: 4c4f46299366efec9431086f8a6260453c2f6434
  6. There is no PVC after a tenant reset and the quickstarts ran fine.