Minikube downloaded to bin, test fixes

This commit is contained in:
Sylwia Brant 2021-02-08 13:37:00 +01:00
parent 77a79e8f97
commit d225cc113e
22 changed files with 25 additions and 4283 deletions

View File

@ -101,7 +101,6 @@ vet: ## Verifies `go vet` passes
.PHONY: staticcheck
HAS_STATICCHECK := $(shell which $(PROJECT_DIR)/bin/staticcheck)
PLATFORM = $(shell echo $(UNAME_S) | tr A-Z a-z)
staticcheck: ## Verifies `staticcheck` passes
@echo "+ $@"
ifndef HAS_STATICCHECK
@ -302,11 +301,21 @@ ifneq ($(KUBERNETES_PROVIDER),crc)
$(error KUBERNETES_PROVIDER not set to 'crc')
endif
.PHONY: minikube-start
minikube-start: check-minikube ## Start minikube
.PHONY: minikube
HAS_MINIKUBE := $(shell which $(PROJECT_DIR)/bin/minikube)
minikube: ## Download minikube if it's not present
@echo "+ $@"
@minikube status && exit 0 || \
minikube start --kubernetes-version $(MINIKUBE_KUBERNETES_VERSION) --dns-domain=$(CLUSTER_DOMAIN) --extra-config=kubelet.cluster-domain=$(CLUSTER_DOMAIN) --vm-driver=$(MINIKUBE_DRIVER) --memory 4096 --cpus 3
ifndef HAS_MINIKUBE
mkdir -p $(PROJECT_DIR)/bin
wget -O $(PROJECT_DIR)/bin/minikube https://github.com/kubernetes/minikube/releases/download/v$(MINIKUBE_VERSION)/minikube-$(PLATFORM)-amd64
chmod +x $(PROJECT_DIR)/bin/minikube
endif
.PHONY: minikube-start
minikube-start: minikube check-minikube ## Start minikube
@echo "+ $@"
bin/minikube status && exit 0 || \
bin/minikube start --kubernetes-version $(MINIKUBE_KUBERNETES_VERSION) --dns-domain=$(CLUSTER_DOMAIN) --extra-config=kubelet.cluster-domain=$(CLUSTER_DOMAIN) --vm-driver=$(MINIKUBE_DRIVER) --memory 4096 --cpus 3
.PHONY: crc-start
crc-start: check-crc ## Start CodeReady Containers Kubernetes cluster
@ -315,7 +324,6 @@ crc-start: check-crc ## Start CodeReady Containers Kubernetes cluster
.PHONY: sembump
HAS_SEMBUMP := $(shell which $(PROJECT_DIR)/bin/sembump)
PLATFORM = $(shell echo $(UNAME_S) | tr A-Z a-z)
sembump: # Download sembump locally if necessary
@echo "+ $@"
ifndef HAS_SEMBUMP
@ -448,7 +456,6 @@ endef
.PHONY: operator-sdk
HAS_OPERATOR_SDK := $(shell which $(PROJECT_DIR)/bin/operator-sdk)
PLATFORM = $(shell echo $(UNAME_S) | tr A-Z a-z)
operator-sdk: # Download operator-sdk locally if necessary
@echo "+ $@"
ifndef HAS_OPERATOR_SDK

View File

@ -2,9 +2,9 @@ KUBERNETES_PROVIDER=minikube
MINIKUBE_KUBERNETES_VERSION=v1.17.4
MINIKUBE_DRIVER=virtualbox
MINIKUBE_VERSION=1.4.0
MINIKUBE_VERSION=1.17.1
KUBECTL_CONTEXT=minikube
JENKINS_API_HOSTNAME_COMMAND=minikube ip
JENKINS_API_HOSTNAME_COMMAND=bin/minikube ip
JENKINS_API_PORT=0
JENKINS_API_USE_NODEPORT=true

View File

