Skip to content

Commit

Permalink
Basic working kustomize
Browse files Browse the repository at this point in the history
  • Loading branch information
gansheer committed Oct 20, 2023
1 parent bf12a82 commit 9034ce6
Show file tree
Hide file tree
Showing 15 changed files with 611 additions and 8 deletions.
8 changes: 0 additions & 8 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,3 @@ resources:
- operator-deployment.yaml
- operator-service-account.yaml

patchesStrategicMerge:
- patch-toleration.yaml
- patch-node-selector.yaml
- patch-resource-requirements.yaml
patches:
- path: patch-log-level.yaml
target:
kind: Deployment
98 changes: 98 additions & 0 deletions install/overlays/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@

# Kustomize Camel K

Kustomize provides a declarative approach to the configuration customization of a Camel-K installation. Kustomize works either with a standalone executable or as a built-in to kubectl.

Basic overlays are provided for easy usage.

## HOW-TO

### Initialize

First create a new kustomization from the wanted version (kubernetes or openshift) in the repository:
```sh
kustomize create --resources https://github.com/apache/camel-k.git/install/overlays/kubernetes\?ref\=exp/kustomize_structure
```

You can also clone the camel-k repository and reference the local folder :
```sh
kubectl kustomize <path/to/localrepo/install/overlays/openshift | kubectl create -f -
```

