Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRVLOGIC-474 - Add osl-operator-bundle-image #39

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/osl-operator-bundle-image/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
generated/config
generated/hack
generated/bundle/manifests/logic-operator-rhel8.clusterserviceversion.yaml
generated/Makefile
generated/PROJECT
generated/bundle/README.md
generated/bundle.Dockerfile

26 changes: 26 additions & 0 deletions packages/osl-operator-bundle-image/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# OSL Operator Bundle Image

This bundle package inherits the ENV variables from `sonataflow-operator` package. Meaning that you must export that vars in order to build the bundle image since the registry, tag, and version are the same from the operator with the `-bundle` prefix in the name:

```shell
# REQUIRED ENV:
export KIE_TOOLS_BUILD__buildContainerImages=true

# OPTIONAL ENVs:
# Image name/tag information. This information is optional, this package has these set by default.
export OSL_OPERATOR_BUNDLE_IMAGE__registry=registry.access.redhat.com
export OSL_OPERATOR_BUNDLE_IMAGE__account=openshift-serverless-1
export OSL_OPERATOR_BUNDLE_IMAGE__name=logic-operator-bundle
# This version is also optional since once branched, we can update the `root-env` package env `KIE_TOOLS_BUILD__streamName` to the OSL version.
export OSL_OPERATOR_BUNDLE_IMAGE__buildTag=1.35

# Platform images
# TODO - Upstream first to fulfill the docker files, configuration and anywhere else requiring images. Then we reuse it here.

# Quarkus/Kogito version. This information will be set in the image labels and internal builds in `root-env`.
# Optionally you can also use Cekit overrides when building the final image in the internal systems.
export QUARKUS_PLATFORM_version=3.8.6
export KOGITO_RUNTIME_version=9.101-redhat

pnpm build:dev # build:prod also works, does the same currently.
```
79 changes: 79 additions & 0 deletions packages/osl-operator-bundle-image/env/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

const { varsWithName, composeEnv, getOrDefault } = require("@kie-tools-scripts/build-env");
const rootEnv = require("@kie-tools/root-env/env");
const redHatEnv = require("@osl/redhat-env/env");
//const sonataflowOperatorEnv = require("@kie-tools/sonataflow-operator/env");

// We need sonataflowOperatorEnv 'cause the operator's Makefile refers to it

