Skip to content
Merged
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
54 changes: 2 additions & 52 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,64 +78,14 @@ jobs:
- name: Registry setting
uses: ./.github/actions/registry-setting

- name: Install operator
shell: bash
run: |
make install-k8s-global

cat <<EOF | kubectl apply -f -
apiVersion: camel.apache.org/v1
kind: IntegrationPlatform
metadata:
name: camel-k
namespace: camel-k
labels:
app: "camel-k"
spec:
build:
registry:
address: $KAMEL_INSTALL_REGISTRY
secret: my-registry
insecure: true
EOF

kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=60s

- name: Run test
shell: bash
run: |
DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-common

# This job will replace the previous one when we've settled any possible issue
# with IntegrationPlatform deprecation
common-platformless:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
persist-credentials: false
submodules: recursive

- name: Infra setting
uses: ./.github/actions/infra-setting

- name: Create operator namespace
shell: bash
run: |
kubectl create ns camel-k

- name: Registry setting
uses: ./.github/actions/registry-setting

- name: Install operator
shell: bash
run: |
kubectl apply -k install/overlays/all-namespaces/ --server-side --force-conflicts
kubectl wait --for=condition=available deployment/camel-k-operator -n camel-k --timeout=60s
# Install Apache Kamelets catalog
mvn -q dependency:copy -Dartifact=org.apache.camel.kamelets:camel-kamelets:4.18.1:jar -Dmdep.useBaseVersion=true -DoutputDirectory=/tmp
unzip /tmp/camel-kamelets-4.18.1.jar -d /tmp && kubectl apply -f /tmp/kamelets -n camel-k
mvn -q dependency:copy -Dartifact=org.apache.camel.kamelets:camel-kamelets:4.22.0:jar -Dmdep.useBaseVersion=true -DoutputDirectory=/tmp
unzip /tmp/camel-kamelets-4.22.0.jar -d /tmp && kubectl apply -f /tmp/kamelets -n camel-k

- name: Run test
shell: bash
Expand Down
4 changes: 3 additions & 1 deletion pkg/trait/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ func (t *builderTrait) Apply(e *Environment) error {
pipelineTasks = append(pipelineTasks, ct...)
}
} else {
t.L.Info("Custom tasks are disabled by operator configuration: the tasks will be ignored")
if len(t.Tasks) > 0 {
t.L.Info("Custom tasks are disabled by operator configuration: the tasks will be ignored")
}
// Useful to report in status no custom task was executed
t.Tasks = []string{}
}
Expand Down
32 changes: 21 additions & 11 deletions pkg/trait/pull_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/utils/ptr"

v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
"github.com/apache/camel-k/v2/pkg/platform"
"github.com/apache/camel-k/v2/pkg/util/kubernetes"
"github.com/apache/camel-k/v2/pkg/util/log"
"github.com/apache/camel-k/v2/pkg/util/openshift"
)

Expand All @@ -51,20 +51,22 @@ func newPullSecretTrait() Trait {
}

func (t *pullSecretTrait) Configure(e *Environment) (bool, *TraitCondition, error) {
var condition *TraitCondition
var err error
if e.Integration == nil {
return false, nil, nil
return false, condition, nil
}
if !ptr.Deref(t.Enabled, true) {
return false, NewIntegrationConditionUserDisabled("PullSecret"), nil
}
if !e.IntegrationInRunningPhases() {
return false, nil, nil
return false, condition, nil
}

if ptr.Deref(t.Auto, true) {
err := t.autoConfigure(e)
condition, err = t.autoConfigure(e)
if err != nil {
return false, nil, err
return false, condition, err
}
}

Expand All @@ -75,16 +77,17 @@ func (t *pullSecretTrait) Configure(e *Environment) (bool, *TraitCondition, erro
//nolint:staticcheck
t.deprecatedImagePullerDelegation = t.ImagePullerDelegation

return t.secretName != "" || ptr.Deref(t.deprecatedImagePullerDelegation, false), nil, nil
return t.secretName != "" || ptr.Deref(t.deprecatedImagePullerDelegation, false), condition, nil
}
func (t *pullSecretTrait) autoConfigure(e *Environment) error {
func (t *pullSecretTrait) autoConfigure(e *Environment) (*TraitCondition, error) {
var condition *TraitCondition
if t.deprecatedImagePullerDelegation == nil {
var isOpenShift bool
if t.Client != nil {
var err error
isOpenShift, err = openshift.IsOpenShift(t.Client)
if err != nil {
return err
return condition, err
}
}
isOperatorGlobal := platform.IsCurrentOperatorGlobal()
Expand All @@ -95,12 +98,19 @@ func (t *pullSecretTrait) autoConfigure(e *Environment) error {

if t.SecretName == "" && e.Platform.Registry.Secret != "" {
// This is deprecated and will be removed in future versions
log.Info("Setting the configured operator pull secret. This feature is deprecated and will be removed in the future. " +
"Use pull-secret trait explicitly instead.")
t.secretName = e.Platform.Registry.Secret

condition = NewIntegrationCondition(
"PullSecret",
v1.IntegrationConditionTraitInfo,
corev1.ConditionTrue,
TraitConfigurationReason,
"Setting the configured operator pull secret: this feature is deprecated and will be removed in the future. "+
"Use pull-secret trait explicitly instead.",
)
}

return nil
return condition, nil
}

func (t *pullSecretTrait) Apply(e *Environment) error {
Expand Down
Loading