Skip to content

Commit

Permalink
Merge pull request #63 from rgdoliveira/sync_main
Browse files Browse the repository at this point in the history
Sync main branch with Apache main branch
  • Loading branch information
rgdoliveira authored Jul 8, 2024
2 parents 67881b6 + 1fb0557 commit 0fdd9d6
Show file tree
Hide file tree
Showing 45 changed files with 216 additions and 138 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# kiegroup.org/kogito-serverless-operator-bundle:$VERSION and kiegroup.org/kogito-serverless-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= quay.io/kiegroup/kogito-serverless-operator-nightly
IMAGE_TAG_BASE ?= docker.io/apache/incubator-kie-sonataflow-operator

# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
Expand Down
5 changes: 5 additions & 0 deletions api/metadata/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ func GetProfileOrDefault(annotation map[string]string) ProfileType {
}
}

func (p ProfileType) isValidProfile() bool {
_, ok := supportedProfiles[p]
return ok
}

func IsDevProfile(annotation map[string]string) bool {
if annotation == nil {
return false
Expand Down
16 changes: 16 additions & 0 deletions api/metadata/annotations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,19 @@ func TestGetProfile(t *testing.T) {
})
}
}

func TestIsValidProfile(t *testing.T) {
profiles := []ProfileType{DefaultProfile, GitOpsProfile, DevProfile}
for _, profile := range profiles {
if !profile.isValidProfile() {
t.Errorf("Profile %s is not valid", profile)
}
}
if ProdProfile.isValidProfile() {
t.Errorf("ProdProfile is deprecated and should not be valid")
}
// any random string should not be a valid profile
if ProfileType("random").isValidProfile() {
t.Errorf("random is not a valid profile")
}
}
4 changes: 4 additions & 0 deletions api/v1alpha08/sonataflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ type SonataFlowStatus struct {
// Services displays which platform services are being used by this workflow
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="services"
Services *PlatformServicesStatus `json:"services,omitempty"`
// Platform displays which platform is being used by this workflow
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="platform"
Platform *SonataFlowPlatformRef `json:"platform,omitempty"`
}

