Skip to content

Commit

Permalink
feat: updated the installPlan approval to Automatic and exposed new v…
Browse files Browse the repository at this point in the history
…ariable `ws_liberty_operator_install_plan_approval` so it can be configured (#16)
  • Loading branch information
vbontempi authored Apr 2, 2024
1 parent a40c0f8 commit 029d1f4
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ No modules.
| <a name="input_create_ws_liberty_operator_namespace"></a> [create\_ws\_liberty\_operator\_namespace](#input\_create\_ws\_liberty\_operator\_namespace) | Whether to create the namespace where the IBM WebSphere Liberty operator is deployed. Default is `false`. | `bool` | `false` | no |
| <a name="input_install_wslo_sampleapp"></a> [install\_wslo\_sampleapp](#input\_install\_wslo\_sampleapp) | Whether to deploy the WebSphere Application Server Liberty sample application. Default is `false`. | `bool` | `false` | 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 liberty-operator-helm-release. | `string` | `"liberty-operator"` | no |
| <a name="input_ws_liberty_operator_install_plan_approval"></a> [ws\_liberty\_operator\_install\_plan\_approval](#input\_ws\_liberty\_operator\_install\_plan\_approval) | IBM WebSphere Liberty operator approval configuration for OLM upgrade. Set to 'Manual' to manually approve the operator upgrades. Default is `Automatic`. | `string` | `"Automatic"` | no |
| <a name="input_ws_liberty_operator_namespace"></a> [ws\_liberty\_operator\_namespace](#input\_ws\_liberty\_operator\_namespace) | Namespace where the IBM WebSphere Liberty operator is deployed. Default is `openshift-operators`. | `string` | `"openshift-operators"` | no |
| <a name="input_ws_liberty_operator_target_namespace"></a> [ws\_liberty\_operator\_target\_namespace](#input\_ws\_liberty\_operator\_target\_namespace) | Namespace that the the IBM WebSphere Liberty operator watches. Default is `null`, which means that the operator watches all the namespaces. | `string` | `null` | no |
| <a name="input_wslo_sampleapp_name"></a> [wslo\_sampleapp\_name](#input\_wslo\_sampleapp\_name) | Application name to use for the WebSphere Application Server Liberty sample application. | `string` | `"websphereliberty-app-sample"` | no |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: ibm-websphere-liberty
namespace: {{ .Values.operatornamespace }}
spec:
installPlanApproval: Manual
installPlanApproval: {{ .Values.installplanapprovalconfig }}
name: ibm-websphere-liberty
source: ibm-operator-catalog
sourceNamespace: openshift-marketplace
1 change: 1 addition & 0 deletions chart/websphere-liberty-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# Declare variables to be passed into your templates.

operatornamespace: openshift-operators
installplanapprovalconfig: Automatic
2 changes: 1 addition & 1 deletion extensions/landing-zone/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### WebSphere Liberty operator extension for landing zone

Tutorial: TBD
This example provides the code to install the WebSphere Liberty operator extension DA on an existing OpenShift cluster
23 changes: 12 additions & 11 deletions extensions/landing-zone/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ data "ibm_container_cluster_config" "cluster_config" {
}

module "websphere_liberty_operator" {
source = "../.."
cluster_id = var.cluster_id
add_ibm_operator_catalog = var.add_ibm_operator_catalog
create_ws_liberty_operator_namespace = var.create_ws_liberty_operator_namespace
ws_liberty_operator_namespace = var.ws_liberty_operator_namespace
ws_liberty_operator_target_namespace = var.ws_liberty_operator_target_namespace
cluster_config_endpoint_type = var.cluster_config_endpoint_type
install_wslo_sampleapp = var.install_wslo_sampleapp
wslo_sampleapp_name = var.wslo_sampleapp_name
wslo_sampleapp_namespace = var.wslo_sampleapp_namespace
operator_helm_release_namespace = var.operator_helm_release_namespace
source = "../.."
cluster_id = var.cluster_id
add_ibm_operator_catalog = var.add_ibm_operator_catalog
create_ws_liberty_operator_namespace = var.create_ws_liberty_operator_namespace
ws_liberty_operator_namespace = var.ws_liberty_operator_namespace
ws_liberty_operator_target_namespace = var.ws_liberty_operator_target_namespace
cluster_config_endpoint_type = var.cluster_config_endpoint_type
install_wslo_sampleapp = var.install_wslo_sampleapp
wslo_sampleapp_name = var.wslo_sampleapp_name
wslo_sampleapp_namespace = var.wslo_sampleapp_namespace
operator_helm_release_namespace = var.operator_helm_release_namespace
ws_liberty_operator_install_plan_approval = var.ws_liberty_operator_install_plan_approval
}

locals {
Expand Down
11 changes: 11 additions & 0 deletions extensions/landing-zone/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ variable "ws_liberty_operator_target_namespace" {
default = null
}

variable "ws_liberty_operator_install_plan_approval" {
type = string
description = "IBM WebSphere Liberty operator approval configuration for upgrade through OLM. Set to 'Manual' to manually approve the operator upgrades. Default is `Automatic`."
default = "Automatic"
validation {
error_message = "Invalid install plan approval configuration! Valid values are 'Automatic' or 'Manual'"
condition = contains(["Automatic", "Manual"], var.ws_liberty_operator_install_plan_approval)
}
nullable = false
}

variable "cluster_config_endpoint_type" {
description = "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."
type = string
Expand Down
7 changes: 7 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ resource "helm_release" "websphere_liberty_operator" {
value = var.ws_liberty_operator_namespace
}

set {
name = "installplanapprovalconfig"
type = "string"
value = var.ws_liberty_operator_install_plan_approval
}

# executed to approve install-plans if var.ws_liberty_operator_install_plan_approval is Manual (if Automatic no change is expected)
provisioner "local-exec" {
command = "${path.module}/scripts/approve-install-plan.sh ${var.ws_liberty_operator_namespace}"
interpreter = ["/bin/bash", "-c"]
Expand Down
4 changes: 4 additions & 0 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ func setupOptions(t *testing.T, prefix string, exampleDir string) *testhelper.Te
ResourceGroup: resourceGroup,
IgnoreUpdates: testhelper.Exemptions{ // Ignore for consistency check
List: []string{
// to skip update error due to operator sample app updates
"module.websphere_liberty_operator.helm_release.websphere_liberty_operator_sampleapp[0]",
// to skip update error due to operator hash changes
// consider to remove this once https://github.com/terraform-ibm-modules/terraform-ibm-websphere-liberty-operator/pull/16 is merged
"module.websphere_liberty_operator.helm_release.websphere_liberty_operator",
},
},
})
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ variable "ws_liberty_operator_target_namespace" {
default = null
}

variable "ws_liberty_operator_install_plan_approval" {
type = string
description = "IBM WebSphere Liberty operator approval configuration for OLM upgrade. Set to 'Manual' to manually approve the operator upgrades. Default is `Automatic`."
default = "Automatic"
validation {
error_message = "Invalid install plan approval configuration! Valid values are 'Automatic' or 'Manual'"
condition = contains(["Automatic", "Manual"], var.ws_liberty_operator_install_plan_approval)
}
nullable = false
}


variable "cluster_config_endpoint_type" {
description = "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."
type = string
Expand Down

0 comments on commit 029d1f4

Please sign in to comment.