You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2024/12/07 11:13:49 UTC
(camel-k) branch main updated (67faf9538 -> 6c0bba950)
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
from 67faf9538 chore: remove reference to Openshift
new f04b2e132 feat(install): remove KEP 1755
new 6c0bba950 feat(helm): align resources for helm
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../ROOT/pages/installation/installation.adoc | 2 +-
e2e/install/helm/setup_test.go | 2 +-
e2e/support/test_support.go | 3 +-
.../camel-k/templates/builder-service-account.yaml | 23 --
.../templates/{platform.yaml => default-itp.yaml} | 0
.../templates/operator-cluster-role-bindings.yaml | 196 ----------
.../{operator.yaml => operator-deployment.yaml} | 0
helm/camel-k/templates/operator-role-binding.yaml | 50 ---
...tor-service-account.yaml => operator-svcs.yaml} | 9 +
helm/camel-k/templates/rbacs-common.yaml | 243 +++++++++++++
.../{operator-role.yaml => rbacs-descoped.yaml} | 221 ++++++++++--
...or-cluster-roles.yaml => rbacs-namespaced.yaml} | 401 +++++++++++----------
install/base/kustomization.yaml | 12 -
.../overlays/platform/integration-platform.yaml | 3 -
pkg/install/cluster.go | 7 -
pkg/install/operator.go | 8 -
pkg/platform/defaults.go | 14 +-
.../{manager => helm/common}/kustomization.yaml | 14 +-
.../helm/common/patch-rolebinding-subjects.yaml | 4 +-
.../{manager => helm/descoped}/kustomization.yaml | 14 +-
.../helm/descoped/patch-rolebinding-subjects.yaml | 4 +-
.../namespaced}/kustomization.yaml | 9 +-
pkg/resources/config/rbac/kustomization.yaml | 16 +-
.../rbac/operator-cluster-role-local-registry.yaml | 28 --
.../rbac/operator-role-binding-local-registry.yaml | 31 --
pkg/trait/deployer.go | 4 +-
pkg/trait/platform.go | 5 -
pkg/util/registry/kep_1755.go | 98 -----
script/Makefile | 1 +
script/gen_helm.sh | 36 ++
30 files changed, 726 insertions(+), 732 deletions(-)
delete mode 100644 helm/camel-k/templates/builder-service-account.yaml
rename helm/camel-k/templates/{platform.yaml => default-itp.yaml} (100%)
delete mode 100644 helm/camel-k/templates/operator-cluster-role-bindings.yaml
rename helm/camel-k/templates/{operator.yaml => operator-deployment.yaml} (100%)
delete mode 100644 helm/camel-k/templates/operator-role-binding.yaml
rename helm/camel-k/templates/{operator-service-account.yaml => operator-svcs.yaml} (91%)
create mode 100644 helm/camel-k/templates/rbacs-common.yaml
rename helm/camel-k/templates/{operator-role.yaml => rbacs-descoped.yaml} (59%)
rename helm/camel-k/templates/{operator-cluster-roles.yaml => rbacs-namespaced.yaml} (71%)
copy pkg/resources/config/{manager => helm/common}/kustomization.yaml (84%)
copy install/overlays/kubernetes/descoped/patch-operator-id.yaml => pkg/resources/config/helm/common/patch-rolebinding-subjects.yaml (93%)
copy pkg/resources/config/{manager => helm/descoped}/kustomization.yaml (84%)
copy install/overlays/kubernetes/descoped/patch-operator-id.yaml => pkg/resources/config/helm/descoped/patch-rolebinding-subjects.yaml (93%)
copy pkg/resources/config/{manager => helm/namespaced}/kustomization.yaml (90%)
delete mode 100644 pkg/resources/config/rbac/operator-cluster-role-local-registry.yaml
delete mode 100644 pkg/resources/config/rbac/operator-role-binding-local-registry.yaml
delete mode 100644 pkg/util/registry/kep_1755.go
create mode 100755 script/gen_helm.sh
(camel-k) 02/02: feat(helm): align resources for helm
Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 6c0bba9500a28be939a87f9e03641a4561feda5b
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Sat Dec 7 11:19:54 2024 +0100
feat(helm): align resources for helm
Until now we were maintaining 2 separate set of installation resources. Here we make Helm to reuse the existing base resources instead, making easier any future evolution
---
e2e/install/helm/setup_test.go | 2 +-
e2e/support/test_support.go | 3 +-
.../templates/{platform.yaml => default-itp.yaml} | 0
.../templates/operator-cluster-role-bindings.yaml | 196 ----------
.../{operator.yaml => operator-deployment.yaml} | 0
helm/camel-k/templates/operator-role-binding.yaml | 50 ---
...tor-service-account.yaml => operator-svcs.yaml} | 9 +
helm/camel-k/templates/rbacs-common.yaml | 243 +++++++++++++
.../{operator-role.yaml => rbacs-descoped.yaml} | 221 ++++++++++--
...or-cluster-roles.yaml => rbacs-namespaced.yaml} | 401 +++++++++++----------
install/base/kustomization.yaml | 12 -
.../overlays/platform/integration-platform.yaml | 3 -
pkg/platform/defaults.go | 4 +-
.../config/helm/common/kustomization.yaml | 19 +-
.../helm/common/patch-rolebinding-subjects.yaml | 9 +-
.../config/helm/descoped/kustomization.yaml | 24 +-
.../helm/descoped/patch-rolebinding-subjects.yaml | 9 +-
.../config/helm/namespaced/kustomization.yaml | 14 +-
pkg/resources/config/rbac/kustomization.yaml | 16 +-
pkg/trait/deployer.go | 4 +-
script/Makefile | 1 +
script/gen_helm.sh | 36 ++
22 files changed, 739 insertions(+), 537 deletions(-)
diff --git a/e2e/install/helm/setup_test.go b/e2e/install/helm/setup_test.go
index 8fe4bb2ba..607389f7a 100644
--- a/e2e/install/helm/setup_test.go
+++ b/e2e/install/helm/setup_test.go
@@ -40,7 +40,7 @@ import (
func TestHelmInstallation(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
containerRegistry, ok := os.LookupEnv("KAMEL_INSTALL_REGISTRY")
- g.Expect(ok).To(BeTrue(), "This test requires setting KAMEL_INSTALL_REGISTRY variable.")
+ g.Expect(ok).To(BeTrue(), "You must provide a registry address in KAMEL_INSTALL_REGISTRY env variable")
// Let's make sure no CRD is yet available in the cluster
// as we must make the procedure to install them accordingly
g.Eventually(CRDs(t)).Should(BeNil(), "No Camel K CRDs should be previously installed for this test")
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index d713df020..e314b378d 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -114,8 +114,7 @@ const ExpectedKubePromoteRoles = 7
// camel-k-edit
// camel-k-operator-custom-resource-definitions
// camel-k-operator-bind-addressable-resolver
-// camel-k-operator-local-registry
-const ExpectedKubeClusterRoles = 4
+const ExpectedKubeClusterRoles = 3
// camel-k-operator-openshift
const ExpectedOSPromoteRoles = 1
diff --git a/helm/camel-k/templates/platform.yaml b/helm/camel-k/templates/default-itp.yaml
similarity index 100%
rename from helm/camel-k/templates/platform.yaml
rename to helm/camel-k/templates/default-itp.yaml
diff --git a/helm/camel-k/templates/operator-cluster-role-bindings.yaml b/helm/camel-k/templates/operator-cluster-role-bindings.yaml
deleted file mode 100644
index 54715f734..000000000
--- a/helm/camel-k/templates/operator-cluster-role-bindings.yaml
+++ /dev/null
@@ -1,196 +0,0 @@
-# ---------------------------------------------------------------------------
-# 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.
-# ---------------------------------------------------------------------------
-
-{{- if eq .Values.operator.global "true" }}
-kind: ClusterRoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
- namespace: {{ .Release.Namespace }}
-roleRef:
- kind: ClusterRole
- name: camel-k-operator
- apiGroup: rbac.authorization.k8s.io
-
-
----
-kind: ClusterRoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-custom-resource-definitions
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
- namespace: {{ .Release.Namespace }}
-roleRef:
- kind: ClusterRole
- name: camel-k-operator-custom-resource-definitions
- apiGroup: rbac.authorization.k8s.io
-
-
----
-kind: ClusterRoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-events
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
- namespace: {{ .Release.Namespace }}
-roleRef:
- kind: ClusterRole
- name: camel-k-operator-events
- apiGroup: rbac.authorization.k8s.io
-
-
----
-kind: ClusterRoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-knative
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
- namespace: {{ .Release.Namespace }}
-roleRef:
- kind: ClusterRole
- name: camel-k-operator-knative
- apiGroup: rbac.authorization.k8s.io
-
----
-kind: ClusterRoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-keda
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
- namespace: {{ .Release.Namespace }}
-roleRef:
- kind: ClusterRole
- name: camel-k-operator-keda
- apiGroup: rbac.authorization.k8s.io
-
-
----
-kind: ClusterRoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-leases
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
- namespace: {{ .Release.Namespace }}
-roleRef:
- kind: ClusterRole
- name: camel-k-operator-leases
- apiGroup: rbac.authorization.k8s.io
-
-
----
-kind: ClusterRoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-podmonitors
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
- namespace: {{ .Release.Namespace }}
-roleRef:
- kind: ClusterRole
- name: camel-k-operator-podmonitors
- apiGroup: rbac.authorization.k8s.io
-
-
----
-kind: ClusterRoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-strimzi
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
- namespace: {{ .Release.Namespace }}
-roleRef:
- kind: ClusterRole
- name: camel-k-operator-strimzi
- apiGroup: rbac.authorization.k8s.io
-
-
-{{- if eq .Values.platform.cluster "OpenShift" }}
----
-kind: ClusterRoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-console-openshift
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
- namespace: {{ .Release.Namespace }}
-roleRef:
- kind: ClusterRole
- name: camel-k-operator-console-openshift
- apiGroup: rbac.authorization.k8s.io
----
-kind: ClusterRoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-openshift
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
- namespace: {{ .Release.Namespace }}
-roleRef:
- kind: ClusterRole
- name: camel-k-operator-openshift
- apiGroup: rbac.authorization.k8s.io
-{{- end }}
-
-{{- end }}
\ No newline at end of file
diff --git a/helm/camel-k/templates/operator.yaml b/helm/camel-k/templates/operator-deployment.yaml
similarity index 100%
rename from helm/camel-k/templates/operator.yaml
rename to helm/camel-k/templates/operator-deployment.yaml
diff --git a/helm/camel-k/templates/operator-role-binding.yaml b/helm/camel-k/templates/operator-role-binding.yaml
deleted file mode 100644
index 5b072d711..000000000
--- a/helm/camel-k/templates/operator-role-binding.yaml
+++ /dev/null
@@ -1,50 +0,0 @@
-# ---------------------------------------------------------------------------
-# 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.
-# ---------------------------------------------------------------------------
-
-{{- if eq .Values.operator.global "false" }}
-kind: RoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
-roleRef:
- kind: Role
- name: camel-k-operator
- apiGroup: rbac.authorization.k8s.io
-
----
-kind: RoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-builder-openshift
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-subjects:
-- kind: ServiceAccount
- name: camel-k-builder
-roleRef:
- kind: Role
- name: camel-k-builder-openshift
- apiGroup: rbac.authorization.k8s.io
-
-{{- end }}
\ No newline at end of file
diff --git a/helm/camel-k/templates/operator-service-account.yaml b/helm/camel-k/templates/operator-svcs.yaml
similarity index 91%
copy from helm/camel-k/templates/operator-service-account.yaml
copy to helm/camel-k/templates/operator-svcs.yaml
index f5ad7fbaa..5a670a06e 100644
--- a/helm/camel-k/templates/operator-service-account.yaml
+++ b/helm/camel-k/templates/operator-svcs.yaml
@@ -26,3 +26,12 @@ metadata:
annotations:
{{ toYaml . | nindent 4 }}
{{- end }}
+
+---
+
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: camel-k-builder
+ labels:
+ app: "camel-k"
diff --git a/helm/camel-k/templates/rbacs-common.yaml b/helm/camel-k/templates/rbacs-common.yaml
new file mode 100644
index 000000000..82363ca49
--- /dev/null
+++ b/helm/camel-k/templates/rbacs-common.yaml
@@ -0,0 +1,243 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-builder
+rules:
+- apiGroups:
+ - camel.apache.org
+ resources:
+ - builds
+ - camelcatalogs
+ - integrationkits
+ verbs:
+ - get
+ - list
+- apiGroups:
+ - camel.apache.org
+ resources:
+ - builds/status
+ verbs:
+ - get
+ - patch
+ - update
+- apiGroups:
+ - ""
+ resources:
+ - configmaps
+ - secrets
+ verbs:
+ - get
+ - list
+ - watch
+- apiGroups:
+ - ""
+ resources:
+ - events
+ verbs:
+ - get
+ - list
+ - watch
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-builder-openshift
+rules:
+- apiGroups:
+ - ""
+ - build.openshift.io
+ resources:
+ - buildconfigs
+ - buildconfigs/webhooks
+ - builds
+ verbs:
+ - create
+ - delete
+ - deletecollection
+ - get
+ - list
+ - patch
+ - update
+ - watch
+- apiGroups:
+ - ""
+ - image.openshift.io
+ resources:
+ - imagestreamimages
+ - imagestreammappings
+ - imagestreams
+ - imagestreams/secrets
+ - imagestreamtags
+ verbs:
+ - create
+ - delete
+ - deletecollection
+ - get
+ - list
+ - patch
+ - update
+ - watch
+- apiGroups:
+ - ""
+ - build.openshift.io
+ resources:
+ - buildconfigs/instantiate
+ - buildconfigs/instantiatebinary
+ - builds/clone
+ verbs:
+ - create
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ labels:
+ app: camel-k
+ rbac.authorization.k8s.io/aggregate-to-admin: "true"
+ rbac.authorization.k8s.io/aggregate-to-edit: "true"
+ name: camel-k-edit
+rules:
+- apiGroups:
+ - camel.apache.org
+ resources:
+ - builds
+ - camelcatalogs
+ - integrationkits
+ - integrationplatforms
+ - integrationprofiles
+ - integrations
+ - pipes
+ - kamelets
+ verbs:
+ - create
+ - delete
+ - deletecollection
+ - get
+ - list
+ - patch
+ - update
+ - watch
+- apiGroups:
+ - camel.apache.org
+ resources:
+ - builds/status
+ - camelcatalogs/status
+ - integrationkits/status
+ - integrationplatforms/status
+ - integrationprofiles/status
+ - integrations/scale
+ - integrations/status
+ - pipes/scale
+ - pipes/status
+ - kamelets/status
+ verbs:
+ - get
+ - patch
+ - update
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-bind-addressable-resolver
+rules:
+- apiGroups:
+ - rbac.authorization.k8s.io
+ resourceNames:
+ - addressable-resolver
+ resources:
+ - clusterroles
+ verbs:
+ - bind
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-custom-resource-definitions
+rules:
+- apiGroups:
+ - apiextensions.k8s.io
+ resources:
+ - customresourcedefinitions
+ verbs:
+ - get
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-builder
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: camel-k-builder
+subjects:
+- kind: ServiceAccount
+ name: camel-k-builder
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-builder-openshift
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: camel-k-builder-openshift
+subjects:
+- kind: ServiceAccount
+ name: camel-k-builder
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-bind-addressable-resolver
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: camel-k-operator-bind-addressable-resolver
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+ namespace: '{{ .Release.Namespace }}'
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-custom-resource-definitions
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: camel-k-operator-custom-resource-definitions
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+ namespace: '{{ .Release.Namespace }}'
diff --git a/helm/camel-k/templates/operator-role.yaml b/helm/camel-k/templates/rbacs-descoped.yaml
similarity index 59%
rename from helm/camel-k/templates/operator-role.yaml
rename to helm/camel-k/templates/rbacs-descoped.yaml
index f9f7b6c82..0cd4dfcc6 100644
--- a/helm/camel-k/templates/operator-role.yaml
+++ b/helm/camel-k/templates/rbacs-descoped.yaml
@@ -14,15 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------
-
-{{- if eq .Values.operator.global "false" }}
-kind: Role
+{{- if eq .Values.operator.global "true" }}
apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
metadata:
- name: camel-k-operator
labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
+ app: camel-k
+ name: camel-k-operator
rules:
- apiGroups:
- camel.apache.org
@@ -42,18 +40,10 @@ rules:
- patch
- update
- watch
-- apiGroups:
- - ""
- resources:
- - namespaces
- verbs:
- - get
- - list
- apiGroups:
- camel.apache.org
resources:
- builds
- - integrations
verbs:
- delete
- apiGroups:
@@ -186,6 +176,21 @@ rules:
verbs:
- get
- list
+- apiGroups:
+ - ""
+ resources:
+ - namespaces
+ verbs:
+ - get
+ - list
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-events
+rules:
- apiGroups:
- ""
resources:
@@ -196,6 +201,14 @@ rules:
- get
- list
- watch
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-keda
+rules:
- apiGroups:
- keda.sh
resources:
@@ -210,10 +223,19 @@ rules:
- patch
- update
- watch
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-knative
+rules:
- apiGroups:
- serving.knative.dev
resources:
- services
+ - routes
verbs:
- create
- delete
@@ -258,6 +280,21 @@ rules:
- list
- patch
- update
+- apiGroups:
+ - ""
+ resources:
+ - namespaces
+ verbs:
+ - get
+ - patch
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-leases
+rules:
- apiGroups:
- coordination.k8s.io
resources:
@@ -271,6 +308,14 @@ rules:
- patch
- update
- watch
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-openshift
+rules:
- apiGroups:
- camel.apache.org
resources:
@@ -346,6 +391,14 @@ rules:
- routes/custom-host
verbs:
- create
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-podmonitors
+rules:
- apiGroups:
- monitoring.coreos.com
resources:
@@ -359,6 +412,14 @@ rules:
- patch
- update
- watch
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-strimzi
+rules:
- apiGroups:
- kafka.strimzi.io
resources:
@@ -369,16 +430,124 @@ rules:
- get
- list
- watch
-- apiGroups:
- - "apiextensions.k8s.io"
- resources:
- - customresourcedefinitions
- verbs:
- - get
-- apiGroups:
- - rbac.authorization.k8s.io
- resources:
- - clusterroles
- verbs:
- - bind
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: camel-k-operator
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+ namespace: '{{ .Release.Namespace }}'
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-events
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: camel-k-operator-events
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+ namespace: '{{ .Release.Namespace }}'
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-keda
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: camel-k-operator-keda
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+ namespace: '{{ .Release.Namespace }}'
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-knative
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: camel-k-operator-knative
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+ namespace: '{{ .Release.Namespace }}'
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-leases
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: camel-k-operator-leases
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+ namespace: '{{ .Release.Namespace }}'
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-openshift
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: camel-k-operator-openshift
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+ namespace: '{{ .Release.Namespace }}'
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-podmonitors
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: camel-k-operator-podmonitors
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+ namespace: '{{ .Release.Namespace }}'
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-strimzi
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: camel-k-operator-strimzi
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+ namespace: '{{ .Release.Namespace }}'
{{- end }}
diff --git a/helm/camel-k/templates/operator-cluster-roles.yaml b/helm/camel-k/templates/rbacs-namespaced.yaml
similarity index 71%
rename from helm/camel-k/templates/operator-cluster-roles.yaml
rename to helm/camel-k/templates/rbacs-namespaced.yaml
index 8b37fabb6..83e49e73b 100644
--- a/helm/camel-k/templates/operator-cluster-roles.yaml
+++ b/helm/camel-k/templates/rbacs-namespaced.yaml
@@ -14,65 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------
-
-{{- if eq .Values.operator.global "true" }}
-kind: ClusterRole
+{{- if eq .Values.operator.global "false" }}
apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
metadata:
- name: camel-k-edit
labels:
- app: "camel-k"
- # Add these permissions to the "admin" and "edit" default roles.
- rbac.authorization.k8s.io/aggregate-to-admin: "true"
- rbac.authorization.k8s.io/aggregate-to-edit: "true"
- {{- include "camel-k.labels" . | nindent 4 }}
-rules:
-- apiGroups:
- - camel.apache.org
- resources:
- - builds
- - camelcatalogs
- - integrationkits
- - integrationplatforms
- - integrationprofiles
- - integrations
- - pipes
- verbs:
- - create
- - delete
- - deletecollection
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - camel.apache.org
- resources:
- - builds/status
- - camelcatalogs/status
- - integrationkits/status
- - integrationplatforms/status
- - integrationprofiles/status
- - integrations/scale
- - integrations/status
- - pipes/status
- - pipes/scale
- - kamelets/status
- verbs:
- - get
- - patch
- - update
-
-
----
-kind: ClusterRole
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
+ app: camel-k
name: camel-k-operator
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
rules:
- apiGroups:
- camel.apache.org
@@ -96,6 +44,7 @@ rules:
- camel.apache.org
resources:
- builds
+ - integrations
verbs:
- delete
- apiGroups:
@@ -144,6 +93,7 @@ rules:
- ""
resources:
- pods/proxy
+ - pods/log
verbs:
- get
- apiGroups:
@@ -163,6 +113,7 @@ rules:
resources:
- roles
- rolebindings
+ - clusterrolebindings
verbs:
- create
- delete
@@ -219,58 +170,73 @@ rules:
- patch
- update
- watch
-
-
+- apiGroups:
+ - storage.k8s.io
+ resources:
+ - storageclasses
+ verbs:
+ - get
+ - list
+- apiGroups:
+ - ""
+ resources:
+ - namespaces
+ verbs:
+ - get
+ - list
---
-kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
metadata:
- name: camel-k-operator-custom-resource-definitions
labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
+ app: camel-k
+ name: camel-k-operator-events
rules:
- apiGroups:
- - apiextensions.k8s.io
+ - ""
resources:
- - customresourcedefinitions
+ - events
verbs:
+ - create
+ - patch
- get
-
-
+ - list
+ - watch
---
-kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
metadata:
- name: camel-k-operator-events
labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
+ app: camel-k
+ name: camel-k-operator-keda
rules:
- apiGroups:
- - ""
+ - keda.sh
resources:
- - events
+ - scaledobjects
+ - triggerauthentications
verbs:
- create
- - patch
+ - delete
+ - deletecollection
- get
- list
+ - patch
+ - update
- watch
-
---
-kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
metadata:
- name: camel-k-operator-knative
labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
+ app: camel-k
+ name: camel-k-operator-knative
rules:
- apiGroups:
- serving.knative.dev
resources:
- services
+ - routes
verbs:
- create
- delete
@@ -315,43 +281,23 @@ rules:
- list
- patch
- update
-
----
-kind: ClusterRole
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-keda
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-rules:
- apiGroups:
- - "keda.sh"
+ - ""
resources:
- - scaledobjects
- - triggerauthentications
+ - namespaces
verbs:
- - create
- - delete
- - deletecollection
- get
- - list
- patch
- - update
- - watch
-
-
---
-kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
metadata:
- name: camel-k-operator-leases
labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
+ app: camel-k
+ name: camel-k-operator-leases
rules:
- apiGroups:
- - "coordination.k8s.io"
+ - coordination.k8s.io
resources:
- leases
verbs:
@@ -363,99 +309,13 @@ rules:
- patch
- update
- watch
-
-
----
-kind: ClusterRole
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-local-registry
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-rules:
- - apiGroups: [""]
- resources: ["configmaps"]
- resourceNames: ["local-registry-hosting"]
- verbs: ["get"]
-
-
----
-kind: ClusterRole
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-podmonitors
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-rules:
-- apiGroups:
- - monitoring.coreos.com
- resources:
- - podmonitors
- verbs:
- - create
- - delete
- - deletecollection
- - get
- - list
- - patch
- - update
- - watch
-
-
---
-kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
metadata:
- name: camel-k-operator-strimzi
labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-rules:
-- apiGroups:
- - "kafka.strimzi.io"
- resources:
- - kafkatopics
- - kafkatopics/status
- - kafkas
- verbs:
- - get
- - list
- - watch
-
-
-{{- if eq .Values.platform.cluster "OpenShift" }}
----
-kind: ClusterRole
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-console-openshift
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
-rules:
-- apiGroups:
- - console.openshift.io
- resources:
- - consoleclidownloads
- verbs:
- - create
- - delete
- - deletecollection
- - get
- - list
- - patch
- - update
- - watch
----
-kind: ClusterRole
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
+ app: camel-k
name: camel-k-operator-openshift
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
rules:
- apiGroups:
- camel.apache.org
@@ -470,7 +330,7 @@ rules:
- update
- apiGroups:
- ""
- - "build.openshift.io"
+ - build.openshift.io
resources:
- buildconfigs
- buildconfigs/webhooks
@@ -486,7 +346,7 @@ rules:
- watch
- apiGroups:
- ""
- - "image.openshift.io"
+ - image.openshift.io
resources:
- imagestreamimages
- imagestreammappings
@@ -513,7 +373,7 @@ rules:
- create
- apiGroups:
- ""
- - "route.openshift.io"
+ - route.openshift.io
resources:
- routes
verbs:
@@ -532,6 +392,155 @@ rules:
- routes/custom-host
verbs:
- create
-{{- end }}
-
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-podmonitors
+rules:
+- apiGroups:
+ - monitoring.coreos.com
+ resources:
+ - podmonitors
+ verbs:
+ - create
+ - delete
+ - deletecollection
+ - get
+ - list
+ - patch
+ - update
+ - watch
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-strimzi
+rules:
+- apiGroups:
+ - kafka.strimzi.io
+ resources:
+ - kafkatopics
+ - kafkatopics/status
+ - kafkas
+ verbs:
+ - get
+ - list
+ - watch
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: camel-k-operator
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-events
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: camel-k-operator-events
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-keda
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: camel-k-operator-keda
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-knative
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: camel-k-operator-knative
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-leases
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: camel-k-operator-leases
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-openshift
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: camel-k-operator-openshift
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-podmonitors
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: camel-k-operator-podmonitors
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ labels:
+ app: camel-k
+ name: camel-k-operator-strimzi
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: camel-k-operator-strimzi
+subjects:
+- kind: ServiceAccount
+ name: camel-k-operator
{{- end }}
diff --git a/install/base/kustomization.yaml b/install/base/kustomization.yaml
index fd44ce4a6..b13cf2047 100644
--- a/install/base/kustomization.yaml
+++ b/install/base/kustomization.yaml
@@ -21,15 +21,3 @@ resources:
- ./config/crd
- ./config/rbac
- ./config/manager
-
-transformers:
-- |-
- apiVersion: builtin
- kind: PatchTransformer
- metadata:
- name: fix-local-registry-rbac-namespace
- patch: '[{"op": "replace", "path": "/metadata/namespace", "value": "kube-public"}]'
- target:
- group: rbac.authorization.k8s.io
- kind: RoleBinding
- name: camel-k-operator-local-registry
diff --git a/install/overlays/platform/integration-platform.yaml b/install/overlays/platform/integration-platform.yaml
index 01ef3cb6f..a7e61cf07 100644
--- a/install/overlays/platform/integration-platform.yaml
+++ b/install/overlays/platform/integration-platform.yaml
@@ -23,9 +23,6 @@ metadata:
app: "camel-k"
spec:
build:
- # Registry is required unless your cluster has KEP-1755 enabled and you want to use the local registry.
- # This is a feature recommended for development purpose only.
- # more info at https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry
registry:
# For minikube local cluster you can enable a local registry with
#
diff --git a/pkg/platform/defaults.go b/pkg/platform/defaults.go
index 930a926ce..f8444f4e9 100644
--- a/pkg/platform/defaults.go
+++ b/pkg/platform/defaults.go
@@ -100,7 +100,7 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl
return err
}
- err = configureRegistry(ctx, c, p, verbose)
+ err = configureRegistry(ctx, c, p)
if err != nil {
return err
}
@@ -116,7 +116,7 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl
return nil
}
-func configureRegistry(ctx context.Context, c client.Client, p *v1.IntegrationPlatform, verbose bool) error {
+func configureRegistry(ctx context.Context, c client.Client, p *v1.IntegrationPlatform) error {
if p.Status.Cluster == v1.IntegrationPlatformClusterOpenShift &&
p.Status.Build.PublishStrategy == v1.IntegrationPlatformBuildPublishStrategyS2I &&
p.Status.Build.Registry.Address == "" {
diff --git a/helm/camel-k/templates/builder-service-account.yaml b/pkg/resources/config/helm/common/kustomization.yaml
similarity index 78%
copy from helm/camel-k/templates/builder-service-account.yaml
copy to pkg/resources/config/helm/common/kustomization.yaml
index 9952a7700..313e06eec 100644
--- a/helm/camel-k/templates/builder-service-account.yaml
+++ b/pkg/resources/config/helm/common/kustomization.yaml
@@ -14,10 +14,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
-apiVersion: v1
-kind: ServiceAccount
-metadata:
- name: camel-k-builder
- labels:
- app: "camel-k"
+# Labels to add to all resources and selectors.
+commonLabels:
+ app: camel-k
+
+resources:
+- ../../rbac
+
+patches:
+ - target:
+ kind: ClusterRoleBinding
+ path: patch-rolebinding-subjects.yaml
diff --git a/helm/camel-k/templates/builder-service-account.yaml b/pkg/resources/config/helm/common/patch-rolebinding-subjects.yaml
similarity index 90%
copy from helm/camel-k/templates/builder-service-account.yaml
copy to pkg/resources/config/helm/common/patch-rolebinding-subjects.yaml
index 9952a7700..0b99b4063 100644
--- a/helm/camel-k/templates/builder-service-account.yaml
+++ b/pkg/resources/config/helm/common/patch-rolebinding-subjects.yaml
@@ -15,9 +15,6 @@
# limitations under the License.
# ---------------------------------------------------------------------------
-apiVersion: v1
-kind: ServiceAccount
-metadata:
- name: camel-k-builder
- labels:
- app: "camel-k"
+- op: add
+ path: /subjects/0/namespace
+ value: "{{ .Release.Namespace }}"
diff --git a/helm/camel-k/templates/operator-service-account.yaml b/pkg/resources/config/helm/descoped/kustomization.yaml
similarity index 77%
rename from helm/camel-k/templates/operator-service-account.yaml
rename to pkg/resources/config/helm/descoped/kustomization.yaml
index f5ad7fbaa..546dff180 100644
--- a/helm/camel-k/templates/operator-service-account.yaml
+++ b/pkg/resources/config/helm/descoped/kustomization.yaml
@@ -14,15 +14,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
-apiVersion: v1
-kind: ServiceAccount
-metadata:
- name: camel-k-operator
- labels:
- app: "camel-k"
- {{- include "camel-k.labels" . | nindent 4 }}
- {{- with .Values.operator.serviceAccount.annotations }}
- annotations:
- {{ toYaml . | nindent 4 }}
- {{- end }}
+# Labels to add to all resources and selectors.
+commonLabels:
+ app: camel-k
+
+resources:
+- ../../rbac/descoped
+
+patches:
+ - target:
+ kind: ClusterRoleBinding
+ path: patch-rolebinding-subjects.yaml
diff --git a/helm/camel-k/templates/builder-service-account.yaml b/pkg/resources/config/helm/descoped/patch-rolebinding-subjects.yaml
similarity index 90%
copy from helm/camel-k/templates/builder-service-account.yaml
copy to pkg/resources/config/helm/descoped/patch-rolebinding-subjects.yaml
index 9952a7700..0b99b4063 100644
--- a/helm/camel-k/templates/builder-service-account.yaml
+++ b/pkg/resources/config/helm/descoped/patch-rolebinding-subjects.yaml
@@ -15,9 +15,6 @@
# limitations under the License.
# ---------------------------------------------------------------------------
-apiVersion: v1
-kind: ServiceAccount
-metadata:
- name: camel-k-builder
- labels:
- app: "camel-k"
+- op: add
+ path: /subjects/0/namespace
+ value: "{{ .Release.Namespace }}"
diff --git a/helm/camel-k/templates/builder-service-account.yaml b/pkg/resources/config/helm/namespaced/kustomization.yaml
similarity index 84%
rename from helm/camel-k/templates/builder-service-account.yaml
rename to pkg/resources/config/helm/namespaced/kustomization.yaml
index 9952a7700..7c7a6d1b9 100644
--- a/helm/camel-k/templates/builder-service-account.yaml
+++ b/pkg/resources/config/helm/namespaced/kustomization.yaml
@@ -14,10 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
-apiVersion: v1
-kind: ServiceAccount
-metadata:
- name: camel-k-builder
- labels:
- app: "camel-k"
+# Labels to add to all resources and selectors.
+commonLabels:
+ app: camel-k
+
+resources:
+- ../../rbac/namespaced
diff --git a/pkg/resources/config/rbac/kustomization.yaml b/pkg/resources/config/rbac/kustomization.yaml
index 153db714f..a0c41da10 100644
--- a/pkg/resources/config/rbac/kustomization.yaml
+++ b/pkg/resources/config/rbac/kustomization.yaml
@@ -27,15 +27,7 @@ resources:
- operator-cluster-role-binding-custom-resource-definitions.yaml
- operator-cluster-role-addressable-resolver.yaml
- operator-cluster-role-binding-addressable-resolver.yaml
-
-transformers:
-- |-
- apiVersion: builtin
- kind: PatchTransformer
- metadata:
- name: fix-local-registry-rbac-namespace
- patch: '[{"op": "replace", "path": "/metadata/namespace", "value": "kube-public"}]'
- target:
- group: rbac.authorization.k8s.io
- kind: RoleBinding
- name: camel-k-operator-local-registry
\ No newline at end of file
+- builder-role.yaml
+- builder-role-openshift.yaml
+- builder-role-binding.yaml
+- builder-role-binding-openshift.yaml
\ No newline at end of file
diff --git a/pkg/trait/deployer.go b/pkg/trait/deployer.go
index 49d24a1dd..f88670ee4 100644
--- a/pkg/trait/deployer.go
+++ b/pkg/trait/deployer.go
@@ -52,7 +52,7 @@ func newDeployerTrait() Trait {
func (t *deployerTrait) Configure(e *Environment) (bool, *TraitCondition, error) {
var condition *TraitCondition
- //nolint:staticcheck
+ //nolint: staticcheck
if !ptr.Deref(t.UseSSA, true) {
condition = NewIntegrationCondition(
"Deployer",
@@ -70,7 +70,7 @@ func (t *deployerTrait) Apply(e *Environment) error {
e.PostActions = append(e.PostActions, func(env *Environment) error {
applier := e.Client.ServerOrClientSideApplier()
for _, resource := range env.Resources.Items() {
- //nolint:staticcheck
+ //nolint: staticcheck
if ptr.Deref(t.UseSSA, true) {
if err := applier.Apply(e.Ctx, resource); err != nil {
return err
diff --git a/script/Makefile b/script/Makefile
index cd55de9a3..9e13b2cc6 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -221,6 +221,7 @@ generate: codegen-tools-install
./script/gen_doc.sh
cd pkg/apis/camel && $(CONTROLLER_GEN) paths="./..." object
cd addons/keda/duck && $(CONTROLLER_GEN) paths="./..." object
+ ./script/gen_helm.sh
codegen-tools-install:
@# We must force the installation to make sure we are using the correct version
diff --git a/script/gen_helm.sh b/script/gen_helm.sh
new file mode 100755
index 000000000..35b2c5f40
--- /dev/null
+++ b/script/gen_helm.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+# 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.
+
+set -e
+
+location=$(dirname "$0")
+
+cd $location/../
+
+cat ./script/headers/yaml.txt > ./helm/camel-k/templates/rbacs-common.yaml
+cat ./script/headers/yaml.txt > ./helm/camel-k/templates/rbacs-descoped.yaml
+cat ./script/headers/yaml.txt > ./helm/camel-k/templates/rbacs-namespaced.yaml
+
+kustomize build ./pkg/resources/config/helm/common/. >> ./helm/camel-k/templates/rbacs-common.yaml
+
+printf "{{- if eq .Values.operator.global \"false\" }}\n" >> ./helm/camel-k/templates/rbacs-namespaced.yaml
+kustomize build ./pkg/resources/config/helm/namespaced/. >> ./helm/camel-k/templates/rbacs-namespaced.yaml
+printf "{{- end }}\n" >> ./helm/camel-k/templates/rbacs-namespaced.yaml
+
+printf "{{- if eq .Values.operator.global \"true\" }}\n" >> ./helm/camel-k/templates/rbacs-descoped.yaml
+kustomize build ./pkg/resources/config/helm/descoped/. >> ./helm/camel-k/templates/rbacs-descoped.yaml
+printf "{{- end }}\n" >> ./helm/camel-k/templates/rbacs-descoped.yaml
(camel-k) 01/02: feat(install): remove KEP 1755
Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit f04b2e132a1a931d2e8e8d8e65b27ce181e2bf5a
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Wed Dec 4 21:17:18 2024 +0100
feat(install): remove KEP 1755
It complicates the installation procedure and it's not a Kubernetes GA feature.
---
.../ROOT/pages/installation/installation.adoc | 2 +-
pkg/install/cluster.go | 7 --
pkg/install/operator.go | 8 --
pkg/platform/defaults.go | 10 ---
pkg/resources/config/rbac/kustomization.yaml | 6 --
.../rbac/operator-cluster-role-local-registry.yaml | 28 -------
.../rbac/operator-role-binding-local-registry.yaml | 31 -------
pkg/trait/platform.go | 5 --
pkg/util/registry/kep_1755.go | 98 ----------------------
9 files changed, 1 insertion(+), 194 deletions(-)
diff --git a/docs/modules/ROOT/pages/installation/installation.adoc b/docs/modules/ROOT/pages/installation/installation.adoc
index 476f7ed96..d335d26e3 100644
--- a/docs/modules/ROOT/pages/installation/installation.adoc
+++ b/docs/modules/ROOT/pages/installation/installation.adoc
@@ -63,7 +63,7 @@ The operator is now up and running. However, there is a second step you need to
The majority of configuration required to tune the operator are stored in an `IntegrationPlatform` custom resource. This is mainly required to provide configuration for the container registry, build time configuration or common profile you want to apply to all your `Integrations`.
-Camel K requires a container registry which is used to store the images built for your applications. Certain clusters may use their internal container registry (ie, Openshift, Minikube or https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry[KEP-1755 compatible] clusters).
+Camel K requires a container registry which is used to store the images built for your applications. Certain clusters may use their internal container registry (eg, Openshift, Minikube).
**IMPORTANT:** You need to create an `IntegrationPlatform` with the following configuration in the namespace where the operator is running:
diff --git a/pkg/install/cluster.go b/pkg/install/cluster.go
index 9e56a2873..616392bec 100644
--- a/pkg/install/cluster.go
+++ b/pkg/install/cluster.go
@@ -93,13 +93,6 @@ func installClusterRoles(
}
}
- // ClusterRole: camel-k-operator-local-registry
- ok, err = isClusterRoleInstalled(ctx, c, "camel-k-operator-local-registry")
- if err == nil && !ok {
- // ignore errors
- _ = installResource(ctx, c, collection, "/config/rbac/operator-cluster-role-local-registry.yaml")
- }
-
// === For OpenShift ===
// ClusterRole: camel-k-operator-console-openshift
isOpenShift, err := isOpenShift(c, clusterType)
diff --git a/pkg/install/operator.go b/pkg/install/operator.go
index 082cd9cc0..9728ce737 100644
--- a/pkg/install/operator.go
+++ b/pkg/install/operator.go
@@ -45,7 +45,6 @@ import (
"github.com/apache/camel-k/v2/pkg/util/minikube"
"github.com/apache/camel-k/v2/pkg/util/openshift"
"github.com/apache/camel-k/v2/pkg/util/patch"
- image "github.com/apache/camel-k/v2/pkg/util/registry"
)
type OperatorConfiguration struct {
@@ -634,13 +633,6 @@ func NewPlatform(
if err != nil {
return nil, err
}
- if address == nil {
- // try KEP-1755
- address, err = image.GetRegistryAddress(ctx, c)
- if err != nil {
- return nil, err
- }
- }
if address == nil || *address == "" {
return nil, errors.New("cannot find a registry where to push images")
diff --git a/pkg/platform/defaults.go b/pkg/platform/defaults.go
index 8006d8cfe..930a926ce 100644
--- a/pkg/platform/defaults.go
+++ b/pkg/platform/defaults.go
@@ -35,7 +35,6 @@ import (
"github.com/apache/camel-k/v2/pkg/util/defaults"
"github.com/apache/camel-k/v2/pkg/util/log"
"github.com/apache/camel-k/v2/pkg/util/openshift"
- image "github.com/apache/camel-k/v2/pkg/util/registry"
)
const (
@@ -127,15 +126,6 @@ func configureRegistry(ctx context.Context, c client.Client, p *v1.IntegrationPl
return err
}
}
- if p.Status.Build.Registry.Address == "" {
- // try KEP-1755
- address, err := image.GetRegistryAddress(ctx, c)
- if err != nil && verbose {
- log.Error(err, "Cannot find a registry where to push images via KEP-1755")
- } else if err == nil && address != nil {
- p.Status.Build.Registry.Address = *address
- }
- }
log.Debugf("Final Registry Address: %s", p.Status.Build.Registry.Address)
return nil
diff --git a/pkg/resources/config/rbac/kustomization.yaml b/pkg/resources/config/rbac/kustomization.yaml
index 43700a966..153db714f 100644
--- a/pkg/resources/config/rbac/kustomization.yaml
+++ b/pkg/resources/config/rbac/kustomization.yaml
@@ -27,12 +27,6 @@ resources:
- operator-cluster-role-binding-custom-resource-definitions.yaml
- operator-cluster-role-addressable-resolver.yaml
- operator-cluster-role-binding-addressable-resolver.yaml
-- operator-cluster-role-local-registry.yaml
-- operator-role-binding-local-registry.yaml
-- builder-role.yaml
-- builder-role-openshift.yaml
-- builder-role-binding.yaml
-- builder-role-binding-openshift.yaml
transformers:
- |-
diff --git a/pkg/resources/config/rbac/operator-cluster-role-local-registry.yaml b/pkg/resources/config/rbac/operator-cluster-role-local-registry.yaml
deleted file mode 100644
index cb90a5fb4..000000000
--- a/pkg/resources/config/rbac/operator-cluster-role-local-registry.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-# ---------------------------------------------------------------------------
-# 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.
-# ---------------------------------------------------------------------------
-
-kind: ClusterRole
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-local-registry
- labels:
- app: "camel-k"
-rules:
- - apiGroups: [""]
- resources: ["configmaps"]
- resourceNames: ["local-registry-hosting"]
- verbs: ["get"]
diff --git a/pkg/resources/config/rbac/operator-role-binding-local-registry.yaml b/pkg/resources/config/rbac/operator-role-binding-local-registry.yaml
deleted file mode 100644
index 8bff035de..000000000
--- a/pkg/resources/config/rbac/operator-role-binding-local-registry.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-# ---------------------------------------------------------------------------
-# 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.
-# ---------------------------------------------------------------------------
-
-kind: RoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: camel-k-operator-local-registry
- namespace: kube-public
- labels:
- app: "camel-k"
-subjects:
-- kind: ServiceAccount
- name: camel-k-operator
-roleRef:
- kind: ClusterRole
- name: camel-k-operator-local-registry
- apiGroup: rbac.authorization.k8s.io
diff --git a/pkg/trait/platform.go b/pkg/trait/platform.go
index d129e4bca..15cb0d361 100644
--- a/pkg/trait/platform.go
+++ b/pkg/trait/platform.go
@@ -28,7 +28,6 @@ import (
"github.com/apache/camel-k/v2/pkg/util/boolean"
"github.com/apache/camel-k/v2/pkg/util/defaults"
"github.com/apache/camel-k/v2/pkg/util/openshift"
- image "github.com/apache/camel-k/v2/pkg/util/registry"
)
const (
@@ -66,10 +65,6 @@ func (t *platformTrait) Configure(e *Environment) (bool, *TraitCondition, error)
return false, nil, err
} else if ocp {
t.createDefault = ptr.To(true)
- } else if addr, err := image.GetRegistryAddress(e.Ctx, t.Client); err != nil {
- return false, nil, err
- } else if addr != nil {
- t.createDefault = ptr.To(true)
}
}
diff --git a/pkg/util/registry/kep_1755.go b/pkg/util/registry/kep_1755.go
deleted file mode 100644
index f7783e8a3..000000000
--- a/pkg/util/registry/kep_1755.go
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-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.
-*/
-
-package registry
-
-import (
- "context"
-
- "github.com/apache/camel-k/v2/pkg/client"
- "github.com/apache/camel-k/v2/pkg/util/log"
- "gopkg.in/yaml.v2"
- k8serrors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-// GetRegistryAddress KEP-1755
-// https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry
-func GetRegistryAddress(ctx context.Context, c client.Client) (*string, error) {
- config, err := c.CoreV1().ConfigMaps("kube-public").Get(ctx, "local-registry-hosting", metav1.GetOptions{})
- if err != nil {
- if k8serrors.IsForbidden(err) {
- log.Debug("Cannot access registry configuration local-registry-hosting ConfigMap", "error", err)
- return nil, nil
- } else if k8serrors.IsNotFound(err) {
- log.Debug("Cannot find registry configuration local-registry-hosting ConfigMap", "error", err)
- return nil, nil
- }
- return nil, err
- }
- if data, ok := config.Data["localRegistryHosting.v1"]; ok {
- result := LocalRegistryHostingV1{}
- if err := yaml.Unmarshal([]byte(data), &result); err != nil {
- return nil, err
- }
- return &result.HostFromClusterNetwork, nil
- }
- return nil, nil
-}
-
-// Copied from https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry
-// LocalRegistryHostingV1 describes a local registry that developer tools can
-// connect to. A local registry allows clients to load images into the local
-// cluster by pushing to this registry.
-type LocalRegistryHostingV1 struct {
- // Host documents the host (hostname and port) of the registry, as seen from
- // outside the cluster.
- //
- // This is the registry host that tools outside the cluster should push images
- // to.
- Host string `yaml:"host,omitempty"`
-
- // HostFromClusterNetwork documents the host (hostname and port) of the
- // registry, as seen from networking inside the container pods.
- //
- // This is the registry host that tools running on pods inside the cluster
- // should push images to. If not set, then tools inside the cluster should
- // assume the local registry is not available to them.
- HostFromClusterNetwork string `yaml:"hostFromClusterNetwork,omitempty"`
-
- // HostFromContainerRuntime documents the host (hostname and port) of the
- // registry, as seen from the cluster's container runtime.
- //
- // When tools apply Kubernetes objects to the cluster, this host should be
- // used for image name fields. If not set, users of this field should use the
- // value of Host instead.
- //
- // Note that it doesn't make sense semantically to define this field, but not
- // define Host or HostFromClusterNetwork. That would imply a way to pull
- // images without a way to push images.
- HostFromContainerRuntime string `yaml:"hostFromContainerRuntime,omitempty"`
-
- // Help contains a URL pointing to documentation for users on how to set
- // up and configure a local registry.
- //
- // Tools can use this to nudge users to enable the registry. When possible,
- // the writer should use as permanent a URL as possible to prevent drift
- // (e.g., a version control SHA).
- //
- // When image pushes to a registry host specified in one of the other fields
- // fail, the tool should display this help URL to the user. The help URL
- // should contain instructions on how to diagnose broken or misconfigured
- // registries.
- Help string `yaml:"help,omitempty"`
-}