Skip to content

Commit f9ef15f

Browse files
committed
Add operator lifecycle manager and set configuration back to defaults
Signed-off-by: Ashok Pon Kumar <[email protected]>
1 parent d6a23a5 commit f9ef15f

17 files changed

+408
-59
lines changed

.travis.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ script:
1111

1212
after_success:
1313
- echo "$QUAY_BOT_PASSWORD" | docker login --username "$QUAY_BOT_USERNAME" --password-stdin quay.io
14-
- make cbuild
15-
- make cpush
16-
- docker tag quay.io/konveyor/move2kube-operator:latest quay.io/konveyor/move2kube-operator:$TRAVIS_BRANCH
17-
- docker push quay.io/konveyor/move2kube-operator:$TRAVIS_BRANCH
14+
- make docker-build
15+
- make docker-build
1816

1917
notifications:
2018
email:

Makefile

+11-45
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,8 @@
1-
# Copyright IBM Corporation 2020
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
1+
# Current Operator version
2+
VERSION ?= 0.1.0-alpha
153
REGISTRYNS := quay.io/konveyor
16-
17-
ifdef VERSION
18-
BINARY_VERSION = $(VERSION)
19-
endif
20-
BINARY_VERSION ?= ${GIT_TAG}
21-
ifneq ($(BINARY_VERSION),)
22-
LDFLAGS += -X github.com/konveyor/${BINNAME}/types/info.version=${BINARY_VERSION}
23-
VERSION ?= $(BINARY_VERSION)
24-
endif
25-
VERSION ?= latest
26-
274
# Default bundle image tag
28-
BUNDLE_IMG ?= controller-bundle:$(VERSION)
5+
BUNDLE_IMG ?= ${REGISTRYNS}/move2kube-bundle:$(VERSION)
296
# Options for 'bundle-build'
307
ifneq ($(origin CHANNELS), undefined)
318
BUNDLE_CHANNELS := --channels=$(CHANNELS)
@@ -35,19 +12,8 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
3512
endif
3613
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
3714

38-
GIT_COMMIT = $(shell git rev-parse HEAD)
39-
GIT_SHA = $(shell git rev-parse --short HEAD)
40-
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
41-
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
42-
4315
# Image URL to use all building/pushing image targets
44-
IMG ?= move2kube-operator
45-
46-
# HELP
47-
# This will output the help for each task
48-
.PHONY: help
49-
help: ## This help.
50-
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
16+
IMG ?= ${REGISTRYNS}/move2kube-operator:latest
5117

5218
all: docker-build
5319

@@ -65,20 +31,20 @@ uninstall: kustomize
6531

6632
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
6733
deploy: kustomize
68-
cd config/manager && $(KUSTOMIZE) edit set image controller=${REGISTRYNS}/${IMG}:${VERSION}
34+
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
6935
$(KUSTOMIZE) build config/default | kubectl apply -f -
7036

7137
# Undeploy controller in the configured Kubernetes cluster in ~/.kube/config
7238
undeploy: kustomize
7339
$(KUSTOMIZE) build config/default | kubectl delete -f -
7440

75-
cbuild: # Build the docker image
76-
@docker build -t ${REGISTRYNS}/${IMG}:${VERSION} -t ${REGISTRYNS}/${IMG}:latest .
41+
# Build the docker image
42+
docker-build:
43+
docker build . -t ${IMG}
7744

7845
# Push the docker image
79-
cpush:
80-
@docker push ${REGISTRYNS}/${BINNAME}:latest
81-
@docker push ${REGISTRYNS}/${BINNAME}:${VERSION}
46+
docker-push:
47+
docker push ${IMG}
8248

8349
PATH := $(PATH):$(PWD)/bin
8450
SHELL := env PATH=$(PATH) /bin/sh
@@ -117,7 +83,7 @@ endif
11783
.PHONY: bundle
11884
bundle: kustomize
11985
operator-sdk generate kustomize manifests -q
120-
cd config/manager && $(KUSTOMIZE) edit set image controller=${REGISTRYNS}/$(IMG):${VERSION}
86+
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
12187
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
12288
operator-sdk bundle validate ./bundle
12389

