Skip to content

Commit

Permalink
Merge pull request #3 from oracle-quickstart/bufix/k8sprovider2
Browse files Browse the repository at this point in the history
upgrade version to get around kubernetes provider issue
  • Loading branch information
streamnsight authored Mar 14, 2023
2 parents d1a3db6 + 41fe57c commit 30f5ac3
Show file tree
Hide file tree
Showing 10 changed files with 377 additions and 747 deletions.
182 changes: 0 additions & 182 deletions cluster_autoscaler.yaml

This file was deleted.

1 change: 1 addition & 0 deletions datasources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ data "oci_identity_regions" "home_region" {

# Gets kubeconfig
data "oci_containerengine_cluster_kube_config" "oke" {
depends_on = [oci_containerengine_cluster.oci_oke_cluster]
cluster_id = oci_containerengine_cluster.oci_oke_cluster.id
}

Expand Down
85 changes: 19 additions & 66 deletions helm_cert_manager.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,75 +8,28 @@ locals {
enable_cert_manager = var.enable_flink ? true : var.enable_cert_manager
}

# resource "helm_release" "cert_manager" {
# count = local.enable_cert_manager ? 1 : 0
# name = "cert-manager"
# repository = "https://charts.jetstack.io"
# chart = "cert-manager"
# version = "1.8.2"
# namespace = "cert-manager"
# create_namespace = true
# wait = true # wait to allow the webhook be properly configured

# set {
# name = "installCRDs"
# value = true
# }

# set {
# name = "webhook.timeoutSeconds"
# value = "30"
# }
# depends_on = [oci_containerengine_cluster.oci_oke_cluster]
# }


resource "null_resource" "cert_manager" {
count = local.enable_cert_manager ? 1 : 0

provisioner "local-exec" {
command = "mkdir -p ~/.kube/ && oci ce cluster create-kubeconfig --cluster-id $CLUSTER_ID --file ~/.kube/config --region us-sanjose-1 --token-version 2.0.0 --kube-endpoint $ENDPOINT_TYPE"

environment = {
CLUSTER_ID = oci_containerengine_cluster.oci_oke_cluster.id
ENDPOINT_TYPE = var.is_endpoint_public ? "PUBLIC_ENDPOINT" : "PRIVATE_ENDPOINT"
}
resource "helm_release" "cert_manager" {
count = local.enable_cert_manager ? 1 : 0
name = "cert-manager"
repository = "https://charts.jetstack.io"
chart = "cert-manager"
version = "1.8.2"
namespace = "cert-manager"
create_namespace = true
timeout = "600"
wait = true # wait to allow the webhook be properly configured

set {
name = "installCRDs"
value = true
}

provisioner "local-exec" {
command = "helm repo add cert-manager https://charts.jetstack.io"
set {
name = "webhook.timeoutSeconds"
value = "30"
}


provisioner "local-exec" {
command = "kubectl create ns cert-manager"
}

provisioner "local-exec" {
command = "helm install cert-manager cert-manager/cert-manager -n cert-manager --version 1.8.2 --set installCRDs=true --set webhook.timeoutSeconds=30 --wait"
}

provisioner "local-exec" {
when = destroy
command = "helm uninstall cert-manager -n cert-manager"
on_failure = continue
}

provisioner "local-exec" {
when = destroy
command = "helm repo remove cert-manager"
on_failure = continue
}

provisioner "local-exec" {
when = destroy
command = "kubectl delete ns cert-manager"
on_failure = continue
}

depends_on = [
oci_containerengine_cluster.oci_oke_cluster,
oci_containerengine_node_pool.oci_oke_node_pool
data.oci_containerengine_cluster_kube_config.oke,
oci_containerengine_cluster.oci_oke_cluster
]

}
71 changes: 11 additions & 60 deletions helm_flink.tf
Original file line number Diff line number Diff line change
@@ -1,68 +1,19 @@
## Copyright © 2022, Oracle and/or its affiliates.
## Copyright © 2022-2023, 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 "helm_release" "flink_operator" {
# count = var.enable_flink ? 1 : 0
# name = "flink-operator"
# repository = "https://downloads.apache.org/flink/flink-kubernetes-operator-1.3.1/"
# chart = "flink-kubernetes-operator"
# namespace = "flink"
# create_namespace = true
# wait = true

# depends_on = [
# oci_containerengine_cluster.oci_oke_cluster,
# helm_release.cert_manager
# ]
# }


resource "null_resource" "flink_operator" {
count = var.enable_flink ? 1 : 0

provisioner "local-exec" {
command = "mkdir -p ~/.kube/ && oci ce cluster create-kubeconfig --cluster-id $CLUSTER_ID --file ~/.kube/config --region us-sanjose-1 --token-version 2.0.0 --kube-endpoint $ENDPOINT_TYPE"

environment = {
CLUSTER_ID = oci_containerengine_cluster.oci_oke_cluster.id
ENDPOINT_TYPE = var.is_endpoint_public ? "PUBLIC_ENDPOINT" : "PRIVATE_ENDPOINT"
}
}

provisioner "local-exec" {
command = "helm repo add flink-kubernetes-operator https://downloads.apache.org/flink/flink-kubernetes-operator-1.3.1/"
}

provisioner "local-exec" {
command = "kubectl create ns flink"
}

provisioner "local-exec" {
command = "helm install flink-operator flink-kubernetes-operator/flink-kubernetes-operator -n flink --wait"
}

provisioner "local-exec" {
when = destroy
command = "helm uninstall flink-operator -n flink"
on_failure = continue
}

provisioner "local-exec" {
when = destroy
command = "helm repo remove flink-kubernetes-operator"
on_failure = continue
}

provisioner "local-exec" {
when = destroy
command = "kubectl delete ns flink"
on_failure = continue
}
resource "helm_release" "flink_operator" {
count = var.enable_flink ? 1 : 0
name = "flink-operator"
repository = "https://downloads.apache.org/flink/flink-kubernetes-operator-1.3.1/"
chart = "flink-kubernetes-operator"
namespace = "flink"
create_namespace = true
wait = true

depends_on = [
data.oci_containerengine_cluster_kube_config.oke,
oci_containerengine_cluster.oci_oke_cluster,
oci_containerengine_node_pool.oci_oke_node_pool,
null_resource.cert_manager
helm_release.cert_manager
]

}
Loading

0 comments on commit 30f5ac3

Please sign in to comment.