-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploystage_canary.tf
106 lines (87 loc) · 4.42 KB
/
deploystage_canary.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
## Copyright (c) 2022, Oracle and/or its affiliates.
## All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl
resource "oci_devops_deploy_stage" "oke_depploy_stage" {
defined_tags = { "${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
deploy_pipeline_id = oci_devops_deploy_pipeline.test_deploy_pipeline.id
deploy_stage_type = "OKE_CANARY_DEPLOYMENT"
description = "Stage to apply manifest to kubernetes"
display_name = "Deploy to OKE"
freeform_tags = {}
kubernetes_manifest_deploy_artifact_ids = [
oci_devops_deploy_artifact.test_deploy_oke_artifact.id,
]
oke_cluster_deploy_environment_id = oci_devops_deploy_environment.test_environment.id
canary_strategy {
ingress_name = var.deploy_stage_canary_ingress_name
namespace = var.deploy_stage_canary_namespace
strategy_type = "NGINX_CANARY_STRATEGY"
}
deploy_stage_predecessor_collection {
items {
id = oci_devops_deploy_pipeline.test_deploy_pipeline.id
}
}
timeouts {}
}
resource "oci_devops_deploy_stage" "canary_oke_traffic_shift" {
defined_tags = { "${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
deploy_pipeline_id = oci_devops_deploy_pipeline.test_deploy_pipeline.id
deploy_stage_type = "OKE_CANARY_TRAFFIC_SHIFT"
description = var.canary_stage_shift_description
display_name = var.canary_stage_shift_name
freeform_tags = {}
oke_canary_deploy_stage_id = oci_devops_deploy_stage.oke_depploy_stage.id
deploy_stage_predecessor_collection {
items {
id = oci_devops_deploy_stage.oke_depploy_stage.id
}
}
rollout_policy {
batch_count = 1
batch_delay_in_seconds = 60
batch_percentage = 0
ramp_limit_percent = var.percentage_canary_shift
}
timeouts {}
}
resource "oci_devops_deploy_stage" "production_release_approval" {
defined_tags = { "${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
deploy_pipeline_id = oci_devops_deploy_pipeline.test_deploy_pipeline.id
deploy_stage_type = "OKE_CANARY_APPROVAL"
description = var.approval_stage_description
display_name = var.approval_display_name
freeform_tags = {}
oke_canary_traffic_shift_deploy_stage_id = oci_devops_deploy_stage.canary_oke_traffic_shift.id
approval_policy {
approval_policy_type = "COUNT_BASED_APPROVAL"
number_of_approvals_required = var.canary_prod_release_count_of_approval
}
deploy_stage_predecessor_collection {
items {
id = oci_devops_deploy_stage.canary_oke_traffic_shift.id
}
}
timeouts {}
}
resource "oci_devops_deploy_stage" "production_release" {
defined_tags = { "${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
deploy_pipeline_id = oci_devops_deploy_pipeline.test_deploy_pipeline.id
deploy_stage_type = "OKE_DEPLOYMENT"
description = "Final version from production"
display_name = "Production Release"
freeform_tags = {}
kubernetes_manifest_deploy_artifact_ids = [
oci_devops_deploy_artifact.test_deploy_oke_artifact.id,
]
namespace = var.deploy_stage_prd_namespace
oke_cluster_deploy_environment_id = oci_devops_deploy_environment.test_environment.id
deploy_stage_predecessor_collection {
items {
id = oci_devops_deploy_stage.production_release_approval.id
}
}
rollback_policy {
policy_type = var.deploy_rollback_policy
}
timeouts {}
}