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

Add ArgoCD support for Licensing #950

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d5a9787
Add initial version of ArgoCD support
kflorianski-ibm Nov 22, 2024
f755e85
Fixed paths
kflorianski-ibm Nov 22, 2024
1134e03
1. Simplify - remove app-of-apps pattern
kflorianski-ibm Nov 25, 2024
7f79cff
Rename prerequisites and remove redundant gitignore
kflorianski-ibm Nov 25, 2024
fd2b6e5
Fix paths
kflorianski-ibm Nov 25, 2024
2380503
Update prereqs and check if cluster role binding for reporter require…
kflorianski-ibm Nov 25, 2024
089cd21
Test without namespace again
kflorianski-ibm Nov 26, 2024
bdbefd0
Check if changing namespace with Application works
kflorianski-ibm Nov 27, 2024
3f484ab
Add namespaces back as they should all be changed through destination…
kflorianski-ibm Nov 27, 2024
6425d3a
Revert "Add namespaces back as they should all be changed through des…
kflorianski-ibm Nov 27, 2024
39eedd0
Add licensing components
kflorianski-ibm Nov 27, 2024
789137b
Attempt using helm chart for scanner installation
kflorianski-ibm Nov 28, 2024
b8a960d
Use helm charts for all components
kflorianski-ibm Nov 28, 2024
91c1391
Remove redundant chart version from charts
kflorianski-ibm Nov 28, 2024
856b886
Updated docs
kflorianski-ibm Nov 28, 2024
f3e4879
Updated docs again
kflorianski-ibm Nov 28, 2024
27aded6
Added auto-update of version in deploy/argo-cd
kflorianski-ibm Nov 29, 2024
80d4faa
Removed no-longer-needed part of the docs
kflorianski-ibm Nov 29, 2024
e3a3019
Add scanner CR without sync-wave
kflorianski-ibm Dec 2, 2024
f4f0927
Add scanner create-cr prereqs
kflorianski-ibm Dec 2, 2024
ac49d1f
Add reporter CR
kflorianski-ibm Dec 2, 2024
544c12d
Revert back to the default instance name
kflorianski-ibm Dec 2, 2024
b5094fc
Update IBM Licensing prereqs and components
kflorianski-ibm Dec 2, 2024
4dfa4bb
Fixed missing namespace
kflorianski-ibm Dec 3, 2024
a01a439
Fixed mising namespace - revert, as IBMLicensing is cluster-scope
kflorianski-ibm Dec 3, 2024
893c099
Let argo create IBMLicensing
kflorianski-ibm Dec 3, 2024
00180ae
Fix deployment watch namespaces
kflorianski-ibm Dec 3, 2024
7080f5a
Check if not applying the CR works
kflorianski-ibm Dec 3, 2024
b89900c
Check if serversideapply is functional
kflorianski-ibm Dec 3, 2024
211783e
Fix missing label
kflorianski-ibm Dec 3, 2024
b6f2b27
Adjusted docs to note that there still are extra steps to take after …
kflorianski-ibm Dec 3, 2024
334d4ba
Removed commented-out code as server-side-apply is functional
kflorianski-ibm Dec 3, 2024
b55b857
Fixed docs to run an AND operation instead of spawning a background p…
kflorianski-ibm Dec 6, 2024
b66a334
Fixed namespace to match what the docs are saying
kflorianski-ibm Dec 7, 2024
e1678d7
Added reporter config to licensing
kflorianski-ibm Dec 9, 2024
0494edd
Remove redundant comments and rename licensing component to license-s…
kflorianski-ibm Dec 11, 2024
027fdd8
Remove sync policies
kflorianski-ibm Dec 11, 2024
bb47943
Updated installation docs
kflorianski-ibm Dec 12, 2024
0e222d7
Made the values.yaml take the whole spec section and updated docs acc…
kflorianski-ibm Dec 12, 2024
223fd6b
Added operand request for auto-connect Scanner <-> License Service
kflorianski-ibm Dec 13, 2024
11bf5ae
Added helm-based support for operator's custom labels and annotations
kflorianski-ibm Dec 17, 2024
514d40d
Updated docs with the custom metadata instructions
kflorianski-ibm Dec 17, 2024
fa5863e
Merge branch 'master' into ILS-59_add-argo
kflorianski-ibm Dec 17, 2024
c666d7c
Updated license service to .12 and renamed cluster rbac prereq
kflorianski-ibm Dec 18, 2024
eadb421
Updated docs example
kflorianski-ibm Dec 18, 2024
bd099e6
Updated metadata
kflorianski-ibm Dec 18, 2024
1dbf6ab
Renamed rbac argo cd files for more clarity
kflorianski-ibm Dec 19, 2024
7637cc7
Updated scanner to .12
kflorianski-ibm Dec 19, 2024
19c6797
Updated reporter to .12
kflorianski-ibm Dec 19, 2024
74abe1e
Merge branch 'master' into ILS-59_add-argo
kflorianski-ibm Dec 19, 2024
402ded4
Fix lint errors
kflorianski-ibm Dec 19, 2024
8a671a4
Fix lint errors again
kflorianski-ibm Dec 19, 2024
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: 6 additions & 1 deletion common/scripts/next_csv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,9 @@ echo "Updated the config/samples/operator.ibm.com_v1alpha1_ibmlicensing.yaml"

