-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: IaC for Azure Cluter & Azure Private Cluster (#103)
Signed-off-by: Jared Weinfurtner <jared.weinfurtner@de.bosch.com>
- Loading branch information
1 parent
dbd906b
commit 476fff7
Showing
26 changed files
with
1,723 additions
and
882 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (c) 2023-2024 - for information on the respective copyright owner see | ||
* the NOTICE file and/or the repository https://github.com/carbynestack/carbynestack. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { Construct } from "constructs"; | ||
import * as cdktf from "cdktf"; | ||
import * as helm from "@cdktf/provider-helm"; | ||
import * as kubernetes from "@cdktf/provider-kubernetes"; | ||
|
||
export interface EtcdConfig { | ||
helmProvider: cdktf.TerraformProvider; | ||
kubernetesProvider: cdktf.TerraformProvider; | ||
} | ||
|
||
export class Etcd extends Construct { | ||
public release: cdktf.TerraformResource; | ||
public etcdIp: string; | ||
|
||
constructor(scope: Construct, name: string, config: EtcdConfig) { | ||
super(scope, name); | ||
|
||
this.release = new helm.release.Release(this, `etcd`, { | ||
wait: true, | ||
waitForJobs: true, | ||
provider: config.helmProvider, | ||
timeout: 600, | ||
name: "cs-etcd", | ||
chart: "etcd", | ||
repository: "https://charts.bitnami.com/bitnami/", | ||
version: "8.3.1", | ||
set: [ | ||
{ name: "auth.rbac.create", value: "false" }, | ||
{ name: "service.type", value: "LoadBalancer" }, | ||
], | ||
}); | ||
|
||
const etcdService = | ||
new kubernetes.dataKubernetesService.DataKubernetesService( | ||
this, | ||
`etcd-service`, | ||
{ | ||
provider: config.kubernetesProvider, | ||
dependsOn: [this.release], | ||
metadata: { | ||
name: "cs-etcd", | ||
}, | ||
}, | ||
); | ||
|
||
this.etcdIp = new cdktf.TerraformOutput(this, `etcd-ingress-master-ip`, { | ||
value: etcdService.status.get(0).loadBalancer.get(0).ingress.get(0).ip, | ||
}).value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/* | ||
* Copyright (c) 2023-2024 - for information on the respective copyright owner see | ||
* the NOTICE file and/or the repository https://github.com/carbynestack/carbynestack. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { Construct } from "constructs"; | ||
import * as cdktf from "cdktf"; | ||
import * as kubernetes from "@cdktf/provider-kubernetes"; | ||
import * as kubectl from "../../.gen/providers/kubectl"; | ||
import * as http from "@cdktf/provider-http"; | ||
|
||
export interface KnativeConfig { | ||
ingressIP: string; | ||
kubernetesProvider: cdktf.TerraformProvider; | ||
kubectlProvider: cdktf.TerraformProvider; | ||
} | ||
|
||
export class Knative extends Construct { | ||
public knativeOperator: cdktf.TerraformResource; | ||
public knativeServing: cdktf.TerraformResource; | ||
|
||
constructor(scope: Construct, name: string, config: KnativeConfig) { | ||
super(scope, name); | ||
|
||
const httpProvider = new http.provider.HttpProvider( | ||
this, | ||
`provider-http-${name}`, | ||
{ | ||
alias: `provider-http-${name}`, | ||
}, | ||
); | ||
|
||
const knativeNamespace = new kubernetes.namespace.Namespace( | ||
this, | ||
`knative-namespace-${name}`, | ||
{ | ||
provider: config.kubernetesProvider, | ||
metadata: { | ||
name: "knative-serving", | ||
}, | ||
}, | ||
); | ||
|
||
const knativeOperatorYaml = new http.dataHttp.DataHttp( | ||
this, | ||
`knative-operator-yaml-${name}`, | ||
{ | ||
provider: httpProvider, | ||
url: "https://github.com/knative/operator/releases/download/knative-v1.10.2/operator.yaml", | ||
}, | ||
); | ||
|
||
const knativeOperatorManifests = | ||
new kubectl.dataKubectlFileDocuments.DataKubectlFileDocuments( | ||
this, | ||
`knative-operators-${name}`, | ||
{ | ||
provider: config.kubectlProvider, | ||
content: knativeOperatorYaml.body, | ||
}, | ||
); | ||
|
||
const knativeOperatorManifestsIter = cdktf.TerraformIterator.fromList( | ||
knativeOperatorManifests.documents, | ||
); | ||
|
||
this.knativeOperator = new kubectl.manifest.Manifest( | ||
this, | ||
`knative-operator-${name}`, | ||
{ | ||
provider: config.kubectlProvider, | ||
forEach: knativeOperatorManifestsIter, | ||
yamlBody: knativeOperatorManifestsIter.value, | ||
}, | ||
); | ||
|
||
this.knativeServing = new kubectl.manifest.Manifest( | ||
this, | ||
`knative-serving-${name}`, | ||
{ | ||
provider: config.kubectlProvider, | ||
validateSchema: true, | ||
dependsOn: [this.knativeOperator], | ||
yamlBody: ` | ||
apiVersion: operator.knative.dev/v1beta1 | ||
kind: KnativeServing | ||
metadata: | ||
name: knative-serving | ||
namespace: ${knativeNamespace.metadata.name} | ||
spec: | ||
version: 1.8.2 | ||
manifests: | ||
- URL: https://github.com/carbynestack/serving/releases/download/v1.8.2-multiport-patch/serving-crds.yaml | ||
- URL: https://github.com/carbynestack/serving/releases/download/v1.8.2-multiport-patch/serving-core.yaml | ||
- URL: https://github.com/knative/net-istio/releases/download/v1.8.2/release.yaml | ||
- URL: https://github.com/knative/net-certmanager/releases/download/v1.8.2/release.yaml | ||
config: | ||
domain: | ||
${config.ingressIP}.sslip.io: "" | ||
defaults: | ||
max-revision-timeout-seconds: "36000" | ||
`, | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.