module.exports = composeEnv([rootEnv, redHatEnv], {
vars: varsWithName({
OSL_OPERATOR_BUNDLE_IMAGE__registry: {
default: "registry.redhat.io",
description: "The image registry.",
},
OSL_OPERATOR_BUNDLE_IMAGE__account: {
default: "openshift-serverless-1",
description: "The image registry account.",
},
OSL_OPERATOR_BUNDLE_IMAGE__name: {
default: "logic-operator-bundle",
description: "The image name.",
},
OSL_OPERATOR_BUNDLE_IMAGE__buildTag: {
default: rootEnv.env.root.streamName,
description: "The image tag.",
},
OSL_OPERATOR_IMAGE__registry: {
default: "registry.redhat.io",
description: "The image registry.",
},
OSL_OPERATOR_IMAGE__account: {
default: "openshift-serverless-1",
description: "The image registry account.",
},
OSL_OPERATOR_IMAGE__name: {
default: "logic-rhel8-operator",
description: "The image name.",
},
OSL_OPERATOR_IMAGE__buildTag: {
default: rootEnv.env.root.streamName,
description: "The image tag.",
},
}),
get env() {
return {
oslOperatorBundleImage: {
registry: getOrDefault(this.vars.OSL_OPERATOR_BUNDLE_IMAGE__registry),
account: getOrDefault(this.vars.OSL_OPERATOR_BUNDLE_IMAGE__account),
name: getOrDefault(this.vars.OSL_OPERATOR_BUNDLE_IMAGE__name),
buildTag: getOrDefault(this.vars.OSL_OPERATOR_BUNDLE_IMAGE__buildTag),
version: require("../package.json").version,
operator: {
registry: getOrDefault(this.vars.OSL_OPERATOR_IMAGE__registry),
account: getOrDefault(this.vars.OSL_OPERATOR_IMAGE__account),
name: getOrDefault(this.vars.OSL_OPERATOR_IMAGE__name),
buildTag: getOrDefault(this.vars.OSL_OPERATOR_IMAGE__buildTag),
},
},
};
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: v1
data:
DEFAULT_WORKFLOW_EXTENSION: .sw.json
Dockerfile: "# Licensed to the Apache Software Foundation (ASF) under one\n# or
more contributor license agreements. See the NOTICE file\n# distributed with
this work for additional information\n# regarding copyright ownership. The ASF
licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\");
you may not use this file except in compliance\n# with the License. You may obtain
a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n#
Unless required by applicable law or agreed to in writing,\n# software distributed
under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for
the\n# specific language governing permissions and limitations\n# under the License.\n\nFROM
docker.io/apache/incubator-kie-sonataflow-builder:main AS builder\n\n# variables
that can be overridden by the builder\n# To add a Quarkus extension to your application\nARG
QUARKUS_EXTENSIONS\n# Args to pass to the Quarkus CLI add extension command\nARG
QUARKUS_ADD_EXTENSION_ARGS\n# Additional java/mvn arguments to pass to the builder\nARG
MAVEN_ARGS_APPEND\n\n# Copy from build context to skeleton resources project\nCOPY
--chown=1001 . ./resources\n\nRUN /home/kogito/launch/build-app.sh ./resources\n
\ \n#=============================\n# Runtime Run\n#=============================\nFROM
registry.access.redhat.com/ubi9/openjdk-17-runtime:latest\n\nENV LANG='en_US.UTF-8'
LANGUAGE='en_US:en'\n \n# We make four distinct layers so if there are application
changes the library layers can be re-used\nCOPY --from=builder --chown=185 /home/kogito/serverless-workflow-project/target/quarkus-app/lib/
/deployments/lib/\nCOPY --from=builder --chown=185 /home/kogito/serverless-workflow-project/target/quarkus-app/*.jar
/deployments/\nCOPY --from=builder --chown=185 /home/kogito/serverless-workflow-project/target/quarkus-app/app/
/deployments/app/\nCOPY --from=builder --chown=185 /home/kogito/serverless-workflow-project/target/quarkus-app/quarkus/
/deployments/quarkus/\n\nEXPOSE 8080\nUSER 185\nENV AB_JOLOKIA_OFF=\"\"\nENV JAVA_OPTS=\"-Dquarkus.http.host=0.0.0.0
-Djava.util.logging.manager=org.jboss.logmanager.LogManager\"\nENV JAVA_APP_JAR=\"/deployments/quarkus-run.jar\"\n"
kind: ConfigMap
metadata:
name: logic-operator-rhel8-builder-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
control-plane: sonataflow-operator
name: logic-operator-rhel8-controller-manager-metrics-service
spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: sonataflow-operator
status:
loadBalancer: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: v1
data:
controllers_cfg.yaml: |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# The default size of Kaniko PVC when using the internal operator builder manager
defaultPvcKanikoSize: 1Gi
# How much time (in seconds) to wait for a devmode workflow to start.
# This information is used for the controller manager to create new devmode containers and setup the healthcheck probes.
healthFailureThresholdDevMode: 50
# Default image used internally by the Operator Managed Kaniko builder to create the warmup pods
kanikoDefaultWarmerImageTag: gcr.io/kaniko-project/warmer:v1.9.0
# Default image used internally by the Operator Managed Kaniko builder to create the executor pods
kanikoExecutorImageTag: gcr.io/kaniko-project/executor:v1.9.0
# The Jobs Service image to use, if empty the operator will use the default Apache Community one based on the current operator's version
jobsServicePostgreSQLImageTag: "docker.io/apache/incubator-kie-kogito-jobs-service-postgresql:main"
jobsServiceEphemeralImageTag: "docker.io/apache/incubator-kie-kogito-jobs-service-ephemeral:main"
# The Data Index image to use, if empty the operator will use the default Apache Community one based on the current operator's version
dataIndexPostgreSQLImageTag: "docker.io/apache/incubator-kie-kogito-data-index-postgresql:main"
dataIndexEphemeralImageTag: "docker.io/apache/incubator-kie-kogito-data-index-ephemeral:main"
# SonataFlow base builder image used in the internal Dockerfile to build workflow applications in preview profile
# Order of precedence is:
# 1. SonataFlowPlatform in the given namespace
# 2. This configuration
# 3. The FROM in the Dockerfile in the operator's namespace "sonataflow-operator-builder-config" configMap.
# If 1 or 2, the FROM tag will be replaced by the tag se there.
# If empty the operator will use the default Apache Community one based on the current operator's version.
sonataFlowBaseBuilderImageTag: "docker.io/apache/incubator-kie-sonataflow-builder:main"
# The image to use to deploy SonataFlow workflow images in devmode profile.
# If empty the operator will use the default Apache Community one based on the current operator's version.
sonataFlowDevModeImageTag: "docker.io/apache/incubator-kie-sonataflow-devmode:main"
# The default name of the builder configMap in the operator's namespace
builderConfigMapName: "sonataflow-operator-builder-config"
# Quarkus extensions required for workflows persistence. These extensions are used by the SonataFlow build system,
# in cases where the workflow being built has configured postgresql persistence.
postgreSQLPersistenceExtensions:
- groupId: io.quarkus
artifactId: quarkus-jdbc-postgresql
version: 3.8.6
- groupId: io.quarkus
artifactId: quarkus-agroal
version: 3.8.6
- groupId: org.kie
artifactId: kie-addons-quarkus-persistence-jdbc
version: 999-20241016-SNAPSHOT
# If true, the workflow deployments will be configured to send accumulated workflow status change events to the Data
# Index Service reducing the number of produced events. Set to false to send individual events.
kogitoEventsGrouping: true
# If true, the accumulated workflow status change events will be sent in binary mode. (reduces the evens size)
kogitoEventsGroupingBinary: true
# If true, the accumulated workflow status change events, when sent in binary mode, will be gzipped at the cost of
# some performance.
kogitoEventsGroupingCompress: false
kind: ConfigMap
metadata:
name: logic-operator-rhel8-controllers-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: logic-operator-rhel8-metrics-reader
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
Loading
Loading