# Update relatedImages (make bundle target)
inline_sed "s/$CURRENT_DEV_CSV/$NEW_DEV_CSV/" common/relatedImages.yaml
echo "Updated the common/relatedImages.yaml"
echo "Updated the common/relatedImages.yaml"

# All matched versions in the components and prerequisites directories
find ./deploy/argo-cd/components -type f -exec sh -c 'sed "s/$2/$3/g" "$1" > find-sed.tmp && mv find-sed.tmp "$1"' _ {} "$CURRENT_DEV_CSV" "$NEW_DEV_CSV" \;
find ./deploy/argo-cd/prerequisites -type f -exec sh -c 'sed "s/$2/$3/g" "$1" > find-sed.tmp && mv find-sed.tmp "$1"' _ {} "$CURRENT_DEV_CSV" "$NEW_DEV_CSV" \;
echo "Updated deploy/argo-cd"
168 changes: 168 additions & 0 deletions deploy/argo-cd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# IBM Licensing components as ArgoCD Applications

Provided functionalities:
- Installation of IBM License Service (ILS), ILS Reporter, and ILS Scanner
- Configuration of the components so that the whole licensing suite is functional

## Prerequisites

There is a number of steps involved before it's possible to deploy ArgoCD applications:
- There must be a cluster with ArgoCD installed
- ArgoCD application controller must have all required permissions OR
- The prerequisites to install the applications must be met

Below are instructions on how to provision and configure a cluster for IBM Licensing components.

### Install ArgoCD on an Openshift cluster