@ -1,168 +0,0 @@
---
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
- serviceaccounts
verbs:
- get
- create
- update
- list
- watch
- apiGroups:
- apps
resources:
- deployments
- daemonsets
- replicasets
- statefulsets
verbs:
- '*'
- apiGroups:
- rbac.authorization.k8s.io
resources:
- roles
- rolebindings
verbs:
- create
- update
- list
- watch
- apiGroups:
- ""
resources:
- pods/portforward
verbs:
- create
- apiGroups:
- ""
resources:
- pods/log
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- pods
- pods/exec
verbs:
- "*"
- apiGroups:
- ""
resources:
- events
verbs:
- watch
- 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
- apiGroups:
- "route.openshift.io"
resources:
- routes
verbs:
- get
- list
- watch
- create
- update
- apiGroups:
- "image.openshift.io"
resources:
- imagestreams
verbs:
- get
- list
- watch
- apiGroups:
- "build.openshift.io"
resources:
- builds
- buildconfigs
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.5.0
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"

File diff suppressed because it is too large Load Diff

View File

@ -1,85 +0,0 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: jenkinsimages.jenkins.io
spec:
group: jenkins.io
names:
kind: JenkinsImage
listKind: JenkinsImageList
plural: jenkinsimages
singular: jenkinsimage
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: JenkinsImage is the Schema for the jenkinsimages API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: JenkinsImageSpec defines the desired state of JenkinsImage
properties:
image:
description: Defines Jenkins Plugin structure
properties:
name:
type: string
version:
type: string
required:
- name
type: object
plugins:
items:
description: Defines Jenkins Plugin structure
properties:
name:
type: string
version:
type: string
required:
- name
type: object
type: array
required:
- image
- plugins
type: object
status:
description: JenkinsImageStatus defines the observed state of JenkinsImage
properties:
image:
type: string
installedPlugins:
items:
description: Defines Jenkins Plugin structure
properties:
name:
type: string
version:
type: string
required:
- name
type: object
type: array
md5sum:
type: string
type: object
type: object
version: v1alpha2
versions:
- name: v1alpha2
served: true
storage: true

View File

@ -1,15 +0,0 @@
apiVersion: jenkins.io/v1alpha2
kind: Jenkins
metadata:
name: example
spec:
master:
containers:
- name: jenkins-master
image: jenkins/jenkins:2.263.2-lts-alpine
seedJobs:
- id: jenkins-operator
targets: "cicd/jobs/*.jenkins"
description: "Jenkins Operator repository"
repositoryBranch: master
repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git

View File

@ -1,106 +0,0 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: jenkins.jenkins.io
spec:
group: jenkins.io
names:
kind: Jenkins
listKind: JenkinsList
plural: jenkins
singular: jenkins
scope: Namespaced
versions:
- name : v1alpha2
served: true
storage: true
- name : v1alpha1
served: true
storage: false
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: jenkinsimages.jenkins.io
spec:
group: jenkins.io
names:
kind: JenkinsImage
listKind: JenkinsImageList
plural: jenkinsimages
singular: jenkinsimage
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: JenkinsImage is the Schema for the jenkinsimages API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: JenkinsImageSpec defines the desired state of JenkinsImage
properties:
image:
description: Defines Jenkins Plugin structure
properties:
name:
type: string
version:
type: string
required:
- name
type: object
plugins:
items:
description: Defines Jenkins Plugin structure
properties:
name:
type: string
version:
type: string
required:
- name
type: object
type: array
required:
- image
- plugins
type: object
status:
description: JenkinsImageStatus defines the observed state of JenkinsImage
properties:
image:
type: string
installedPlugins:
items:
description: Defines Jenkins Plugin structure
properties:
name:
type: string
version:
type: string
required:
- name
type: object
type: array
md5sum:
type: string
type: object
type: object
version: v1alpha2
versions:
- name: v1alpha2
served: true
storage: true

View File

@ -1,24 +0,0 @@
apiVersion: jenkins.io/v1alpha2
kind: JenkinsImage
metadata:
name: simple-jenkinsimage
spec:
image:
name: jenkins/jenkins
tag: 2.263.1-lts-alpine
plugins:
- name: kubernetes
version: "1.28.6"
- name: workflow-job
version: "2.40"
- name: workflow-aggregator
version: "2.6"
- name: git
version: "4.5.0"
- name: job-dsl
version: "1.77"
- name: configuration-as-code
version: "1.46"
- name: kubernetes-credentials-provider
version: "0.15"

View File

