Skip to content

Commit d13e39c

Browse files
authored
Oracle Database Operator 2.0 Release (#198)
Oracle Database Operator Release 2.0
1 parent 6fa98e6 commit d13e39c

File tree

562 files changed

+67698
-42601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

562 files changed

+67698
-42601
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
operator.tgz
22
cover.out
33
bin
4+
bin/*
45
testbin/*
56
onpremtest/*
67
ords/*zip
@@ -10,4 +11,4 @@ ords/*zip
1011
.DS_Store
1112
# development
1213
.idea
13-
.local
14+
.local

.gitlab-ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
build-operator:
2+
stage: build
3+
variables:
4+
IMAGE: "$DOCKER_REPO:$CI_COMMIT_SHORT_SHA"
5+
OP_YAML: oracle-database-operator.yaml
6+
BUILD_INTERNAL: "true"
7+
script:
8+
- export GOLANG_VERSION=1.25.1
9+
- export GOROOT=$(go${GOLANG_VERSION} env GOROOT)
10+
- export PATH="${GOROOT}/bin:${PATH}"
11+
- make operator-yaml IMG=$IMAGE GOLANG_VERSION=$GOLANG_VERSION
12+
- if [ "$CI_COMMIT_BRANCH" = "master" ]; then
13+
podman run --rm --privileged multiarch/qemu-user-static --reset -p yes;
14+
make image-build image-push IMG="$IMAGE" BUILD_MANIFEST=true GOLANG_VERSION=$GOLANG_VERSION;
15+
podman manifest rm "$IMAGE";
16+
else
17+
make image-build image-push IMG="$IMAGE" GOLANG_VERSION=$GOLANG_VERSION;
18+
podman rmi "$IMAGE";
19+
sed -i "s/\(replicas.\) 3/\1 1/g" ./$OP_YAML;
20+
fi
21+
- buildah containers -q | xargs -n1 buildah rm || true
22+
- podman system prune -f
23+
- curl -s --netrc-file $HOME/.netrc_gitlab $ARTIFACTORY_REPO/$CI_COMMIT_BRANCH/$OP_YAML -T ./$OP_YAML
24+
only:
25+
variables:
26+
- $CI_COMMIT_MESSAGE =~ /\#run-pipeline/
27+
- $CI_COMMIT_BRANCH =~ /master/
28+
- $CI_MERGE_REQUEST_ID != ""
29+
except:
30+
variables:
31+
- $CI_COMMIT_MESSAGE =~ /\#skip-pipeline/
32+
- $CI_COMMIT_TAG != null
33+
34+
cleanup:
35+
stage: .post
36+
script:
37+
- echo "Clean up downloaded binaries"
38+
- rm -rf bin/

Dockerfile

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
#
44

55
# Build the manager binary
6-
ARG BUILDER_IMG
7-
FROM ${BUILDER_IMG} as builder
6+
ARG BUILDER_IMG="oraclelinux:9"
7+
ARG RUNNER_IMG="oraclelinux:9-slim"
8+
FROM ${BUILDER_IMG} AS builder
89

910
ARG TARGETARCH
1011
# Download golang if INSTALL_GO is set to true
@@ -18,35 +19,49 @@ RUN if [ "$INSTALL_GO" = "true" ]; then \
1819
echo "Go Arch: $(/usr/local/go/bin/go env GOARCH)"; \
1920
fi
2021
ENV PATH=${GOLANG_VERSION:+"${PATH}:/usr/local/go/bin"}
22+
ENV GOCACHE=/go-cache
23+
ENV GOMODCACHE=/gomod-cache
2124

2225
WORKDIR /workspace
2326
# Copy the Go Modules manifests
2427
COPY go.mod go.mod
2528
COPY go.sum go.sum
26-
# cache deps before building and copying source so that we don't need to re-download as much
27-
# and so that source changes don't invalidate our downloaded layer
28-
RUN go mod download
2929

3030
# Copy the go source
31+
COPY LICENSE.txt LICENSE.txt
32+
COPY THIRD_PARTY_LICENSES_DOCKER.txt THIRD_PARTY_LICENSES_DOCKER.txt
3133
COPY main.go main.go
3234
COPY apis/ apis/
33-
COPY controllers/ controllers/
3435
COPY commons/ commons/
35-
COPY LICENSE.txt LICENSE.txt
36-
COPY THIRD_PARTY_LICENSES_DOCKER.txt THIRD_PARTY_LICENSES_DOCKER.txt
36+
COPY controllers/ controllers/
3737

3838
# Build
39-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -a -o manager main.go
39+
RUN --mount=type=cache,target=/go-cache --mount=type=cache,target=/gomod-cache CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -o manager main.go
4040

41-
# Use oraclelinux:9 as base image to package the manager binary
42-
FROM oraclelinux:9
41+
# Use oraclelinux:9-slim as default base image to package the manager binary
42+
FROM ${RUNNER_IMG}
43+
# Labels
44+
# ------
45+
LABEL "provider"="Oracle" \
46+
"issues"="https://github.com/oracle/oracle-database-operator/issues" \
47+
48+
"version"="2.0" \
49+
"description"="DB Operator Image V2.0" \
50+
"vendor"="Oracle Coporation" \
51+
"release"="2.0" \
52+
"summary"="Oracle Database Operator 2.0" \
53+
"name"="oracle-database-operator.v2.0"
4354
ARG CI_COMMIT_SHA
4455
ARG CI_COMMIT_BRANCH
4556
ENV COMMIT_SHA=${CI_COMMIT_SHA} \
4657
COMMIT_BRANCH=${CI_COMMIT_BRANCH}
4758
WORKDIR /
4859
COPY --from=builder /workspace/manager .
4960
COPY ords/ords_init.sh .
61+
COPY ords/ords_start.sh .
62+
COPY LICENSE.txt /licenses/
63+
COPY THIRD_PARTY_LICENSES_DOCKER.txt /licenses/
64+
COPY THIRD_PARTY_LICENSES.txt /licenses/
5065
RUN useradd -u 1002 nonroot
5166
USER nonroot
5267

Makefile

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55

66
# Current Operator version
7-
VERSION ?= 0.0.1
7+
VERSION ?= 2.0
88
# Default bundle image tag
99
BUNDLE_IMG ?= controller-bundle:$(VERSION)
1010
# Options for 'bundle-build'
@@ -23,7 +23,7 @@ IMG ?= controller:latest
2323
# https://github.com/kubernetes-sigs/kubebuilder/issues/1140
2424
CRD_OPTIONS ?= "crd:maxDescLen=0,allowDangerousTypes=true"
2525
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
26-
ENVTEST_K8S_VERSION = 1.29.0
26+
ENVTEST_K8S_VERSION = 1.31.0
2727
# Operator YAML file
2828
OPERATOR_YAML=$$(basename $$(pwd)).yaml
2929
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
@@ -70,12 +70,14 @@ build: generate fmt vet ## Build manager binary.
7070
run: manifests generate fmt vet ## Run a controller from your host.
7171
go run ./main.go
7272

73-
GOLANG_VERSION ?= 1.23.3
73+
GOLANG_VERSION ?= 1.25.1
74+
DOCKER ?= podman
7475
## Download golang in the Dockerfile if BUILD_INTERNAL is set to true.
7576
## Otherwise, use golang image from docker hub as the builder.
7677
ifeq ($(BUILD_INTERNAL), true)
7778
BUILDER_IMG = oraclelinux:9
7879
BUILD_ARGS = --build-arg BUILDER_IMG=$(BUILDER_IMG) --build-arg GOLANG_VERSION=$(GOLANG_VERSION) --build-arg INSTALL_GO=true
80+
DOCKER = podman
7981
else
8082
BUILDER_IMG = golang:$(GOLANG_VERSION)
8183
BUILD_ARGS = --build-arg BUILDER_IMG=$(BUILDER_IMG) --build-arg INSTALL_GO="false" --build-arg GOLANG_VERSION=$(GOLANG_VERSION)
@@ -86,18 +88,18 @@ PUSH_ARGS := manifest
8688
else
8789
BUILD_ARGS := $(BUILD_ARGS) --platform=linux/amd64 --tag
8890
endif
89-
docker-build: #manifests generate fmt vet #test ## Build docker image with the manager. Disable the test but keep the validations to fail fast
90-
docker build --no-cache=true --build-arg http_proxy=$(HTTP_PROXY) --build-arg https_proxy=$(HTTPS_PROXY) \
91+
image-build: #manifests generate fmt vet #test ## Build docker image with the manager. Disable the test but keep the validations to fail fast
92+
$(DOCKER) build --build-arg http_proxy=$(HTTP_PROXY) --build-arg https_proxy=$(HTTPS_PROXY) \
9193
--build-arg CI_COMMIT_SHA=$(CI_COMMIT_SHA) --build-arg CI_COMMIT_BRANCH=$(CI_COMMIT_BRANCH) \
9294
$(BUILD_ARGS) $(IMG) .
93-
94-
docker-push: ## Push docker image with the manager.
95-
docker $(PUSH_ARGS) push $(IMG)
95+
96+
image-push: ## Push docker image with the manager.
97+
$(DOCKER) $(PUSH_ARGS) push $(IMG)
9698

9799
# Push to minikube's local registry enabled by registry add-on
98100
minikube-push:
99-
docker tag $(IMG) $$(minikube ip):5000/$(IMG)
100-
docker push --tls-verify=false $$(minikube ip):5000/$(IMG)
101+
$(DOCKER) tag $(IMG) $$(minikube ip):5000/$(IMG)
102+
$(DOCKER) push --tls-verify=false $$(minikube ip):5000/$(IMG)
101103

102104
##@ Deployment
103105

@@ -123,7 +125,6 @@ operator-yaml: manifests kustomize
123125
(echo --- && sed '/^apiVersion: apps\/v1/,/---/!d' "$(OPERATOR_YAML).bak") >> "$(OPERATOR_YAML)"
124126
rm "$(OPERATOR_YAML).bak"
125127

126-
minikube-operator-yaml: IMG:=localhost:5000/$(IMG)
127128
minikube-operator-yaml: operator-yaml
128129
sed -i.bak 's/\(replicas.\) 3/\1 1/g' "$(OPERATOR_YAML)"
129130
rm "$(OPERATOR_YAML).bak"
@@ -144,8 +145,8 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
144145
ENVTEST ?= $(LOCALBIN)/setup-envtest
145146

146147
## Tool Versions
147-
KUSTOMIZE_VERSION ?= v5.3.0
148-
CONTROLLER_TOOLS_VERSION ?= v0.16.5
148+
KUSTOMIZE_VERSION ?= v5.7.1
149+
CONTROLLER_TOOLS_VERSION ?= v0.17
149150

150151
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
151152
.PHONY: kustomize
@@ -173,11 +174,11 @@ bundle: manifests kustomize ## Generate bundle manifests and metadata, then vali
173174

174175
.PHONY: bundle-build
175176
bundle-build: ## Build the bundle image.
176-
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
177+
$(DOCKER) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
177178

178179
.PHONY: bundle-push
179180
bundle-push: ## Push the bundle image.
180-
$(MAKE) docker-push IMG=$(BUNDLE_IMG)
181+
$(MAKE) image-push IMG=$(BUNDLE_IMG)
181182

182183
.PHONY: opm
183184
OPM = ./bin/opm
@@ -218,4 +219,4 @@ catalog-build: opm ## Build a catalog image.
218219
# Push the catalog image.
219220
.PHONY: catalog-push
220221
catalog-push: ## Push a catalog image.
221-
$(MAKE) docker-push IMG=$(CATALOG_IMG)
222+
$(MAKE) image-push IMG=$(CATALOG_IMG)

PROJECT

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# More info: https://book.kubebuilder.io/reference/project-config.html
55
domain: oracle.com
66
layout:
7-
- go.kubebuilder.io/v2
7+
- go.kubebuilder.io/v4
88
multigroup: true
99
plugins:
1010
manifests.sdk.operatorframework.io/v2: {}
@@ -259,4 +259,30 @@ resources:
259259
webhooks:
260260
conversion: true
261261
webhookVersion: v1beta1
262+
- api:
263+
crdVersion: v1
264+
namespaced: true
265+
controller: true
266+
domain: oracle.com
267+
group: omlai
268+
kind: PrivateAi
269+
path: github.com/oracle/oracle-database-operator/api/omlai/v4
270+
version: v4
271+
webhooks:
272+
defaulting: true
273+
validation: true
274+
webhookVersion: v1
275+
- api:
276+
crdVersion: v1
277+
namespaced: true
278+
controller: true
279+
domain: oracle.com
280+
group: database
281+
kind: OracleRestart
282+
path: github.com/oracle/oracle-database-operator/api/database/v4
283+
version: v4
284+
webhooks:
285+
defaulting: true
286+
validation: true
287+
webhookVersion: v1
262288
version: "3"

0 commit comments

Comments
 (0)