Skip to content

Commit 0b22ad4

Browse files
author
Budi Darmawan
committed
adding cabundle for airgapped
1 parent a4c2d6b commit 0b22ad4

File tree

6 files changed

+25
-11
lines changed

6 files changed

+25
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
# .tfvars files
99
*.tfvars
1010
openshift_pull_secret.json
11+
.terraform.lock.hcl

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ Setting up the mirror repository using AWS ECR:
229229
--to-release-image=${LOCAL_REGISTRY}/${LOCAL_REPOSITORY}:${OCP_RELEASE}
230230
```
231231
232+
4. Provide the certificate(s) for the registry in a file and refers that from the vars to be included in the `install-config.yaml`.
233+
232234
Once the mirror registry is created - use the terraform.tfvars similar to below:
233235
234236
```
@@ -253,10 +255,11 @@ aws_publish_strategy = "Internal"
253255
airgapped = {
254256
enabled = true
255257
repository = "1234567812345678.dkr.ecr.us-east-1.amazonaws.com/ocp435"
258+
cabundle = "./cabundle"
256259
}
257260
```
258261
259-
**Note**: To use `airgapped.enabled` of `true` must be done with `aws_publish_strategy` of `Internal` otherwise the deployment will fail.
262+
**Note**: To use `airgapped.enabled` of `true` must be done with `aws_publish_strategy` of `Internal` otherwise the deployment will fail. Also ECR does not allow for unauthenticated image pulls, additional IAM policies must be defined and attached to the nodes to be able to pull from ECR.
260263
261264
Create your cluster and then associate the private Hosted Zone Record in Route53 with the loadbalancer for the `*.apps.<cluster>.<domain>`.
262265

config.tf

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ The name of the cluster. It will be suffixed by the base_domain to make cluster_
3838
EOF
3939
}
4040

41-
variable "aws_access_key_id" {
42-
type = string
43-
description = "AWS Key"
44-
}
45-
46-
variable "aws_secret_access_key" {
47-
type = string
48-
description = "AWS Secret"
49-
}
50-
5141
variable "openshift_pull_secret" {
5242
type = string
5343
description = "File containing pull secret - get it from https://cloud.redhat.com/openshift/install/pull-secret"

install/installer.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ aws_secret_access_key = ${var.aws_secret_access_key}
7272
EOF
7373
}
7474

75+
data "local_file" "cabundle" {
76+
count = var.airgapped["enabled"] ? 1 : 0
77+
filename = "${var.airgapped.cabundle}"
78+
}
79+
7580

7681
data "template_file" "install_config_yaml" {
7782
template = <<-EOF
@@ -117,6 +122,8 @@ sshKey: '${tls_private_key.installkey.public_key_openssh}'
117122
- mirrors:
118123
- ${var.airgapped["repository"]}
119124
source: quay.io/openshift-release-dev/ocp-v4.0-art-dev
125+
additionalTrustBundle: |
126+
${indent(2,data.local_file.cabundle[0].content)}
120127
%{endif}
121128
EOF
122129
}

install/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,6 @@ variable "airgapped" {
107107
default = {
108108
airgapped = false
109109
repository = ""
110+
cabundle = ""
110111
}
111112
}

variables-aws.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,22 @@ variable "aws_skip_region_validation" {
149149
description = "This decides if the AWS provider should validate if the region is known."
150150
}
151151

152+
153+
variable "aws_access_key_id" {
154+
type = string
155+
description = "AWS Key"
156+
}
157+
158+
variable "aws_secret_access_key" {
159+
type = string
160+
description = "AWS Secret"
161+
}
162+
152163
variable "airgapped" {
153164
type = map(string)
154165
default = {
155166
enabled = false
156167
repository = ""
168+
cabundle = ""
157169
}
158170
}

0 commit comments

Comments
 (0)