diff --git a/README.md b/README.md index 888fff1a..e69493e5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Jenkins Operator -[![Version](https://img.shields.io/badge/version-v0.0.12-brightgreen.svg)](https://github.com/jenkinsci/kubernetes-operator/releases/tag/v0.0.12) +[![Version](https://img.shields.io/badge/version-v0.1.0-brightgreen.svg)](https://github.com/jenkinsci/kubernetes-operator/releases/tag/v0.1.0) [![Build Status](https://travis-ci.org/jenkinsci/kubernetes-operator.svg?branch=master)](https://travis-ci.org/jenkinsci/kubernetes-operator) [![Go Report Card](https://goreportcard.com/badge/github.com/jenkinsci/kubernetes-operator "Go Report Card")](https://goreportcard.com/report/github.com/jenkinsci/kubernetes-operator) [![Docker Pulls](https://img.shields.io/docker/pulls/virtuslab/jenkins-operator.svg)](https://hub.docker.com/r/virtuslab/jenkins-operator/tags) diff --git a/VERSION.txt b/VERSION.txt index f2524621..b82608c0 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -v0.0.12 +v0.1.0 diff --git a/deploy/all-in-one-v1alpha2.yaml b/deploy/all-in-one-v1alpha2.yaml new file mode 100644 index 00000000..a5a070d5 --- /dev/null +++ b/deploy/all-in-one-v1alpha2.yaml @@ -0,0 +1,143 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: jenkins-operator +--- +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: jenkins-operator +rules: + - apiGroups: + - "" + resources: + - services + - configmaps + - secrets + verbs: + - get + - create + - update + - list + - watch + - apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' + - apiGroups: + - "" + resources: + - serviceaccounts + verbs: + - create + - apiGroups: + - rbac.authorization.k8s.io + resources: + - roles + - rolebindings + verbs: + - create + - update + - apiGroups: + - "" + resources: + - pods/portforward + verbs: + - create + - apiGroups: + - "" + resources: + - pods/log + verbs: + - get + - list + - watch + - apiGroups: + - "" + resources: + - pods + - pods/exec + verbs: + - "*" + - apiGroups: + - "" + resources: + - events + verbs: + - list + - create + - patch + - apiGroups: + - apps + resourceNames: + - jenkins-operator + resources: + - deployments/finalizers + verbs: + - update + - apiGroups: + - jenkins.io + resources: + - '*' + verbs: + - '*' + - apiGroups: + - "" + resources: + - persistentvolumeclaims + verbs: + - get + - list + - watch +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: jenkins-operator +subjects: +- kind: ServiceAccount + name: jenkins-operator +roleRef: + kind: Role + name: jenkins-operator + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: jenkins-operator +spec: + replicas: 1 + selector: + matchLabels: + name: jenkins-operator + template: + metadata: + labels: + name: jenkins-operator + spec: + serviceAccountName: jenkins-operator + containers: + - name: jenkins-operator + image: virtuslab/jenkins-operator:v0.0.12 + command: + - jenkins-operator + args: [] + imagePullPolicy: IfNotPresent + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: "jenkins-operator" diff --git a/deploy/operator.yaml b/deploy/operator.yaml index 0c2befb9..b16cc69d 100644 --- a/deploy/operator.yaml +++ b/deploy/operator.yaml @@ -16,7 +16,7 @@ spec: serviceAccountName: jenkins-operator containers: - name: jenkins-operator - image: virtuslab/jenkins-operator:v0.0.12 + image: virtuslab/jenkins-operator:v0.1.0 command: - jenkins-operator args: [] diff --git a/docs/migration-guide-v1alphav1-to-v1alpha2.md b/docs/migration-guide-v1alphav1-to-v1alpha2.md new file mode 100644 index 00000000..8cf5307c --- /dev/null +++ b/docs/migration-guide-v1alphav1-to-v1alpha2.md @@ -0,0 +1,272 @@ +# Migration guide from v1alpha1 to v1alpha2 + +## Stop jenkins-operator pod + +Run command: +```bash +$ kubectl -n scale deployment.apps/jenkins-operator --replicas=0 +deployment.apps/jenkins-operator scaled +``` + +Desired state: +```bash +$ kubectl -n get po +No resources found. +``` + +## Stop Jenkins master pod + +Run command: +```bash +$ kubectl -n get po +NAME READY STATUS RESTARTS AGE +jenkins-operator- 2/2 Running 0 3m35s +$ kubectl -n get delete po jenkins-operator- +pod "jenkins-operator-" deleted +``` + +Desired state: +```bash +$ kubectl -n get po +No resources found. +``` + +## Save Jenkins CR to jenkins.yaml file + +Run command: +```bash +$ kubectl -n get jenkins -o yaml > jenkins.yaml +``` + +## Modify jenkins.yaml file + +Old format: +```yaml +apiVersion: jenkins.io/v1alpha1 +kind: Jenkins +metadata: + name: + namespace: +spec: + master: + basePlugins: + configuration-as-code:1.17: + - configuration-as-code-support:1.17 + git:3.10.0: + - apache-httpcomponents-client-4-api:4.5.5-3.0 + - credentials:2.1.19 + - display-url-api:2.3.1 + - git-client:2.7.7 + - jsch:0.1.55 + - junit:1.28 + - mailer:1.23 + - matrix-project:1.14 + - scm-api:2.4.1 + - script-security:1.59 + - ssh-credentials:1.16 + - structs:1.19 + - workflow-api:2.34 + - workflow-scm-step:2.7 + - workflow-step-api:2.19 + job-dsl:1.74: + - script-security:1.59 + - structs:1.19 + kubernetes-credentials-provider:0.12.1: + - credentials:2.1.19 + - structs:1.19 + - variant:1.2 + kubernetes:1.15.5: + - apache-httpcomponents-client-4-api:4.5.5-3.0 + - cloudbees-folder:6.8 + - credentials:2.1.19 + - durable-task:1.29 + - jackson2-api:2.9.9 + - kubernetes-credentials:0.4.0 + - plain-credentials:1.5 + - structs:1.19 + - variant:1.2 + - workflow-step-api:2.19 + workflow-aggregator:2.6: + - ace-editor:1.1 + - apache-httpcomponents-client-4-api:4.5.5-3.0 + - authentication-tokens:1.3 + - branch-api:2.5.2 + - cloudbees-folder:6.8 + - credentials-binding:1.18 + - credentials:2.1.19 + - display-url-api:2.3.1 + - docker-commons:1.15 + - docker-workflow:1.18 + - durable-task:1.29 + - git-client:2.7.7 + - git-server:1.7 + - handlebars:1.1.1 + - jackson2-api:2.9.9 + - jquery-detached:1.2.1 + - jsch:0.1.55 + - junit:1.28 + - lockable-resources:2.5 + - mailer:1.23 + - matrix-project:1.14 + - momentjs:1.1.1 + - pipeline-build-step:2.9 + - pipeline-graph-analysis:1.10 + - pipeline-input-step:2.10 + - pipeline-milestone-step:1.3.1 + - pipeline-model-api:1.3.8 + - pipeline-model-declarative-agent:1.1.1 + - pipeline-model-definition:1.3.8 + - pipeline-model-extensions:1.3.8 + - pipeline-rest-api:2.11 + - pipeline-stage-step:2.3 + - pipeline-stage-tags-metadata:1.3.8 + - pipeline-stage-view:2.11 + - plain-credentials:1.5 + - scm-api:2.4.1 + - script-security:1.59 + - ssh-credentials:1.16 + - structs:1.19 + - workflow-api:2.34 + - workflow-basic-steps:2.16 + - workflow-cps-global-lib:2.13 + - workflow-cps:2.69 + - workflow-durable-task-step:2.30 + - workflow-job:2.32 + - workflow-multibranch:2.21 + - workflow-scm-step:2.7 + - workflow-step-api:2.19 + - workflow-support:3.3 + workflow-job:2.32: + - scm-api:2.4.1 + - script-security:1.59 + - structs:1.19 + - workflow-api:2.34 + - workflow-step-api:2.19 + - workflow-support:3.3 + image: jenkins/jenkins:lts + imagePullPolicy: Always + livenessProbe: + failureThreshold: 12 + httpGet: + path: /login + port: 8080 + scheme: HTTP + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + plugins: + simple-theme-plugin:0.5.1: [] + slack:2.24: + - workflow-step-api:2.19 + - credentials:2.1.19 + - display-url-api:2.3.1 + - junit:1.28 + - plain-credentials:1.5 + - script-security:1.59 + - structs:1.19 + - token-macro:2.8 + readinessProbe: + failureThreshold: 12 + httpGet: + path: /login + port: 8080 + scheme: HTTP + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + resources: + limits: + cpu: 1500m + memory: 3Gi + requests: + cpu: "1" + memory: 500Mi +``` + +New format: +```yaml +apiVersion: jenkins.io/v1alpha2 +kind: Jenkins +metadata: + name: + namespace: +spec: + master: + basePlugins: + - name: kubernetes + version: 1.15.7 + - name: workflow-job + version: "2.32" + - name: workflow-aggregator + version: "2.6" + - name: git + version: 3.10.0 + - name: job-dsl + version: "1.74" + - name: configuration-as-code + version: "1.19" + - name: configuration-as-code-support + version: "1.19" + - name: kubernetes-credentials-provider + version: 0.12.1 + containers: + - image: jenkins/jenkins:lts + imagePullPolicy: Always + livenessProbe: + failureThreshold: 12 + httpGet: + path: /login + port: http + scheme: HTTP + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: jenkins-master + readinessProbe: + failureThreshold: 3 + httpGet: + path: /login + port: http + scheme: HTTP + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + resources: + limits: + cpu: 1500m + memory: 3Gi + requests: + cpu: "1" + memory: 500Mi + plugins: + - name: simple-theme-plugin + version: 0.5.1 + - name: slack + version: 2.24 +``` + +Change apiVersion to `apiVersion: jenkins.io/v1alpha2` + +New plugin format without dependent plugins: +- spec.master.basePlugins +- spec.master.plugins + +Move Jenkins master container properties to spec.master.containers[jenkins-master] +- spec.master.image +- spec.master.imagePullPolicy +- spec.master.livenessProbe +- spec.master.readinessProbe +- spec.master.resources + +## Deploy new Kubernetes manifests + +Run commands: +```bash +$ kubectl -n apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/deploy/crds/jenkins_v1alpha2_jenkins_crd.yaml +$ kubectl -n apply -f jenkins.yaml +$ kubectl -n apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/deploy/all-in-one-v1alpha2.yaml +``` \ No newline at end of file