func (s *SonataFlowStatus) GetTopLevelConditionType() api.ConditionType {
Expand Down Expand Up @@ -255,6 +258,7 @@ func (s *SonataFlowStatus) IsBuildFailed() bool {
// +operator-sdk:csv:customresourcedefinitions:resources={{Service,v1,"A Service for the Flow"}}
// +operator-sdk:csv:customresourcedefinitions:resources={{Route,route.openshift.io/v1,"An OpenShift Route for the Flow"}}
// +operator-sdk:csv:customresourcedefinitions:resources={{ConfigMap,v1,"The ConfigMaps with Flow definition and additional configuration files"}}
// +operator-sdk:csv:customresourcedefinitions:displayName="SonataFlow"
type SonataFlow struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha08/sonataflowbuild_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func (k *SonataFlowBuildStatus) GetInnerBuild(innerBuild interface{}) error {
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.buildPhase`
// +kubebuilder:resource:shortName={"sfb", "sfbuild", "sfbuilds"}
// +operator-sdk:csv:customresourcedefinitions:resources={{BuildConfig,build.openshift.io/v1,"An Openshift Build Config"}}
// +operator-sdk:csv:customresourcedefinitions:displayName="SonataFlowBuild"
type SonataFlowBuild struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha08/sonataflowclusterplatform_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func (in *SonataFlowClusterPlatformStatus) IsDuplicated() bool {
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=='Succeed')].status`
// +kubebuilder:printcolumn:name="Reason",type=string,JSONPath=`.status.conditions[?(@.type=='Succeed')].reason`
// +operator-sdk:csv:customresourcedefinitions:resources={{SonataFlowPlatform,sonataflow.org/v1alpha08,"A SonataFlow Platform"}}
// +operator-sdk:csv:customresourcedefinitions:displayName="SonataFlowClusterPlatform"
type SonataFlowClusterPlatform struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
3 changes: 2 additions & 1 deletion api/v1alpha08/sonataflowplatform_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ type SonataFlowClusterPlatformRefStatus struct {
Services *PlatformServicesStatus `json:"services,omitempty"`
}

// PlatformServicesStatus displays which cluster-wide services are being used by a SonataFlowPlatform
// PlatformServicesStatus displays which cluster-wide services are being used by a SonataFlowPlatform or SonataFlow
// +k8s:openapi-gen=true
type PlatformServicesStatus struct {
// DataIndexRef displays information on the cluster-wide Data Index service
Expand Down Expand Up @@ -170,6 +170,7 @@ func (in *SonataFlowPlatformStatus) IsFailure() bool {
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=='Succeed')].status`
// +kubebuilder:printcolumn:name="Reason",type=string,JSONPath=`.status.conditions[?(@.type=='Succeed')].reason`
// +operator-sdk:csv:customresourcedefinitions:resources={{Namespace,v1,"The Namespace controlled by the platform"}}
// +operator-sdk:csv:customresourcedefinitions:displayName="SonataFlowPlatform"
type SonataFlowPlatform struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha08/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bddframework/pkg/api/app/v1beta1/kogitoservices.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ type KogitoServiceSpec struct {
Env []corev1.EnvVar `json:"env,omitempty"`

// +optional
// Image definition for the service. Example: "quay.io/kiegroup/kogito-service:latest".
// Image definition for the service. Example: "docker.io/apache/incubator-kie-kogito-service:latest".
//
// On OpenShift an ImageStream will be created in the current namespace pointing to the given image.
// +operator-sdk:csv:customresourcedefinitions:type=spec
Expand Down
2 changes: 1 addition & 1 deletion bddframework/pkg/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func AppendImageDefaultValues(image *api.Image) {
}

if len(image.Tag) == 0 {
image.Tag = GetKogitoImageVersion(version.OperatorVersion)
image.Tag = GetKogitoImageVersion(version.GetTagVersion())
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
apiVersion: v1
data:
DEFAULT_WORKFLOW_EXTENSION: .sw.json
Dockerfile: "FROM quay.io/kiegroup/kogito-swf-builder-nightly:latest AS builder\n\n#
Dockerfile: "FROM 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: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/
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/
Expand Down
15 changes: 9 additions & 6 deletions bundle/manifests/sonataflow-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ metadata:
]
capabilities: Basic Install
categories: Application Runtime
containerImage: quay.io/kiegroup/kogito-serverless-operator-nightly:latest
containerImage: docker.io/apache/incubator-kie-sonataflow-operator:main
description: SonataFlow Kubernetes Operator for deploying workflow applications
based on the CNCF Serverless Workflow specification
operators.operatorframework.io/builder: operator-sdk-v1.25.0
Expand All @@ -135,7 +135,7 @@ spec:
owned:
- description: SonataFlowBuild is an internal custom resource to control workflow
build instances in the target platform
displayName: Sonata Flow Build
displayName: SonataFlowBuild
kind: SonataFlowBuild
name: sonataflowbuilds.sonataflow.org
resources:
Expand Down Expand Up @@ -182,7 +182,7 @@ spec:
version: v1alpha08
- description: SonataFlowClusterPlatform is the Schema for the sonataflowclusterplatforms
API
displayName: Sonata Flow Cluster Platform
displayName: SonataFlowClusterPlatform
kind: SonataFlowClusterPlatform
name: sonataflowclusterplatforms.sonataflow.org
resources:
Expand Down Expand Up @@ -211,7 +211,7 @@ spec:
version: v1alpha08
- description: SonataFlowPlatform is the descriptor for the workflow platform
infrastructure.
displayName: Sonata Flow Platform
displayName: SonataFlowPlatform
kind: SonataFlowPlatform
name: sonataflowplatforms.sonataflow.org
resources:
Expand Down Expand Up @@ -281,7 +281,7 @@ spec:
version: v1alpha08
- description: SonataFlow is the descriptor representation for a workflow application
based on the CNCF Serverless Workflow specification.
displayName: Sonata Flow
displayName: SonataFlow
kind: SonataFlow
name: sonataflows.sonataflow.org
resources:
Expand Down Expand Up @@ -328,6 +328,9 @@ spec:
path: endpoint
- displayName: lastTimeRecoverAttempt
path: lastTimeRecoverAttempt
- description: Platform displays which platform is being used by this workflow
displayName: platform
path: platform
- description: keeps track of how many failure recovers a given workflow had
so far
displayName: recoverFailureAttempts
Expand Down Expand Up @@ -758,7 +761,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: quay.io/kiegroup/kogito-serverless-operator-nightly:latest
image: docker.io/apache/incubator-kie-sonataflow-operator:latest
livenessProbe:
httpGet:
path: /healthz
Expand Down
14 changes: 14 additions & 0 deletions bundle/manifests/sonataflow.org_sonataflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9461,6 +9461,20 @@ spec:
description: The generation observed by the deployment controller.
format: int64
type: integer
platform:
description: Platform displays which platform is being used by this
workflow
properties:
name:
description: Name of the SonataFlowPlatform
type: string
namespace:
description: Namespace of the SonataFlowPlatform
type: string
required:
- name
- namespace
type: object
recoverFailureAttempts:
description: keeps track of how many failure recovers a given workflow
had so far
Expand Down
14 changes: 14 additions & 0 deletions config/crd/bases/sonataflow.org_sonataflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9462,6 +9462,20 @@ spec:
description: The generation observed by the deployment controller.
format: int64
type: integer
platform:
description: Platform displays which platform is being used by this
workflow
properties:
name:
description: Name of the SonataFlowPlatform
type: string
namespace:
description: Namespace of the SonataFlowPlatform
type: string
required:
- name
- namespace
type: object
recoverFailureAttempts:
description: keeps track of how many failure recovers a given workflow
had so far
Expand Down
4 changes: 2 additions & 2 deletions config/manager/SonataFlow-Builder.containerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/kiegroup/kogito-swf-builder-nightly:latest AS builder
FROM docker.io/apache/incubator-kie-sonataflow-builder:main AS builder

# variables that can be overridden by the builder
# To add a Quarkus extension to your application
Expand All @@ -16,7 +16,7 @@ RUN /home/kogito/launch/build-app.sh ./resources
#=============================
# Runtime Run
#=============================
FROM registry.access.redhat.com/ubi9/openjdk-17:latest
FROM registry.access.redhat.com/ubi9/openjdk-17-runtime:latest

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'

Expand Down
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/kiegroup/kogito-serverless-operator-nightly
newName: docker.io/apache/incubator-kie-sonataflow-operator
newTag: latest
# Patching the manager deployment file to add an env var with the operator namespace in
patchesJson6902:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
alm-examples: '[]'
capabilities: Basic Install
categories: Application Runtime
containerImage: quay.io/kiegroup/kogito-serverless-operator-nightly:latest
containerImage: docker.io/apache/incubator-kie-sonataflow-operator:main
description: SonataFlow Kubernetes Operator for deploying workflow applications
based on the CNCF Serverless Workflow specification
operators.operatorframework.io/internal-objects: '["sonataflowbuilds.sonataflow.org"]'
Expand All @@ -19,7 +19,7 @@ spec:
owned:
- description: SonataFlowBuild is an internal custom resource to control workflow
build instances in the target platform
displayName: Sonata Flow Build
displayName: SonataFlowBuild
kind: SonataFlowBuild
name: sonataflowbuilds.sonataflow.org
resources:
Expand Down Expand Up @@ -66,7 +66,7 @@ spec:
version: v1alpha08
- description: SonataFlowClusterPlatform is the Schema for the sonataflowclusterplatforms
API
displayName: Sonata Flow Cluster Platform
displayName: SonataFlowClusterPlatform
kind: SonataFlowClusterPlatform
name: sonataflowclusterplatforms.sonataflow.org
resources:
Expand Down Expand Up @@ -95,7 +95,7 @@ spec:
version: v1alpha08
- description: SonataFlowPlatform is the descriptor for the workflow platform
infrastructure.
displayName: Sonata Flow Platform
displayName: SonataFlowPlatform
kind: SonataFlowPlatform
name: sonataflowplatforms.sonataflow.org
resources:
Expand Down Expand Up @@ -165,7 +165,7 @@ spec:
version: v1alpha08
- description: SonataFlow is the descriptor representation for a workflow application
based on the CNCF Serverless Workflow specification.
displayName: Sonata Flow
displayName: SonataFlow
kind: SonataFlow
name: sonataflows.sonataflow.org
resources:
Expand Down Expand Up @@ -212,6 +212,9 @@ spec:
path: endpoint
- displayName: lastTimeRecoverAttempt
path: lastTimeRecoverAttempt
- description: Platform displays which platform is being used by this workflow
displayName: platform
path: platform
- description: keeps track of how many failure recovers a given workflow had
so far
displayName: recoverFailureAttempts
Expand Down
4 changes: 2 additions & 2 deletions container-builder/builder/kubernetes/builder_kaniko_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestNewBuildWithKanikoCustomizations(t *testing.T) {
addFlags[0] = "--use-new-run=true"

// create the new build, schedule with cache enabled, a specific set of resources and additional flags
build, err := NewBuild(ContainerBuilderInfo{FinalImageName: "quay.io/kiegroup/buildexample:latest", BuildUniqueName: "build1", Platform: platform}).
build, err := NewBuild(ContainerBuilderInfo{FinalImageName: "docker.io/apache/incubator-kie-buildexample:latest", BuildUniqueName: "build1", Platform: platform}).
AddResource("Dockerfile", dockerFile).
AddResource("greetings.sw.json", workflowDefinition).
WithClient(c).
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestNewBuildWithKanikoWithBuildArgsAndEnv(t *testing.T) {
},
}

build, err := NewBuild(ContainerBuilderInfo{FinalImageName: "quay.io/kiegroup/buildexample:latest", BuildUniqueName: "build1", Platform: platform}).
build, err := NewBuild(ContainerBuilderInfo{FinalImageName: "docker.io/apache/incubator-kie-buildexample:latest", BuildUniqueName: "build1", Platform: platform}).
AddResource("Dockerfile", dockerFile).
AddResource("greetings.sw.json", workflowDefinition).
WithClient(c).
Expand Down
2 changes: 1 addition & 1 deletion container-builder/builder/kubernetes/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestNewBuild(t *testing.T) {
},
}
// create the new build, schedule
build, err := NewBuild(ContainerBuilderInfo{FinalImageName: "quay.io/kiegroup/buildexample:latest", BuildUniqueName: "build1", Platform: platform}).
build, err := NewBuild(ContainerBuilderInfo{FinalImageName: "docker.io/apache/incubator-kie-buildexample:latest", BuildUniqueName: "build1", Platform: platform}).
WithClient(c).
AddResource("Dockerfile", dockerFile).
AddResource("greetings.sw.json", workflowDefinition).
Expand Down
2 changes: 1 addition & 1 deletion container-builder/builder/kubernetes/testdata/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

FROM quay.io/kiegroup/kogito-swf-builder-nightly:latest AS builder
FROM docker.io/apache/incubator-kie-sonataflow-builder:main AS builder

# Kogito User
USER 1001
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: platform-kaniko-using-cache
spec:
publishStrategy: "Kaniko"
baseImage: quay.io/kiegroup/kogito-swf-builder-nightly:latest
baseImage: docker.io/apache/incubator-kie-sonataflow-builder:main
registry:
address: quay.io/kiegroup
secret: regcred
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

FROM quay.io/kiegroup/kogito-swf-builder-nightly:latest AS builder
FROM docker.io/apache/incubator-kie-sonataflow-builder:main AS builder

# Kogito User
USER 1001
Expand Down
Loading

0 comments on commit 0fdd9d6

Please sign in to comment.