travelaudience / kubernetes-nexus

Run Sonatype Nexus Repository Manager OSS on top of Kubernetes (GKE). Includes instructions for automated backups (GCS) and day-to-day usage.
Apache License 2.0
130 stars 61 forks source link

helm upgrade #55

Open xpicio opened 4 years ago

xpicio commented 4 years ago

Hello i have an issue upgrading nexus to the latest version. I'm using the following command:

helm upgrade --version 1.19.0 -f values.yaml nexus stable/sonatype-nexus

where values.yaml is:

statefulset:
  enabled: true

nexusBackup:
  enabled: true
  env:
    targetBucket: "gs://scm-nexus-backup"
  persistence:
    storageClass: standard
  nexusAdminPassword: "**********"

nexusProxy:
  env:
    nexusDockerHost: repository-container.domain.com
    nexusHttpHost: repository.domain.com

persistence:
  storageClass: standard
  storageSize: 100Gi

resources:
  requests:
    cpu: 250m
    memory: 4800Mi

but i'm stuck on the following error:

UPGRADE FAILED
Error: StatefulSet.apps "nexus-sonatype-nexus" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden
Error: UPGRADE FAILED: StatefulSet.apps "nexus-sonatype-nexus" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden

There is something that i am doing wrong or there is an issue on statefulset deployment ?

xpicio commented 4 years ago

At the moment i upgraded to the latest version with the following steps:

helm delete --purge nexus

helm install --name nexus -f nexus/values.yaml stable/sonatype-nexus
varditn commented 4 years ago

Have you tried using helm diff to see what tried to change between the older version and the newer version of the helm chart?

xpicio commented 4 years ago

hello i tried helm diff and this is the output

helm diff upgrade nexus stable/sonatype-nexus --values values.yaml

default, nexus-sonatype-nexus, StatefulSet (apps) has changed:
  # Source: sonatype-nexus/templates/deployment-statefulset.yaml
  apiVersion: apps/v1
  kind: StatefulSet
  metadata:
    name: nexus-sonatype-nexus
    labels:
      app: sonatype-nexus
      fullname: nexus-sonatype-nexus
      chart: sonatype-nexus-1.20.0
      release: nexus
      heritage: Tiller
  spec:
    replicas: 1
    serviceName: nexus-sonatype-nexus
    selector:
      matchLabels:
        app: sonatype-nexus
        release: nexus
    template:
      metadata:
        labels:
          app: sonatype-nexus
          release: nexus
      spec:
        containers:
          - name: nexus
-           image: quay.io/travelaudience/docker-nexus:3.17.0
+           image: quay.io/travelaudience/docker-nexus:3.19.1
            imagePullPolicy: IfNotPresent
            env:
              - name: install4jAddVmParams
                value: -Xms1200M -Xmx1200M -XX:MaxDirectMemorySize=2G -XX:+UnlockExperimentalVMOptions
                  -XX:+UseCGroupMemoryLimitForHeap

            resources:
              {}

            ports:
              - containerPort: 5003
                name: nexus-docker-g
              - containerPort: 8081
                name: nexus-http
            livenessProbe:
              httpGet:
                path: /
                port: 8081
              initialDelaySeconds: 30
              periodSeconds: 30
              failureThreshold: 6
            readinessProbe:
              httpGet:
                path: /
                port: 8081
              initialDelaySeconds: 30
              periodSeconds: 30
              failureThreshold: 6
            volumeMounts:
              - mountPath: /nexus-data
                name: nexus-sonatype-nexus-data
              - mountPath: /nexus-data/backup
                name: nexus-sonatype-nexus-backup
          - name: nexus-proxy
            image: quay.io/travelaudience/docker-nexus-proxy:2.5.0
            resources:
              {}

            imagePullPolicy: IfNotPresent
            env:
              - name: ALLOWED_USER_AGENTS_ON_ROOT_REGEX
                value: "GoogleHC"
              - name: CLOUD_IAM_AUTH_ENABLED
                value: "false"
              - name: BIND_PORT
                value: "8080"
              - name: ENFORCE_HTTPS
                value: "false"
              - name: NEXUS_DOCKER_HOST
                value: "registry.scmgroup.com"
              - name: NEXUS_HTTP_HOST
                value: "repository.scmgroup.com"
              - name: UPSTREAM_DOCKER_PORT
                value: "5003"
              - name: UPSTREAM_HTTP_PORT
                value: "8081"
              - name: UPSTREAM_HOST
                value: "localhost"
            ports:
              - containerPort: 8080
                name: nexus-proxy
          - name: nexus-backup
            image: quay.io/travelaudience/docker-nexus-backup:1.5.0
            imagePullPolicy: IfNotPresent
            env:
              - name: NEXUS_AUTHORIZATION
                valueFrom:
                  secretKeyRef:
                    key: nexus.nexusAdminPassword
                    name: nexus-sonatype-nexus
              - name: NEXUS_BACKUP_DIRECTORY
                value: /nexus-data/backup
              - name: NEXUS_DATA_DIRECTORY
                value: /nexus-data
              - name: NEXUS_LOCAL_HOST_PORT
                value: "localhost:8081"
              - name: OFFLINE_REPOS
                value: "maven-central maven-public maven-releases maven-snapshots"
              - name: TARGET_BUCKET
                value: "gs://scm-nexus-backup"
              - name: GRACE_PERIOD
                value: "60"
              - name: TRIGGER_FILE
                value: .backup
            volumeMounts:
              - mountPath: /nexus-data
                name: nexus-sonatype-nexus-data
              - mountPath: /nexus-data/backup
                name: nexus-sonatype-nexus-backup
        volumes:

  ## create pvc in case of statefulsets
    volumeClaimTemplates:
      - metadata:
          name: nexus-sonatype-nexus-data
          labels:
            app: sonatype-nexus
            fullname: nexus-sonatype-nexus
            chart: sonatype-nexus-1.20.0
            release: nexus
            heritage: Tiller
        spec:
          accessModes:
            - "ReadWriteOnce"
          resources:
            requests:
              storage: "100Gi"
          storageClassName: "standard"
      - metadata:
          name: nexus-sonatype-nexus-backup
          labels:
            app: sonatype-nexus
            fullname: nexus-sonatype-nexus
            chart: sonatype-nexus-1.20.0
            release: nexus
            heritage: Tiller
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: "8Gi"
          storageClassName: "standard"

let me know if you need more information