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

chore(controller): builder permissions static #5957

Merged
merged 1 commit into from
Nov 26, 2024
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
7 changes: 0 additions & 7 deletions pkg/controller/integrationkit/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,6 @@ func (action *buildAction) createBuild(ctx context.Context, kit *v1.IntegrationK
}
}

//nolint:contextcheck
if buildConfig.Strategy == v1.BuildStrategyPod {
err = platform.CreateBuilderServiceAccount(env.Ctx, env.Client, env.Platform)
if err != nil {
return nil, fmt.Errorf("error while creating Camel K Builder service account: %w", err)
}
}
// The build operation, when executed as a Pod, should be executed by a container image containing the
// `kamel builder` command. Likely the same image running the operator should be fine.
buildConfig.ToolImage = platform.OperatorImage
Expand Down
57 changes: 0 additions & 57 deletions pkg/install/builder.go

This file was deleted.

26 changes: 0 additions & 26 deletions pkg/platform/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package platform

import (
"context"
"fmt"
"runtime"
"strings"
"time"
Expand All @@ -30,11 +29,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

ctrl "sigs.k8s.io/controller-runtime/pkg/client"

v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"github.com/apache/camel-k/v2/pkg/client"
"github.com/apache/camel-k/v2/pkg/install"
"github.com/apache/camel-k/v2/pkg/kamelet/repository"
"github.com/apache/camel-k/v2/pkg/util/defaults"
"github.com/apache/camel-k/v2/pkg/util/log"
Expand Down Expand Up @@ -109,12 +105,6 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl
return err
}

if p.Status.Build.BuildConfiguration.Strategy == v1.BuildStrategyPod {
if err := CreateBuilderServiceAccount(ctx, c, p); err != nil {
return fmt.Errorf("cannot ensure service account is present: %w", err)
}
}

err = configureRegistry(ctx, c, p, verbose)
if err != nil {
return err
Expand All @@ -131,22 +121,6 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl
return nil
}

func CreateBuilderServiceAccount(ctx context.Context, client client.Client, p *v1.IntegrationPlatform) error {
log.Debugf("Integration Platform %s [%s]: creating build service account", p.Name, p.Namespace)
sa := corev1.ServiceAccount{}
key := ctrl.ObjectKey{
Name: BuilderServiceAccount,
Namespace: p.Namespace,
}

err := client.Get(ctx, key, &sa)
if err != nil && k8serrors.IsNotFound(err) {
return install.BuilderServiceAccountRoles(ctx, client, p.Namespace, p.Status.Cluster)
}

return err
}

func configureRegistry(ctx context.Context, c client.Client, p *v1.IntegrationPlatform, verbose bool) error {
if p.Status.Cluster == v1.IntegrationPlatformClusterOpenShift &&
p.Status.Build.PublishStrategy != v1.IntegrationPlatformBuildPublishStrategyS2I &&
Expand Down
5 changes: 5 additions & 0 deletions pkg/resources/config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ kind: Kustomization
resources:
- operator-deployment.yaml
- operator-service-account.yaml
- builder-service-account.yaml
- builder-role.yaml
- builder-role-openshift.yaml
- builder-role-binding.yaml
- builder-role-binding-openshift.yaml
27 changes: 0 additions & 27 deletions pkg/resources/config/manager/patch-image-pull-policy-always.yaml

This file was deleted.