-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KOGITO-9218] - Implement Conditions API and review SonataFlowPlatfor…
…m status Signed-off-by: Ricardo Zanini <[email protected]>
- Loading branch information
1 parent
6f15f03
commit cf321af
Showing
32 changed files
with
704 additions
and
959 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// Copyright 2023 Red Hat, Inc. and/or its affiliates | ||
// | ||
// Licensed 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. | ||
|
||
package v1alpha08 | ||
|
||
import ( | ||
"strconv" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// Describes the general build specification for this platform. Specific for build scenarios. | ||
type BuildPlatformSpec struct { | ||
// Describes a build template for building workflows. Base for the internal SonataFlowBuild resource. | ||
Template BuildTemplate `json:"template,omitempty"` | ||
// Describes the platform configuration for building workflows. | ||
Config BuildPlatformConfig `json:"config,omitempty"` | ||
} | ||
|
||
// Describes the configuration for building in the given platform | ||
type BuildPlatformConfig struct { | ||
// a base image that can be used as base layer for all images. | ||
// It can be useful if you want to provide some custom base image with further utility software | ||
BaseImage string `json:"baseImage,omitempty"` | ||
// how much time to wait before time out the build process | ||
Timeout *metav1.Duration `json:"timeout,omitempty"` | ||
// BuildStrategy to use to build workflows in the platform. | ||
// Usually, the operator elect the strategy based on the platform. | ||
// Note that this field might be read only in certain scenarios. | ||
BuildStrategy BuildStrategy `json:"strategy,omitempty"` | ||
// BuildStrategyOptions additional options to add to the build strategy. | ||
// See https://sonataflow.org/serverlessworkflow/main/cloud/operator/build-and-deploy-workflows.html | ||
BuildStrategyOptions map[string]string `json:"strategyOptions,omitempty"` | ||
// Registry the registry where to publish the built image | ||
Registry RegistrySpec `json:"registry,omitempty"` | ||
} | ||
|
||
// GetTimeout returns the specified duration or a default one | ||
func (b *BuildPlatformConfig) GetTimeout() metav1.Duration { | ||
if b.Timeout == nil { | ||
return metav1.Duration{} | ||
} | ||
return *b.Timeout | ||
} | ||
|
||
// IsStrategyOptionEnabled return whether the BuildStrategyOptions is enabled or not | ||
func (b *BuildPlatformConfig) IsStrategyOptionEnabled(option string) bool { | ||
if enabled, ok := b.BuildStrategyOptions[option]; ok { | ||
res, err := strconv.ParseBool(enabled) | ||
if err != nil { | ||
return false | ||
} | ||
return res | ||
} | ||
return false | ||
} | ||
|
||
func (b *BuildPlatformConfig) IsStrategyOptionEmpty(option string) bool { | ||
if v, ok := b.BuildStrategyOptions[option]; ok { | ||
return len(v) == 0 | ||
} | ||
return false | ||
} | ||
|
||
// RegistrySpec provides the configuration for the container registry | ||
type RegistrySpec struct { | ||
// if the container registry is insecure (ie, http only) | ||
Insecure bool `json:"insecure,omitempty"` | ||
// the URI to access | ||
Address string `json:"address,omitempty"` | ||
// the secret where credentials are stored | ||
Secret string `json:"secret,omitempty"` | ||
// the configmap which stores the Certificate Authority | ||
CA string `json:"ca,omitempty"` | ||
// the registry organization | ||
Organization string `json:"organization,omitempty"` | ||
} | ||
|
||
type BuildStrategy string | ||
|
||
const ( | ||
// OperatorBuildStrategy uses the operator builder to perform the workflow build | ||
// E.g. on Minikube or Kubernetes the container-builder strategies | ||
OperatorBuildStrategy BuildStrategy = "operator" | ||
// PlatformBuildStrategy uses the cluster to perform the build. | ||
// E.g. on OpenShift, BuildConfig. | ||
PlatformBuildStrategy BuildStrategy = "platform" | ||
|
||
// In the future we can have "custom" which will delegate the build to an external actor provided by the administrator | ||
// See https://issues.redhat.com/browse/KOGITO-9084 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2023 Red Hat, Inc. and/or its affiliates | ||
// | ||
// Licensed 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. | ||
|
||
package v1alpha08 | ||
|
||
// DevModePlatformSpec describes the devmode configuration for the given platform. | ||
type DevModePlatformSpec struct { | ||
// Base image to run the Workflow in dev mode instead of the operator's default. | ||
BaseImage string `json:"baseImage,omitempty"` | ||
} |
Oops, something went wrong.