Skip to content

Commit 19b586d

Browse files
robo-caphyder
authored andcommitted
Add support for cri-o short container image name
1 parent 4aa4c21 commit 19b586d

File tree

4 files changed

+42
-7
lines changed

4 files changed

+42
-7
lines changed

module-workers.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ module "workers" {
3131
ad_numbers_to_names = local.ad_numbers_to_names
3232

3333
# Cluster
34-
apiserver_private_host = local.apiserver_private_host
35-
cluster_ca_cert = local.cluster_ca_cert
36-
cluster_dns = var.cluster_dns
37-
cluster_id = coalesce(var.cluster_id, one(module.cluster[*].cluster_id))
38-
cluster_type = var.cluster_type
39-
kubernetes_version = var.kubernetes_version
34+
apiserver_private_host = local.apiserver_private_host
35+
cluster_ca_cert = local.cluster_ca_cert
36+
cluster_dns = var.cluster_dns
37+
cluster_id = coalesce(var.cluster_id, one(module.cluster[*].cluster_id))
38+
cluster_type = var.cluster_type
39+
kubernetes_version = var.kubernetes_version
40+
allow_short_container_image_names = var.allow_short_container_image_names
4041

4142
# Compute clusters
4243
compute_clusters = var.worker_compute_clusters

modules/workers/cloudinit.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,28 @@ data "cloudinit_config" "workers" {
9696
}
9797
}
9898

99+
# Disable CRI-O enforce shortnames mode (for versions greater than 1.34)
100+
dynamic "part" {
101+
for_each = tonumber(split(".", each.value.kubernetes_version)[1]) >= 34 && var.allow_short_container_image_names ? [1] : []
102+
content {
103+
content_type = "text/cloud-config"
104+
content = jsonencode({
105+
write_files = [
106+
{
107+
content = <<-EOT
108+
[crio.image]
109+
short_name_mode = "disabled"
110+
EOT
111+
path = "/etc/crio/crio.conf.d/11-default.conf"
112+
}
113+
]
114+
})
115+
filename = "50-crio-config.yml"
116+
merge_type = local.default_cloud_init_merge_type
117+
}
118+
}
119+
120+
99121
# OKE setup and initialization for Ubuntu images
100122
dynamic "part" {
101123
for_each = !each.value.disable_default_cloud_init && lookup(local.ubuntu_worker_pools, each.key, null) != null ? [1] : []

modules/workers/variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ variable "legacy_imds_endpoints_disabled" {
297297
type = bool
298298
}
299299

300+
variable "allow_short_container_image_names" {
301+
default = false
302+
description = "Whether to allow short container image names for K8s version >= 1.34.0. See <a href=https://github.com/cri-o/cri-o/pull/9401>CRI-O pull request</a> for more information."
303+
type = bool
304+
}
305+
300306
variable "platform_config" {
301307
default = null
302308
description = "Default platform_config for self-managed worker pools created with mode: 'instance', 'instance-pool', or 'cluster-network'. See <a href=https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/PlatformConfig>PlatformConfig</a> for more information."
@@ -316,7 +322,7 @@ variable "platform_config" {
316322
}
317323

318324
variable "agent_config" {
319-
description = "Default agent_config for self-managed worker pools created with mode: 'instance', 'instance-pool', or 'cluster-network'. See <a href=https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/InstanceAgentConfig for more information."
325+
description = "Default agent_config for self-managed worker pools created with mode: 'instance', 'instance-pool', or 'cluster-network'. See <a href=https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/InstanceAgentConfig>InstanceConfig</a> for more information."
320326
type = object({
321327
are_all_plugins_disabled = bool,
322328
is_management_disabled = bool,

variables-workers.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,9 @@ variable "agent_config" {
251251
plugins_config = map(string),
252252
})
253253
}
254+
255+
variable "allow_short_container_image_names" {
256+
default = false
257+
description = "Whether to allow short container image names for K8s version >= 1.34.0. See <a href=https://github.com/cri-o/cri-o/pull/9401>CRI-O pull request</a> for more information."
258+
type = bool
259+
}

0 commit comments

Comments
 (0)