@ -1,85 +0,0 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: jenkinsimages.jenkins.io
spec:
group: jenkins.io
names:
kind: JenkinsImage
listKind: JenkinsImageList
plural: jenkinsimages
singular: jenkinsimage
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: JenkinsImage is the Schema for the jenkinsimages API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: JenkinsImageSpec defines the desired state of JenkinsImage
properties:
image:
description: Defines Jenkins Plugin structure
properties:
name:
type: string
version:
type: string
required:
- name
type: object
plugins:
items:
description: Defines Jenkins Plugin structure
properties:
name:
type: string
version:
type: string
required:
- name
type: object
type: array
required:
- image
- plugins
type: object
status:
description: JenkinsImageStatus defines the observed state of JenkinsImage
properties:
image:
type: string
installedPlugins:
items:
description: Defines Jenkins Plugin structure
properties:
name:
type: string
version:
type: string
required:
- name
type: object
type: array
md5sum:
type: string
type: object
type: object
version: v1alpha2
versions:
- name: v1alpha2
served: true
storage: true

View File

@ -1,73 +0,0 @@
apiVersion: jenkins.io/v1alpha2
kind: Jenkins
metadata:
annotations:
jenkins.io/openshift-mode: 'true'
name: jenkins
spec:
master:
containers:
- name: jenkins-master
command:
- /usr/bin/go-init
- '-main'
- /usr/libexec/s2i/run
env:
- name: OPENSHIFT_ENABLE_OAUTH
value: 'true'
- name: OPENSHIFT_ENABLE_REDIRECT_PROMPT
value: 'true'
- name: DISABLE_ADMINISTRATIVE_MONITORS
value: 'false'
- name: KUBERNETES_MASTER
value: 'https://kubernetes.default:443'
- name: KUBERNETES_TRUST_CERTIFICATES
value: 'true'
- name: JENKINS_SERVICE_NAME
value: jenkins-operator-http-jenkins
- name: JNLP_SERVICE_NAME
value: jenkins-operator-slave-jenkins
- name: JENKINS_UC_INSECURE
value: 'false'
- name: JENKINS_HOME
value: /var/lib/jenkins
- name: JAVA_OPTS
value: >-
-XX:+UnlockExperimentalVMOptions -XX:+UnlockExperimentalVMOptions
-XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1
-Djenkins.install.runSetupWizard=false -Djava.awt.headless=true
image: 'quay.io/openshift/origin-jenkins:latest'
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /login
port: 8080
scheme: HTTP
initialDelaySeconds: 420
periodSeconds: 360
timeoutSeconds: 240
readinessProbe:
httpGet:
path: /login
port: 8080
scheme: HTTP
initialDelaySeconds: 3
periodSeconds: 0
timeoutSeconds: 240
resources:
limits:
cpu: 600m
memory: 4Gi
requests:
cpu: 500m
memory: 3Gi
service:
port: 8080
type: ClusterIP
slaveService:
port: 50000
type: ClusterIP
serviceAccount:
annotations:
serviceaccounts.openshift.io/oauth-redirectreference.jenkins: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"jenkins-operator"}}'

View File

@ -1,20 +0,0 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: jenkins.jenkins.io
spec:
group: jenkins.io
names:
kind: Jenkins
listKind: JenkinsList
plural: jenkins
singular: jenkins
scope: Namespaced
version: v1alpha2
versions:
- name : v1alpha2
served: true
storage: true
- name : v1alpha1
served: true
storage: false

View File

@ -1,20 +0,0 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: jenkins.jenkins.io
spec:
group: jenkins.io
names:
kind: Jenkins
listKind: JenkinsList
plural: jenkins
singular: jenkins
scope: Namespaced
version: v1alpha2
versions:
- name : v1alpha2
served: true
storage: true
- name : v1alpha1
served: true
storage: false

View File

@ -1,5 +0,0 @@
channels:
- currentCSV: jenkins-operator.v0.3.0
name: alpha
defaultChannel: alpha
packageName: jenkins-operator

View File

@ -1,34 +0,0 @@
---
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.5.0
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"

View File