- Install *Red Hat OpenShift GitOps* from the *OperatorHub* (see
[RedHat documentation](https://docs.openshift.com/gitops/1.14/installing_gitops/installing-openshift-gitops.html)
for more information):
![install-red-hat-openshift-gitops-step-1](docs/images/install-red-hat-openshift-gitops-step-1.png)
![install-red-hat-openshift-gitops-step-2](docs/images/install-red-hat-openshift-gitops-step-2.png)

- Access *ArgoCD* UI:
![argo-cd-ui-step-1.png](docs/images/argo-cd-ui-step-1.png)
![argo-cd-ui-step-2.png](docs/images/argo-cd-ui-step-2.png)

- Log in via *OpenShift* and check the Applications screen is accessible:
![applications-screen.png](docs/images/applications-screen.png)

### Apply prerequisites

There are multiple ways to apply prerequisites in your cluster. We recommend that the cluster admins review and apply
required modifications manually, however, this can also be automated.

#### Apply the yaml files

You can apply (assuming you are logged in to the cluster) all prerequisites required for IBM Licensing components
with a simple command executed on the `prerequisites` directory:

```commandline
oc apply -f prerequisites --recursive
```

Note that some values (such as namespaces or annotations) may need adjustment depending on your desired results.

#### Include prerequisites as part of your ArgoCD deployment

To automate prerequisites deployment, you can include yaml files from the `prerequisites` directory in your ArgoCD
applications' paths. To make sure they are applied before the IBM Licensing components are installed, you can use
[sync waves](https://argo-cd.readthedocs.io/en/latest/user-guide/sync-waves/). For example, through annotating required
resources with the `PreSync` phase.

## Installation

To install all components, execute the following command (assuming you are logged in to your cluster):

```commandline
oc project openshift-gitops && oc apply -f applications
```

If you wish to configure the components (e.g. connect *IBM License Service* with *IBM License Service Reporter*), please
refer to the official documentation for each component and modify the `spec` section in the `values.yaml` files within
the `components` directory.

Please note that *IBM License Service Scanner* is not yet officially documented - contact us to learn more about it.

![components.png](docs/images/components.png)

To install selected components separately, for example to install *IBM License Service* only, execute this command:

```commandline
oc project openshift-gitops && oc apply -f applications/license-service.yaml
```

Installing components separately is recommended for example when you want to install *IBM License Service Reporter*
on a different cluster.

The steps in such scenario would be as follows:
- Apply `applications/reporter.yaml` to your cluster
- Follow official *IBM License Service* docs to prepare connection secret and CR configuration
- Modify `components/license-service/values.yaml` to perform the connection
- Apply `applications/license-service.yaml` to your cluster and check both components are working and connected

## Configuration

We recommend that you adjust the `Application` yaml files to configure the components' `helm` charts. Please check
the [ArgoCD user guide](https://argo-cd.readthedocs.io/en/latest/user-guide/helm/) on `helm` for more details.

Alternatively, you may want to adjust the yaml files within the `components` directory itself, before deploying
an `Application` targeting them. For example, you could fork this repository and adjust some custom resource
configuration directly in the relevant file.

For your convenience, below are some common scenarios with examples on how to resolve provided, sample issues.

### With helm

Since the YAML files provided as part of the `components` directory are templated with `helm`, you can add the following
section to the `Application` files, to modify some templated field:

```yaml
source:
helm:
valuesObject:
key: new-value
```

Naturally, you can also fork/copy this repository and apply the changes yourself to `values.yaml` files.

#### Configure the CR

To configure licensing components through custom resources, please modify the `spec` section. For example, to enable
hyper-threading in license service:

```yaml
source:
helm:
valuesObject:
spec:
features:
hyperThreading:
threadsPerCore: <number of threads>
```

Please refer to the components' official documentation to learn more about the supported configuration options.

#### Change target namespace

By default, IBM Licensing components are installed in three different namespaces, to separate the resources, and to
group them up by the component. If you want to install a specific component in a different namespace:

```yaml
source:
helm:
valuesObject:
namespace: my-custom-namespace
```

#### Apply custom metadata

To apply custom labels and annotations please refer to the official documentation for each component and apply the
changes to the `spec` section:

```yaml
source:
helm:
valuesObject:
spec:
labels:
appName: LicenseService
annotations:
companyName: IBM
```

To apply custom labels and annotations to the operator deployment:

```yaml
source:
helm:
valuesObject:
operator:
labels:
appName: LicenseService
annotations:
companyName: IBM
```

Note that these labels and annotations are added in addition of the default ones, and will not override them.
15 changes: 15 additions & 0 deletions deploy/argo-cd/applications/license-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: ibm-license-service
namespace: openshift-gitops
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
destination:
server: https://kubernetes.default.svc
source:
repoURL: "https://github.com/IBM/ibm-licensing-operator"
targetRevision: "ILS-59_add-argo"
path: deploy/argo-cd/components/license-service
15 changes: 15 additions & 0 deletions deploy/argo-cd/applications/reporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: ibm-license-service-reporter
namespace: openshift-gitops
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
destination:
server: https://kubernetes.default.svc
source:
repoURL: "https://github.com/IBM/ibm-licensing-operator"
targetRevision: "ILS-59_add-argo"
path: deploy/argo-cd/components/reporter
15 changes: 15 additions & 0 deletions deploy/argo-cd/applications/scanner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: ibm-license-service-scanner
namespace: openshift-gitops
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
destination:
server: https://kubernetes.default.svc
source:
repoURL: "https://github.com/IBM/ibm-licensing-operator"
targetRevision: "ILS-59_add-argo"
path: deploy/argo-cd/components/scanner
5 changes: 5 additions & 0 deletions deploy/argo-cd/components/license-service/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: license-service
description: A Helm chart for IBM License Service ArgoCD installation
type: application
version: 4.2.10
Loading
Loading