To ensure the `IntegrationPlatform` custom resource is created add in the `kustomization.yaml`:
```yaml
sortOptions:
order: fifo
```
### Configuration
Camel K Operators offers several possibility of customization. The default installation needs to but cutomized in most of the cases, but, we have a series of configuration that can be applied when you want to fine tune your Camel K operator and get the very best of it.
#### Operator configuration
TODO: test knative
TODO: add namespace adaptation
TODO: find scorecard usage
The operator installation can be customized by using the following parameters:
* Set the operator id that is used to select the resources this operator should manage (default "camel-k") (see `install/overlays/common/patches/patch-operator-id-deployment.yaml` and `install/overlays/common/patches/patch-operator-id-integration-platform.yaml`)
* Set the operator Image used for the operator deployment (using https://kubectl.docs.kubernetes.io/references/kustomize/builtins/#field-name-images)
* Set the operator ImagePullPolicy used for the operator deployment (see `config/manager/patch-image-pull-policy-always.yaml`)

#### Resources managment

We provide certain configuration to better "operationalize" the Camel K Operator:

* Add a NodeSelector to the operator Pod (see `config/manager/patch-node-selector.yaml`)
* Define the resources requests and limits assigned to the operator Pod as <requestType.requestResource=value> (i.e., limits.memory=256Mi) (see `config/manager/patch-resource-requirement.yaml`)
* Add a Toleration to the operator Pod (see `config/manager/patch-toleration.yaml`)

#### Build configuration

We have several configuration used to influence the building of an integration (see `install/overlays/common/patches/patch-build-integration-platform.yaml`):

* Set the base Image used to run integrations
* Set the build publish strategy
* Add a build publish strategy option, as <name=value>
* Set the build strategy
* Set the build order strategy
* Set how long the build process can last
* Set how long the catalogtool image build can last


A very important set of configuration you can provide is related to Maven (see `install/overlays/common/patches/patch-maven-integration-platform.yaml`):

* Configure the secret key containing the Maven CA certificates (secret/key)
* Add a default Maven CLI option to the list of arguments for Maven commands
* Add a Maven build extension
* Path of the local Maven repository
* Add a Maven property
* Configure the source of the Maven settings (configmap|secret:name[/key])

#### Publish configuration

Camel K requires a container registry where to store the applications built (see `install/overlays/common/patches/patch-registry-integration-platform.yaml`). These are the main configurations:

* A organization on the Docker Hub that can be used to publish images
* A container registry that can be used to publish images
* Configure registry access in insecure mode or not (`http` vs `https`)
* A secret used to push/pull images to the container registry containing authorization tokens for pushing and pulling images

#### Monitoring

Camel K Operator provides certain monitoring capabilities.

You can activate the monitoring by adding the following resources: `config/prometheus`

You can change the default settings:
* The port of the health endpoint (default 8081) (see `config/manager/patch-toleration.yaml`)
* The port of the metrics endpoint (default 8080) (see `config/manager/patch-toleration.yaml`)
* The level of operator logging (default - info): info or 0, debug or 1 (default "info") (see `config/manager/patch-log-level.yaml`)


#### Installation Topology

By default the proposed overlays configure the cluster, install an integration platform and the operator. You can easilly build your own overlay with only part or the configuration to fit your need.
20 changes: 20 additions & 0 deletions install/overlays/common/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# ---------------------------------------------------------------------------
# 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.
# ---------------------------------------------------------------------------

resources:
- resources/integration-platform.yaml

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

# ---------------------------------------------------------------------------
# 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.
# ---------------------------------------------------------------------------

#
# The base Image used to run integrations
#
# value: base-image:1.0.0
- op: replace
path: /spec/build/baseImage
value: <value>
#
# Build order strategy for integrations
# ie. dependencies, fifo, sequential
#
# value: sequential
- op: replace
path: /spec/build/buildConfiguration/orderStrategy
value: <value>
#
# Build strategy to for integrations
# ie. routine, pod
#
# value: routine
- op: replace
path: /spec/build/buildConfiguration/strategy
value: <value>
#
# The maximum amount of parallel pipeline running
#
# value: 3
- op: replace
path: /spec/build/maxRunningBuilds
value: <value>
#
# The time to wait before time out the pipeline process
#
# value: 3000
- op: replace
path: /spec/build/timeout
value: <value>
#
# Build publish strategy for integrations
# ie. Buildah, Kaniko, S2I, Spectrum, Jib
#
# value: Buildah | Kaniko | S2I | Spectrum | Jib
- op: replace
path: /spec/build/publishStrategy
value: <value>
#
# Options that can be used by any publish strategy
#
# value:
# KanikoPersistentVolumeClaim: camel-k
- op: replace
path: /spec/build/PublishStrategyOptions
value:
<key>:<value>

109 changes: 109 additions & 0 deletions install/overlays/common/patches/patch-maven-integration-platform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

# ---------------------------------------------------------------------------
# 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.
# ---------------------------------------------------------------------------

#
# Secret name and key, containing the CA certificate(s) used to connect
# to remote Maven repositories.
#
# Can contain X.509 certificates, and PKCS#7 formatted certificate chains.
# A JKS formatted keystore is automatically created to store the CA certificate(s),
# and configured to be used as a trusted certificate(s) by the Maven commands.
# Note that the root CA certificates are also imported into the created keystore.
#
# caSecret:
# key: tls.crt
# name: tls-secret
#
#
# CLI options passed to the Maven commands to be executed
#
# cliOptions:
# - --show-version
# - --batch-mode
#
#
# Maven build extensions. See https://maven.apache.org/guides/mini/guide-using-extensions.html.
#
# extensions:
# - artifactId: fi.yle.tools
# groupId: aws-maven
# version: 1.4.2
#
#
# Location of the local Maven repository
#
# localRepository: my.repository.url
#
#
# Configure Maven profiles (configmap|secret:name[/key])
# profiles:
# - configMapKeyRef:
# key: profile.xml
# name: maven-profile
#
#
# Maven properties
#
# properties:
# quarkus.package.type: native
#
#
# Configure a source of Maven settings (configmap|secret:name[/key])
# settings:
# configMapKeyRef:
# key: settings.xml
# name: maven-settings
#
#
# Configure a source of Maven security settings (configmap|secret:name[/key])
# settings:
# configMapKeyRef:
# key: settings.xml
# name: maven-settings
#
#
#
- op: replace
path: /spec/build/maven
value:
caSecrets:
- key: <value>
name: <value>
optional: <value>
cliOptions:
- <value1>
- <value2>
extension:
- artifactId: <value>
groupId: <value>
version: <value>
localRepository: <value>
profiles:
- configMapKeyRef:
key: <value>
name: <value>
- secretKeyRef:
key: <value>
name: <value>
properties:
<key1>: <value1>
<key2>: <value2>
settings:
configMapKeyRef:
key: <value>
name: <value>
28 changes: 28 additions & 0 deletions install/overlays/common/patches/patch-operator-id-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# ---------------------------------------------------------------------------
# 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: apps/v1
kind: Deployment
metadata:
name: camel-k-operator
spec:
template:
spec:
containers:
- name: camel-k-operator
env:
- name: OPERATOR_ID
value: <value>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ---------------------------------------------------------------------------
# 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.
# ---------------------------------------------------------------------------
- op: replace
path: /metadata/name
value: <value>
- op: replace
path: /metadata/annotations/camel.apache.org~1operator.id
value: <value>
Loading

0 comments on commit 9034ce6

Please sign in to comment.