@ -1,117 +0,0 @@
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: jenkins-operator
rules:
- apiGroups:
- ""
resources:
- services
- configmaps
- secrets
- serviceaccounts
verbs:
- get
- create
- update
- list
- watch
- apiGroups:
- apps
resources:
- deployments
- daemonsets
- replicasets
- statefulsets
verbs:
- '*'
- apiGroups:
- rbac.authorization.k8s.io
resources:
- roles
- rolebindings
verbs:
- create
- update
- list
- watch
- apiGroups:
- ""
resources:
- pods/portforward
verbs:
- create
- apiGroups:
- ""
resources:
- pods/log
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- pods
- pods/exec
verbs:
- "*"
- apiGroups:
- ""
resources:
- events
verbs:
- watch
- 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
- apiGroups:
- "route.openshift.io"
resources:
- routes
verbs:
- get
- list
- watch
- create
- update
- apiGroups:
- "image.openshift.io"
resources:
- imagestreams
verbs:
- get
- list
- watch
- apiGroups:
- "build.openshift.io"
resources:
- builds
- buildconfigs
verbs:
- get
- list
- watch

View File

@ -1,12 +0,0 @@
---
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

View File

@ -1,5 +0,0 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: jenkins-operator

View File

@ -176,7 +176,7 @@ var _ = Describe("Jenkins controller plugins test", func() {
BeforeEach(func() {
namespace = createNamespace()
jenkins = createJenkinsCRSafe(jenkinsCRName, namespace.Name, &[]v1alpha2.SeedJob{mySeedJob.SeedJob}, groovyScripts, casc, priorityClassName)
jenkins = createJenkinsCR(jenkinsCRName, namespace.Name, &[]v1alpha2.SeedJob{mySeedJob.SeedJob}, groovyScripts, casc, priorityClassName)
})
AfterEach(func() {

View File

@ -80,9 +80,9 @@ func createJenkinsCR(name, namespace string, seedJob *[]v1alpha2.SeedJob, groovy
Scheme: corev1.URISchemeHTTP,
},
},
InitialDelaySeconds: int32(80),
InitialDelaySeconds: int32(100),
TimeoutSeconds: int32(4),
FailureThreshold: int32(10),
FailureThreshold: int32(12),
SuccessThreshold: int32(1),
PeriodSeconds: int32(1),
},
@ -116,7 +116,7 @@ func createJenkinsCR(name, namespace string, seedJob *[]v1alpha2.SeedJob, groovy
{Name: "audit-trail", Version: "3.7"},
{Name: "simple-theme-plugin", Version: "0.6"},
{Name: "github", Version: "1.32.0"},
{Name: "devoptics", Version: "1.1905", DownloadURL: "https://jenkins-updates.cloudbees.com/download/plugins/devoptics/1.1905/devoptics.hpi"},
{Name: "devoptics", Version: "1.1934", DownloadURL: "https://jenkins-updates.cloudbees.com/download/plugins/devoptics/1.1934/devoptics.hpi"},
},
PriorityClassName: priorityClassName,
NodeSelector: map[string]string{"kubernetes.io/os": "linux"},
@ -186,11 +186,11 @@ func createJenkinsCRSafeRestart(name, namespace string, seedJob *[]v1alpha2.Seed
Scheme: corev1.URISchemeHTTP,
},
},
InitialDelaySeconds: int32(80),
InitialDelaySeconds: int32(100),
TimeoutSeconds: int32(4),
FailureThreshold: int32(10),
FailureThreshold: int32(12),
SuccessThreshold: int32(1),
PeriodSeconds: int32(1),
PeriodSeconds: int32(10),
},
LivenessProbe: &corev1.Probe{
Handler: corev1.Handler{
@ -222,7 +222,7 @@ func createJenkinsCRSafeRestart(name, namespace string, seedJob *[]v1alpha2.Seed
{Name: "audit-trail", Version: "3.7"},
{Name: "simple-theme-plugin", Version: "0.6"},
{Name: "github", Version: "1.32.0"},
{Name: "devoptics", Version: "1.1905", DownloadURL: "https://jenkins-updates.cloudbees.com/download/plugins/devoptics/1.1905/devoptics.hpi"},
{Name: "devoptics", Version: "1.1934", DownloadURL: "https://jenkins-updates.cloudbees.com/download/plugins/devoptics/1.1934/devoptics.hpi"},
},
PriorityClassName: priorityClassName,
NodeSelector: map[string]string{"kubernetes.io/os": "linux"},

View File

@ -69,6 +69,7 @@ OPERATOR_ARGS ?= --jenkins-api-hostname=$(JENKINS_API_HOSTNAME) --jenkins-api-po
.DEFAULT_GOAL := help
PLATFORM = $(shell echo $(UNAME_S) | tr A-Z a-z)
##################### FROM OPERATOR SDK ########################
# Default bundle image tag