Skip to content

Commit

Permalink
feat: initial release (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatagarwal-ibm committed Feb 14, 2024
1 parent 069fa6a commit a2206e8
Show file tree
Hide file tree
Showing 65 changed files with 2,634 additions and 177 deletions.
13 changes: 13 additions & 0 deletions .catalog-onboard-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v1
offerings:
- name: deploy-arch-ibm-slz-mq-operator
kind: solution
catalog_id: 7df1e4ca-d54c-4fd0-82ce-3d13247308cd
offering_id: e46e5212-5c94-4bea-95d8-863755949bc5
variations:
- name: standard
mark_ready: false
install_type: extension
pre_validation: "tests/scripts/pre-validation-slz-roks.sh"
post_validation: "tests/scripts/post-validation-slz-roks.sh"
6 changes: 3 additions & 3 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ repository:
# By changing this field, you rename the repository.

# Uncomment this name property and set the name to the current repo name.
# name: ""
name: "terraform-ibm-mq-operator"

# The description is displayed under the repository name on the
# organization page and in the 'About' section of the repository.

# Uncomment this description property
# and update the description to the current repo description.
# description: ""
description: "The module installs an IBM MQ operator on the existing cluster."

# Use a comma-separated list of topics to set on the repo (ensure not to use any caps in the topic string).
topics: terraform, ibm-cloud, terraform-module
topics: terraform, ibm-cloud, terraform-module, ibm-mq-operator
3 changes: 3 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
}],
["@semantic-release/exec", {
"successCmd": "echo \"SEMVER_VERSION=${nextRelease.version}\" >> $GITHUB_ENV"
}],
["@semantic-release/exec",{
"publishCmd": "./ci/trigger-catalog-onboarding-pipeline.sh --version=v${nextRelease.version}"
}]
]
}
45 changes: 36 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
<!-- Update the title -->
# Terraform Modules Template Project
# IBM MQ Operator on Red Hat OpenShift Container Platform module