PROJECT

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ domain: io
22
layout: helm.sdk.operatorframework.io/v1
33
projectName: move2kube-operator
44
resources:
5-
- group: konveyor.openshift
5+
- group: konveyor
66
kind: Move2Kube
77
version: v1alpha1
88
version: 3-alpha

bundle.Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM scratch
2+
3+
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
4+
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
5+
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
6+
LABEL operators.operatorframework.io.bundle.package.v1=move2kube-operator
7+
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
8+
LABEL operators.operatorframework.io.bundle.channel.default.v1=
9+
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.0.1
10+
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
11+
LABEL operators.operatorframework.io.metrics.project_layout=helm.sdk.operatorframework.io/v1
12+
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
13+
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
14+
15+
COPY bundle/manifests /manifests/
16+
COPY bundle/metadata /metadata/
17+
COPY bundle/tests/scorecard /tests/scorecard/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
creationTimestamp: null
5+
name: move2kubes.konveyor.io
6+
spec:
7+
group: konveyor.io
8+
names:
9+
kind: Move2Kube
10+
listKind: Move2KubeList
11+
plural: move2kubes
12+
singular: move2kube
13+
scope: Namespaced
14+
versions:
15+
- name: v1alpha1
16+
schema:
17+
openAPIV3Schema:
18+
description: Move2Kube is the Schema for the move2kubes API
19+
properties:
20+
apiVersion:
21+
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'
22+
type: string
23+
kind:
24+
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'
25+
type: string
26+
metadata:
27+
type: object
28+
spec:
29+
description: Spec defines the desired state of Move2Kube
30+
type: object
31+
x-kubernetes-preserve-unknown-fields: true
32+
status:
33+
description: Status defines the observed state of Move2Kube
34+
type: object
35+
x-kubernetes-preserve-unknown-fields: true
36+
type: object
37+
served: true
38+
storage: true
39+
subresources:
40+
status: {}
41+
status:
42+
acceptedNames:
43+
kind: ""
44+
plural: ""
45+
conditions: null
46+
storedVersions: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: rbac.authorization.k8s.io/v1beta1
2+
kind: ClusterRole
3+
metadata:
4+
creationTimestamp: null
5+
name: move2kube-operator-metrics-reader
6+
rules:
7+
- nonResourceURLs:
8+
- /metrics
9+
verbs:
10+
- get
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
apiVersion: operators.coreos.com/v1alpha1
2+
kind: ClusterServiceVersion
3+
metadata:
4+
annotations:
5+
alm-examples: |-
6+
[
7+
{
8+
"apiVersion": "konveyor.io/v1alpha1",
9+
"kind": "Move2Kube",
10+
"metadata": {
11+
"name": "move2kube-sample"
12+
},
13+
"spec": {
14+
"storageclass": "default",
15+
"storagesize": "1Gi",
16+
"version": "latest"
17+
}
18+
}
19+
]
20+
capabilities: Basic Install
21+
operators.operatorframework.io/builder: operator-sdk-v1.0.1
22+
operators.operatorframework.io/project_layout: helm.sdk.operatorframework.io/v1
23+
name: move2kube-operator.v0.1.0-alpha
24+
namespace: placeholder
25+
spec:
26+
apiservicedefinitions: {}
27+
customresourcedefinitions:
28+
owned:
29+
- kind: Move2Kube
30+
name: move2kubes.konveyor.io
31+
version: v1alpha1
32+
description: Move2Kube accelerates the process of re-platforming to Kubernetes/Openshift.
33+
displayName: Konveyor Move2Kube Operator
34+
icon:
35+
- base64data: ""
36+
mediatype: ""
37+
install:
38+
spec:
39+
clusterPermissions:
40+
- rules:
41+
- apiGroups:
42+
- ""
43+
resources:
44+
- namespaces
45+
verbs:
46+
- get
47+
- apiGroups:
48+
- ""
49+
resources:
50+
- secrets
51+
verbs:
52+
- '*'
53+
- apiGroups:
54+
- ""
55+
resources:
56+
- events
57+
verbs:
58+
- create
59+
- apiGroups:
60+
- konveyor.io
61+
resources:
62+
- move2kubes
63+
- move2kubes/status
64+
verbs:
65+
- create
66+
- delete
67+
- get
68+
- list
69+
- patch
70+
- update
71+
- watch
72+
- apiGroups:
73+
- networking.k8s.io
74+
resources:
75+
- ingresses
76+
verbs:
77+
- '*'
78+
- apiGroups:
79+
- ""
80+
resources:
81+
- persistentvolumeclaims
82+
- serviceaccounts
83+
- services
84+
verbs:
85+
- '*'
86+
- apiGroups:
87+
- apps
88+
resources:
89+
- deployments
90+
- statefulsets
91+
verbs:
92+
- '*'
93+
- apiGroups:
94+
- authentication.k8s.io
95+
resources:
96+
- tokenreviews
97+
verbs:
98+
- create
99+
- apiGroups:
100+
- authorization.k8s.io
101+
resources:
102+
- subjectaccessreviews
103+
verbs:
104+
- create
105+
serviceAccountName: default
106+
deployments:
107+
- name: move2kube-operator-controller-manager
108+
spec:
109+
replicas: 1
110+
selector:
111+
matchLabels:
112+
control-plane: controller-manager
113+
strategy: {}
114+
template:
115+
metadata:
116+
labels:
117+
control-plane: controller-manager
118+
spec:
119+
containers:
120+
- args:
121+
- --secure-listen-address=0.0.0.0:8443
122+
- --upstream=http://127.0.0.1:8080/
123+
- --logtostderr=true
124+
- --v=10
125+
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0
126+
name: kube-rbac-proxy
127+
ports:
128+
- containerPort: 8443
129+
name: https
130+
resources: {}
131+
- args:
132+
- --metrics-addr=127.0.0.1:8080
133+
- --enable-leader-election
134+
- --leader-election-id=move2kube-operator
135+
image: move2kube-operator:latest
136+
name: manager
137+
resources:
138+
limits:
139+
cpu: 100m
140+
memory: 90Mi
141+
requests:
142+
cpu: 100m
143+
memory: 60Mi
144+
terminationGracePeriodSeconds: 10
145+
permissions:
146+
- rules:
147+
- apiGroups:
148+
- ""
149+
resources:
150+
- configmaps
151+
verbs:
152+
- get
153+
- list
154+
- watch
155+
- create
156+
- update
157+
- patch
158+
- delete
159+
- apiGroups:
160+
- ""
161+
resources:
162+
- events
163+
verbs:
164+
- create
165+
- patch
166+
serviceAccountName: default
167+
strategy: deployment
168+
installModes:
169+
- supported: false
170+
type: OwnNamespace
171+
- supported: false
172+
type: SingleNamespace
173+
- supported: false
174+
type: MultiNamespace
175+
- supported: true
176+
type: AllNamespaces
177+
keywords:
178+
- ibm-research
179+
- replatform
180+
- kubernetes
181+
- openshift
182+
- modernization
183+
links:
184+
- name: Move2kube Operator
185+
url: https://move2kube-operator.domain
186+
maintainers:
187+
188+
name: '"Ashok Pon Kumar'
189+
maturity: alpha
190+
provider:
191+
name: RedHat
192+
url: https://github.com/konveyor/move2kube
193+
version: 0.1.0-alpha

bundle/metadata/annotations.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
annotations:
2+
operators.operatorframework.io.bundle.channel.default.v1: ""
3+
operators.operatorframework.io.bundle.channels.v1: alpha
4+
operators.operatorframework.io.bundle.manifests.v1: manifests/
5+
operators.operatorframework.io.bundle.mediatype.v1: registry+v1
6+
operators.operatorframework.io.bundle.metadata.v1: metadata/
7+
operators.operatorframework.io.bundle.package.v1: move2kube-operator
8+
operators.operatorframework.io.metrics.builder: operator-sdk-v1.0.1
9+
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
10+
operators.operatorframework.io.metrics.project_layout: helm.sdk.operatorframework.io/v1
11+
operators.operatorframework.io.test.config.v1: tests/scorecard/
12+
operators.operatorframework.io.test.mediatype.v1: scorecard+v1

0 commit comments

Comments
 (0)