Skip to content

Commit e903808

Browse files
authored
Merge pull request #13 from paulparkinson/main
remove auto oke creation, now byo k8s
2 parents a386210 + 1702b30 commit e903808

File tree

5 files changed

+83
-48
lines changed

5 files changed

+83
-48
lines changed

grabdish/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44

55
#MS="frontend-helidon order-helidon supplier-helidon-se inventory-helidon inventory-springboot"
6-
MS="frontend-helidon order-helidon supplier-helidon-se inventory-helidon foodwinepairing-python"
6+
MS="frontend-helidon order-helidon supplier-helidon-se inventory-helidon"
77
for s in $MS; do
88
echo ________________________________________
99
echo "Deploying $s..."

infra/k8s/oke/terraform/containerengine.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ resource "oci_containerengine_node_pool" "okell_node_pool" {
3939
compartment_id = var.ociCompartmentOcid
4040
kubernetes_version = var.kubernetes_version
4141
name = "Pool"
42-
node_shape = "VM.Standard.E2.1"
42+
node_shape = "VM.Standard.E3.Flex"
4343
node_config_details {
4444
placement_configs {
4545
availability_domain = data.oci_identity_availability_domain.ad1.name
@@ -51,6 +51,12 @@ resource "oci_containerengine_node_pool" "okell_node_pool" {
5151
image_id = local.oracle_linux_images.0 # Latest
5252
source_type = "IMAGE"
5353
}
54+
55+
node_shape_config {
56+
memory_in_gbs = 16 # Specify the memory size in GBs
57+
ocpus = 1 # Specify the number of OCPUs
58+
}
59+
5460
}
5561

5662
data "oci_containerengine_node_pool_option" "okell_node_pool_option" {

infra/k8s/oke/terraform/main_var.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ variable "vcnOcid" {}
99
variable "kubernetes_version" {
1010
description = "OKE Version"
1111
type = string
12-
default = "v1.29.1"
12+
default = "v1.31.1"
1313
}

workshops/dcms-oci/config/threads/k8s/apply.sh

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fi
1212

1313

1414
# Wait for dependencies
15-
DEPENDENCIES='COMPARTMENT_OCID OCI_REGION TENANCY_OCID OKE_LIMIT_CHECK'
15+
DEPENDENCIES='COMPARTMENT_OCID OCI_REGION TENANCY_OCID'
1616
while ! test -z "$DEPENDENCIES"; do
1717
echo "Waiting for $DEPENDENCIES"
1818
WAITING_FOR=""
@@ -24,48 +24,6 @@ while ! test -z "$DEPENDENCIES"; do
2424
DEPENDENCIES="$WAITING_FOR"
2525
sleep 1
2626
done
27-
28-
29-
# Provision the VCN, unless live labs
30-
if ! state_done VCN_OCID; then
31-
if test $(state_get RUN_TYPE) != "LL"; then
32-
# Need to provision network
33-
STATE=$DCMS_INFRA_STATE/network
34-
mkdir -p $STATE
35-
cd $STATE
36-
cat >$STATE/input.env <<!
37-
COMPARTMENT_OCID=$(state_get COMPARTMENT_OCID)
38-
OCI_REGION=$(state_get OCI_REGION)
39-
VCN_DNS_LABEL=dcmsoci
40-
!
41-
provisioning-apply $MSDD_INFRA_CODE/network/oci
42-
(
43-
source $STATE/output.env
44-
state_set VCN_OCID "$VCN_OCID"
45-
)
46-
else
47-
state_set VCN_OCID "NA"
48-
fi
49-
fi
50-
51-
52-
# Provision OKE
53-
if test $(state_get RUN_TYPE) == "LL"; then
54-
# OKE is already provisioned. Just need to get the OKE OCID and configure kubectl
55-
OKE_OCID=`oci ce cluster list --compartment-id "$(state_get COMPARTMENT_OCID)" --query "join(' ',data[?"'"lifecycle-state"'"=='ACTIVE'].id)" --raw-output`
56-
oci ce cluster create-kubeconfig --cluster-id "$OKE_OCID" --file $HOME/.kube/config --region "$REGION" --token-version 2.0.0
57-
else
58-
STATE=$DCMS_INFRA_STATE/k8s
59-
mkdir -p $STATE
60-
cd $STATE
61-
cat >$STATE/input.env <<!
62-
COMPARTMENT_OCID=$(state_get COMPARTMENT_OCID)
63-
OCI_REGION=$(state_get OCI_REGION)
64-
TENANCY_OCID=$(state_get TENANCY_OCID)
65-
VCN_OCID=$(state_get VCN_OCID)
66-
!
67-
provisioning-apply $MSDD_INFRA_CODE/k8s/oke
68-
fi
69-
27+
state_set VCN_OCID "NA"
7028
echo "" > $OUTPUT_FILE
71-
state_set_done K8S_THREAD
29+
#state_set_done K8S_THREAD
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
# Copyright (c) 2021 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
# Fail on error
6+
set -e
7+
8+
9+
if ! provisioning-helper-pre-apply; then
10+
exit 1
11+
fi
12+
13+
14+
# Wait for dependencies
15+
DEPENDENCIES='COMPARTMENT_OCID OCI_REGION TENANCY_OCID OKE_LIMIT_CHECK'
16+
while ! test -z "$DEPENDENCIES"; do
17+
echo "Waiting for $DEPENDENCIES"
18+
WAITING_FOR=""
19+
for d in $DEPENDENCIES; do
20+
if ! state_done $d; then
21+
WAITING_FOR="$WAITING_FOR $d"
22+
fi
23+
done
24+
DEPENDENCIES="$WAITING_FOR"
25+
sleep 1
26+
done
27+
28+
29+
# Provision the VCN, unless live labs
30+
if ! state_done VCN_OCID; then
31+
if test $(state_get RUN_TYPE) != "LL"; then
32+
# Need to provision network
33+
STATE=$DCMS_INFRA_STATE/network
34+
mkdir -p $STATE
35+
cd $STATE
36+
cat >$STATE/input.env <<!
37+
COMPARTMENT_OCID=$(state_get COMPARTMENT_OCID)
38+
OCI_REGION=$(state_get OCI_REGION)
39+
VCN_DNS_LABEL=dcmsoci
40+
!
41+
provisioning-apply $MSDD_INFRA_CODE/network/oci
42+
(
43+
source $STATE/output.env
44+
state_set VCN_OCID "$VCN_OCID"
45+
)
46+
else
47+
state_set VCN_OCID "NA"
48+
fi
49+
fi
50+
51+
52+
# Provision OKE
53+
if test $(state_get RUN_TYPE) == "LL"; then
54+
# OKE is already provisioned. Just need to get the OKE OCID and configure kubectl
55+
OKE_OCID=`oci ce cluster list --compartment-id "$(state_get COMPARTMENT_OCID)" --query "join(' ',data[?"'"lifecycle-state"'"=='ACTIVE'].id)" --raw-output`
56+
oci ce cluster create-kubeconfig --cluster-id "$OKE_OCID" --file $HOME/.kube/config --region "$REGION" --token-version 2.0.0
57+
else
58+
STATE=$DCMS_INFRA_STATE/k8s
59+
mkdir -p $STATE
60+
cd $STATE
61+
cat >$STATE/input.env <<!
62+
COMPARTMENT_OCID=$(state_get COMPARTMENT_OCID)
63+
OCI_REGION=$(state_get OCI_REGION)
64+
TENANCY_OCID=$(state_get TENANCY_OCID)
65+
VCN_OCID=$(state_get VCN_OCID)
66+
!
67+
provisioning-apply $MSDD_INFRA_CODE/k8s/oke
68+
fi
69+
70+
echo "" > $OUTPUT_FILE
71+
state_set_done K8S_THREAD

0 commit comments

Comments
 (0)