<!--
Update status and "latest release" badges:
1. For the status options, see https://terraform-ibm-modules.github.io/documentation/#/badge-status
2. Update the "latest release" badge to point to the correct module's repo. Replace "terraform-ibm-module-template" in two places.
-->
[![Incubating (Not yet consumable)](https://img.shields.io/badge/status-Incubating%20(Not%20yet%20consumable)-red)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
[![Implemented (No quality checks)](https://img.shields.io/badge/Status-Implemented%20(No%20quality%20checks)-yellowgreen)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-module-template?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-module-template/releases/latest)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

<!-- Add a description of module(s) in this repo -->
TODO: Replace me with description of the module(s) in this repo
The module installs an IBM MQ operator on the existing cluster.

For more information about the IBM MQ operator refer to the official documentation available [here](https://www.ibm.com/docs/en/ibm-mq/9.3?topic=mq-about)


<!-- Below content is automatically populated via pre-commit hook -->
<!-- BEGIN OVERVIEW HOOK -->
## Overview
* [terraform-ibm-module-template](#terraform-ibm-module-template)
* [terraform-ibm-mq-operator](#terraform-ibm-mq-operator)
* [Examples](./examples)
* [Basic example](./examples/basic)
* [Complete example](./examples/complete)
* [Contributing](#contributing)
<!-- END OVERVIEW HOOK -->
Expand All @@ -37,7 +38,7 @@ https://terraform-ibm-modules.github.io/documentation/#/implementation-guideline


<!-- This heading should always match the name of the root level module (aka the repo name) -->
## terraform-ibm-module-template
## terraform-ibm-mq-operator

### Usage

Expand Down Expand Up @@ -89,22 +90,48 @@ statement instead the previous block.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0, <1.6.0 |
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | >= 2.8.0, <3.0.0 |
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.59.0, < 2.0.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.16.1, <3.0.0 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.2.1, < 4.0.0 |
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.9.1, < 1.0.0 |

### Modules

No modules.

### Resources

No resources.
| Name | Type |
|------|------|
| [helm_release.ibm_mq_operator](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.ibm_mq_operator_group](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.ibm_operator_catalog](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [kubernetes_namespace.helm_release_operator_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
| [kubernetes_namespace.ibm_mq_operator_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
| [null_resource.confirm_ibm_mq_operator_operational](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [time_sleep.wait_catalog](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
| [time_sleep.wait_ibm_mq_operator](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
| [ibm_container_cluster_config.cluster_config](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/container_cluster_config) | data source |

### Inputs

No inputs.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_add_ibm_operator_catalog"></a> [add\_ibm\_operator\_catalog](#input\_add\_ibm\_operator\_catalog) | Flag to configure the IBM Operator Catalog in the cluster before installing the IBM MQ Operator. Default is true | `bool` | `true` | no |
| <a name="input_cluster_config_endpoint_type"></a> [cluster\_config\_endpoint\_type](#input\_cluster\_config\_endpoint\_type) | Specify which type of endpoint to use for for cluster config access: 'default', 'private', 'vpe', 'link'. 'default' value will use the default endpoint of the cluster. | `string` | `"default"` | no |
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | Id of the target IBM Cloud OpenShift Cluster | `string` | n/a | yes |
| <a name="input_create_ibm_mq_operator_namespace"></a> [create\_ibm\_mq\_operator\_namespace](#input\_create\_ibm\_mq\_operator\_namespace) | Flag to create the namespace where to deploy the IBM MQ Operator. Default to false | `bool` | `false` | no |
| <a name="input_ibm_mq_operator_namespace"></a> [ibm\_mq\_operator\_namespace](#input\_ibm\_mq\_operator\_namespace) | Namespace to install the IBM MQ Operator. Default to openshift-operators | `string` | `"openshift-operators"` | no |
| <a name="input_ibm_mq_operator_target_namespace"></a> [ibm\_mq\_operator\_target\_namespace](#input\_ibm\_mq\_operator\_target\_namespace) | Namespace to be watched by the IBM MQ Operator. Default to null (operator to watch all namespaces) | `string` | `null` | no |
| <a name="input_operator_helm_release_namespace"></a> [operator\_helm\_release\_namespace](#input\_operator\_helm\_release\_namespace) | Namespace to deploy the helm releases. Default to ibm-mq-operator helm release | `string` | `"ibm-mq-operator"` | no |

### Outputs

No outputs.
| Name | Description |
|------|-------------|
| <a name="output_ibm_mq_operator_namespace"></a> [ibm\_mq\_operator\_namespace](#output\_ibm\_mq\_operator\_namespace) | Namespace where the IBM MQ operator is installed. |
| <a name="output_ibm_mq_operator_target_namespace"></a> [ibm\_mq\_operator\_target\_namespace](#output\_ibm\_mq\_operator\_target\_namespace) | Namespace watched by the IBM MQ operator. |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

<!-- Leave this section as is so that your module has a link to local development environment set up steps for contributors to follow -->
Expand Down
23 changes: 23 additions & 0 deletions chart/ibm-operator-catalog/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
15 changes: 15 additions & 0 deletions chart/ibm-operator-catalog/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: ibm-operator-catalog
description: A Helm chart to configure the IBM Operator Catalog source
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: ibm-operator-catalog
namespace: openshift-marketplace
spec:
displayName: IBM Operator Catalog
publisher: IBM
sourceType: grpc
image: '{{ .Values.image.path }}:{{ required "IBM Operator catalog version must be provided" .Values.image.version }}'
updateStrategy:
registryPoll:
interval: 45m
5 changes: 5 additions & 0 deletions chart/ibm-operator-catalog/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
image:
path: "icr.io/cpopen/ibm-operator-catalog"
version: "v1.25-20240202.161709-9DAF3E648@sha256:92e28be4af60f68c656f52b2445aafcc052fcd0390479b868c5b0ba2d465a25a"
23 changes: 23 additions & 0 deletions chart/mq-operator-group/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
15 changes: 15 additions & 0 deletions chart/mq-operator-group/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: ibm-mq-operator-group
description: A Helm chart to configure the Operator Group for the IBM MQ Operator
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0"
8 changes: 8 additions & 0 deletions chart/mq-operator-group/templates/ibm-mq-operator-group.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: operators.coreos.com/v1alpha2
kind: OperatorGroup
metadata:
name: ibm-mq-operator
namespace: {{ .Values.operatornamespace }}
spec:
targetNamespaces:
- {{ .Values.operatortargetnamespace }}
5 changes: 5 additions & 0 deletions chart/mq-operator-group/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

operatornamespace: openshift-operators
operatortargetnamespace: openshift-operators
23 changes: 23 additions & 0 deletions chart/mq-operator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
15 changes: 15 additions & 0 deletions chart/mq-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: ibm-mq-operator
description: A Helm chart to configure the Subscription for the IBM MQ Operator
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0"
26 changes: 26 additions & 0 deletions chart/mq-operator/scripts/uninstall-operator-resources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

## Needed to delete resources (CSVs and installPlans) created by the OLM outside of the Terraform scope

operator_names=( "ibm-mq" )

echo "Fetching and deleting CSVs and installPlans for IBM MQ Operator"

for i in "${operator_names[@]}"
do
CSV=$(kubectl get subscription "$i" -o jsonpath="{$.status.installedCSV}" -n "$1")

if [ -n "$CSV" ]
then
echo "Deleting CSV ${CSV}"
kubectl delete csv "$CSV" -n "$1"
fi

IP=$(kubectl get installPlan -n "$1" | grep "${i}" | awk '{print $1}')

if [ -n "$IP" ]
then
echo "Deleting installPlan ${IP}"
kubectl delete installPlan "$IP" -n "$1"
fi
done
12 changes: 12 additions & 0 deletions chart/mq-operator/templates/ibm-mq-operator-subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ibm-mq-operator-subscription.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: ibm-mq
namespace: {{ .Values.operatornamespace }}
spec:
channel: {{ .Values.channelversion }}
installPlanApproval: Manual
name: ibm-mq
source: ibm-operator-catalog
sourceNamespace: openshift-marketplace
15 changes: 15 additions & 0 deletions chart/mq-operator/templates/uninstall-hook-config-map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The OLM created csv objects on the cluster during install - there is a need to clean up csv created by the OLM, in addition to removing the subscription
# See https://olm.operatorframework.io/docs/tasks/uninstall-operator/#combine-steps-2-and-3 for context

apiVersion: v1
kind: ConfigMap
metadata:
name: wslo-uninstall-scripts
namespace: {{ .Values.operatornamespace }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed
"helm.sh/hook-weight": "3"
data:
uninstall-operator-resources.sh: |-
{{ .Files.Get "scripts/uninstall-operator-resources.sh" | indent 4}}
36 changes: 36 additions & 0 deletions chart/mq-operator/templates/uninstall-hook-crb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# The OLM created csv objects on the cluster during install - there is a need to clean up csv created by the OLM, in addition to removing the subscription
# See https://olm.operatorframework.io/docs/tasks/uninstall-operator/#combine-steps-2-and-3 for context

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: wslo-uninstall-hook-role-binding-edit
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed
"helm.sh/hook-weight": "2"
subjects:
- kind: ServiceAccount
name: wslo-uninstall-hook-role-sa
namespace: {{ .Values.operatornamespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: aggregate-olm-edit
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: wslo-uninstall-hook-role-binding-view
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed
"helm.sh/hook-weight": "2"
subjects:
- kind: ServiceAccount
name: wslo-uninstall-hook-role-sa
namespace: {{ .Values.operatornamespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: aggregate-olm-view
Loading

0 comments on commit a2206e8

Please sign in to comment.