diff --git a/examples/gcp/cloud-sql/README.md b/examples/gcp/cloud-sql/README.md index 8e039dcf..258a515b 100644 --- a/examples/gcp/cloud-sql/README.md +++ b/examples/gcp/cloud-sql/README.md @@ -1,64 +1,53 @@ -# CloudSQL example +# CloudSQL -This example creates a ResourceGraphDefinition called `CloudSQL` to deploy Cloud SQL instance in 2 regions as a primary replica pair. +This example show how you can use KRO to deploy GCP Cloud SQL instance in 2 regions as a primary and replica instances. -## Create ResourceGraphDefinitions -Apply the RGD to your cluster: +## End User: CloudSQL +The administrator needs to install the RGD first. +The end user creates a `CloudSQL` resource that looks like this: +```yaml +apiVersion: kro.run/v1alpha1 +kind: CloudSQL +metadata: + name: demo + namespace: config-connector +spec: + name: demo + project: my-gcp-project + primaryRegion: us-central1 + replicaRegion: us-west1 ``` -kubectl apply -f rgd.yaml -``` - -Validate the RGD: -``` -> kubectl get rgd cloudsql.kro.run -NAME APIVERSION KIND STATE AGE -cloudsql.kro.run v1alpha1 CloudSQL Active 44m -``` +The status of the applied resource can be checked using: -## Create an Instance of CloudSQL -Set the env variables used in the instance template: ``` -export CLOUDSQL_NAME=demo -export GCP_PROJECT=myproject -export PRIMARY_REGION=us-central1 -export REPLICA_REGION=us-west1 +kubectl get cloudsqls +kubectl get cloudsql demo -n config-connector -o yaml ``` -Run the following command to replace the env variables in `instance-template.yaml` file and create -a new file called instance.yaml. -```shell -envsubst < "instance-template.yaml" > "instance.yaml" -``` +Navigate to CloudSQL page in the GCP Console and verify the creation of primary and replica instances. -Apply the `instance.yaml` +Once done, the user can delete the `CloudSQL` instance: ``` -kubectl apply -f instance.yaml +kubectl delete cloudsql demo -n config-connector ``` -Validate instance status: +## Administrator: ResourceGraphDefinition +The administrator needs to install the RGD in the cluster first before the user can consume it: ``` -kubectl get cloudsqls +kubectl apply -f rgd.yaml ``` -## Validate - -Navigate to CloudSQL page in the GCP Console and verify the creation of primary and replica instances. - -## Clean up - -Remove the instance: +Validate the RGD is installed correctly: ``` -kubectl delete cloudsql $CLOUDSQL_NAME +> kubectl get rgd cloudsql.kro.run +NAME APIVERSION KIND STATE AGE +cloudsql.kro.run v1alpha1 CloudSQL Active 44m ``` -Remove the ResourceGraphDefinitions: - -``` -kubectl delete rgd cloudsql.kro.run -``` +Once all user created instances are deleted, the administrator can choose to deleted the RGD. \ No newline at end of file diff --git a/examples/gcp/cloud-sql/instance-template.yaml b/examples/gcp/cloud-sql/instance-template.yaml deleted file mode 100644 index 952a8e29..00000000 --- a/examples/gcp/cloud-sql/instance-template.yaml +++ /dev/null @@ -1,11 +0,0 @@ -## CloudSQL -apiVersion: kro.run/v1alpha1 -kind: CloudSQL -metadata: - name: $CLOUDSQL_NAME - namespace: config-connector -spec: - name: $CLOUDSQL_NAME - project: $GCP_PROJECT - primaryRegion: $PRIMARY_REGION - replicaRegion: $REPLICA_REGION diff --git a/examples/gcp/gke-cluster/README.md b/examples/gcp/gke-cluster/README.md index 911a5d33..b9bfd8e0 100644 --- a/examples/gcp/gke-cluster/README.md +++ b/examples/gcp/gke-cluster/README.md @@ -1,4 +1,4 @@ -# GKE cluster definition +# GKECluster A **Platform Administrator** wants to give end users in their organization self-service access to create GKE clusters. The platform administrator creates a kro ResourceGraphDefinition called *gkecluster.kro.run* that defines the required Kubernetes resources and a CRD called *GKEcluster* that exposes only the options they want to be configurable by end users. The ResourceGraphDefinition would define the following resources (using [KCC](https://github.com/GoogleCloudPlatform/k8s-config-connector) to provide the mappings from K8s CRDs to Google Cloud APIs): @@ -9,74 +9,53 @@ A **Platform Administrator** wants to give end users in their organization self- * KMSKeyRing - Encrypt BootDisk * KMSCryptoKey - Encrypt BootDisk -The platform administrator would define the schema for `GKECluster` CRD which the end user creates: -* name: same for all GCP resources created -* location: region to be used for the GCP resources -* maxnodes: Max scaling limit for the nodes in the node pool - Everything related to these resources would be hidden from the end user, simplifying their experience. ![GKE Cluster Stack](gke-cluster.png) +## End User: GKECluster -# GKECluster example - -This example creates a ResourceGraphDefinition called `GKECluster` to deploy a GKE cluster. - -## Create ResourceGraphDefinitions +The administrator needs to install the RGD first. +The end user creates a `GKECluster` resource something like this: -Apply the RGD to your cluster: - -``` -kubectl apply -f rgd.yaml +```yaml +apiVersion: kro.run/v1alpha1 +kind: GKECluster +metadata: + name: krodemo + namespace: config-connector +spec: + name: krodemo # Name used for all resources created as part of this RGD + location: us-central1 # Region where the GCP resources are created + maxnodes: 4 # Max scaling limit for the nodes in the new nodepool ``` -Validate the RGD: +They can then check the status of the applied resource: ``` -kubectl get rgd +kubectl get gkeclusters +kubectl get gkeclusters krodemo -n config-connector -o yaml ``` -## Create an Instance of CloudSQL -Set the env variables used in the instance template: -``` -export CLUSTER_NAME=krodemo -export GCP_REGION=us-central1 -export MAX_NODES=4 -``` +Navigate to GKE Cluster page in the GCP Console and verify the cluster creation. -Run the following command to replace the env variables in `instance-template.yaml` file and create -a new file called instance.yaml. -```shell -envsubst < "instance-template.yaml" > "instance.yaml" -``` - -Apply the `instance.yaml` +Once done, the user can delete the `GKECluster` instance: ``` -kubectl apply -f instance.yaml +kubectl delete gkecluster krodemo -n config-connector ``` -Validate instance status: +## Administrator: ResourceGraphDefinition +The administrator needs to install the RGD in the cluster first before the user can consume it: ``` -kubectl get gkeclusters +kubectl apply -f rgd.yaml ``` -## Validate - -Navigate to GKE Cluster page in the GCP Console and verify the cluster. - -## Clean up - -Remove the instance: +Validate the RGD is installed correctly: ``` -kubectl delete gkecluster $CLUSTER_NAME +kubectl get rgd gkecluster.kro.run ``` -Remove the ResourceGraphDefinitions: - -``` -kubectl delete rgd gkecluster.kro.run -``` +Once all user created instances are deleted, the administrator can choose to deleted the RGD. \ No newline at end of file diff --git a/examples/gcp/gke-cluster/instance-template.yaml b/examples/gcp/gke-cluster/instance-template.yaml deleted file mode 100644 index 5c415a4f..00000000 --- a/examples/gcp/gke-cluster/instance-template.yaml +++ /dev/null @@ -1,10 +0,0 @@ -## CloudSQL -apiVersion: kro.run/v1alpha1 -kind: GKECluster -metadata: - name: $CLUSTER_NAME - namespace: config-connector -spec: - name: $CLUSTER_NAME - location: $GCP_REGION - maxnodes: $MAX_NODES diff --git a/scripts/update-doc-examples.sh b/scripts/update-doc-examples.sh new file mode 100755 index 00000000..db9b72f8 --- /dev/null +++ b/scripts/update-doc-examples.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +create_example() { + out_file=$1 + position=$2 + readme_file=$3 + rgd_file=$4 + + # Verify all parameters are valid + if [ -z "$out_file" ] || [ -z "$position" ] || [ -z "$readme_file" ] || [ -z "$rgd_file" ]; then + echo "Error: Missing required parameters" + echo "Usage: create_example " + return 1 + fi + + + cat > "$out_file" << EOF +--- +sidebar_position: $position +--- + +$(cat $readme_file) + +
+ ResourceGraphDefinition + \`\`\`yaml title="rgd.yaml" +$(cat "$yaml_file") + \`\`\` +
+EOF + +} + +update_gcp_example_docs() { + # Create the GCP examples directory if it doesn't exist + mkdir -p website/docs/examples/gcp + # Initialize position counter + position=405 + # Find all rgd.yaml files in examples/gcp directory and its subdirectories + find examples/gcp -name "rgd.yaml" | while read -r yaml_file; do + # Extract the directory name as the example name + example_path=$(dirname "$yaml_file") + dir_name=$(basename $example_path) + readme_file=$example_path/README.md + out_file="website/docs/examples/gcp/${dir_name}.md" + + # Convert directory name to title case (e.g., gke-cluster -> GKE Cluster) + # title=$(echo "$dir_name" | sed -E 's/-/ /g' | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1') + + # copy all images + cp $example_path/*.png website/docs/examples/gcp/ 2>/dev/null + # Generate the markdown content + create_example "$out_file" "$position" "$readme_file" "$yaml_file" + + # Increment position for next file + ((position+=1)) + + echo "Generated documentation for ${dir_name} at ${out_file}" + done +} + +update_aws_example_docs() { + echo "TODO: implement aws examples" +} +update_azure_example_docs() { + echo "TODO: implement azure examples" +} +update_kubernetes_example_docs() { + echo "TODO: implement kubernetes examples" +} + +update_gcp_example_docs +update_aws_example_docs +update_azure_example_docs +update_kubernetes_example_docs \ No newline at end of file diff --git a/website/docs/examples/ack-eks-cluster.md b/website/docs/examples/aws/ack-eks-cluster.md similarity index 100% rename from website/docs/examples/ack-eks-cluster.md rename to website/docs/examples/aws/ack-eks-cluster.md diff --git a/website/docs/examples/ack-networking-stack.md b/website/docs/examples/aws/ack-networking-stack.md similarity index 100% rename from website/docs/examples/ack-networking-stack.md rename to website/docs/examples/aws/ack-networking-stack.md diff --git a/website/docs/examples/ack-valkey-cachecluster.md b/website/docs/examples/aws/ack-valkey-cachecluster.md similarity index 100% rename from website/docs/examples/ack-valkey-cachecluster.md rename to website/docs/examples/aws/ack-valkey-cachecluster.md diff --git a/website/docs/examples/aws/category.json b/website/docs/examples/aws/category.json new file mode 100644 index 00000000..ce984a93 --- /dev/null +++ b/website/docs/examples/aws/category.json @@ -0,0 +1,10 @@ +{ + "label": "AWS Examples", + "position": 300, + "link": { + "type": "generated-index", + "description": "Examples of using Kro with AWS" + }, + "collapsible": true, + "collapsed": true +} diff --git a/website/docs/examples/deploying-controller.md b/website/docs/examples/aws/deploying-controller.md similarity index 100% rename from website/docs/examples/deploying-controller.md rename to website/docs/examples/aws/deploying-controller.md diff --git a/website/docs/examples/pod-rds-dbinstance.md b/website/docs/examples/aws/pod-rds-dbinstance.md similarity index 100% rename from website/docs/examples/pod-rds-dbinstance.md rename to website/docs/examples/aws/pod-rds-dbinstance.md diff --git a/website/docs/examples/azure/category.json b/website/docs/examples/azure/category.json new file mode 100644 index 00000000..2298240e --- /dev/null +++ b/website/docs/examples/azure/category.json @@ -0,0 +1,10 @@ +{ + "label": "Azure Examples", + "position": 500, + "link": { + "type": "generated-index", + "description": "Examples of using Kro with Microsoft Azure" + }, + "collapsible": true, + "collapsed": true +} \ No newline at end of file diff --git a/website/docs/examples/basic/category.json b/website/docs/examples/basic/category.json new file mode 100644 index 00000000..02167280 --- /dev/null +++ b/website/docs/examples/basic/category.json @@ -0,0 +1,10 @@ +{ + "label": "Basic Examples", + "position": 100, + "link": { + "type": "generated-index", + "description": "Basic examples to get started with Kro" + }, + "collapsible": true, + "collapsed": true +} \ No newline at end of file diff --git a/website/docs/examples/noop.md b/website/docs/examples/basic/noop.md similarity index 100% rename from website/docs/examples/noop.md rename to website/docs/examples/basic/noop.md diff --git a/website/docs/examples/web-app-ingress.md b/website/docs/examples/basic/web-app-ingress.md similarity index 100% rename from website/docs/examples/web-app-ingress.md rename to website/docs/examples/basic/web-app-ingress.md diff --git a/website/docs/examples/web-app.md b/website/docs/examples/basic/web-app.md similarity index 100% rename from website/docs/examples/web-app.md rename to website/docs/examples/basic/web-app.md diff --git a/website/docs/examples/gcp/category.json b/website/docs/examples/gcp/category.json new file mode 100644 index 00000000..4277df41 --- /dev/null +++ b/website/docs/examples/gcp/category.json @@ -0,0 +1,10 @@ +{ + "label": "GCP Examples", + "position": 400, + "link": { + "type": "generated-index", + "description": "Examples of using Kro with Google Cloud Platform" + }, + "collapsible": true, + "collapsed": true +} \ No newline at end of file diff --git a/website/docs/examples/gcp/cloud-sql.md b/website/docs/examples/gcp/cloud-sql.md new file mode 100644 index 00000000..c3eb689d --- /dev/null +++ b/website/docs/examples/gcp/cloud-sql.md @@ -0,0 +1,274 @@ +--- +sidebar_position: 406 +--- + +# CloudSQL + +This example show how you can use KRO to deploy GCP Cloud SQL instance in 2 regions as a primary and replica instances. + + +## End User: CloudSQL +The administrator needs to install the RGD first. +The end user creates a `CloudSQL` resource that looks like this: + +```yaml +apiVersion: kro.run/v1alpha1 +kind: CloudSQL +metadata: + name: demo + namespace: config-connector +spec: + name: demo + project: my-gcp-project + primaryRegion: us-central1 + replicaRegion: us-west1 +``` + +The status of the applied resource can be checked using: + +``` +kubectl get cloudsqls +kubectl get cloudsql demo -n config-connector -o yaml +``` + +Navigate to CloudSQL page in the GCP Console and verify the creation of primary and replica instances. + +Once done, the user can delete the `CloudSQL` instance: + +``` +kubectl delete cloudsql demo -n config-connector +``` + +## Administrator: ResourceGraphDefinition +The administrator needs to install the RGD in the cluster first before the user can consume it: + +``` +kubectl apply -f rgd.yaml +``` + +Validate the RGD is installed correctly: + +``` +> kubectl get rgd cloudsql.kro.run +NAME APIVERSION KIND STATE AGE +cloudsql.kro.run v1alpha1 CloudSQL Active 44m +``` + +Once all user created instances are deleted, the administrator can choose to deleted the RGD. + +
+ ResourceGraphDefinition + ```yaml title="rgd.yaml" +apiVersion: kro.run/v1alpha1 +kind: ResourceGraphDefinition +metadata: + name: cloudsql.kro.run +spec: + schema: + apiVersion: v1alpha1 + kind: CloudSQL + spec: + name: string + project: string + primaryRegion: string + replicaRegion: string + status: + connectionName: ${sqlPrimary.status.connectionName} + ipAddress: ${sqlPrimary.status.firstIpAddress} + resources: + - id: cloudkmsEnable + template: + apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1 + kind: Service + metadata: + annotations: + cnrm.cloud.google.com/deletion-policy: "abandon" + cnrm.cloud.google.com/disable-dependent-services: "false" + name: cloudkms-enablement + spec: + resourceID: cloudkms.googleapis.com + - id: iamEnable + template: + apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1 + kind: Service + metadata: + annotations: + cnrm.cloud.google.com/deletion-policy: "abandon" + cnrm.cloud.google.com/disable-dependent-services: "false" + name: iam-enablement + spec: + resourceID: iam.googleapis.com + - id: serviceUsageEnable + template: + apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1 + kind: Service + metadata: + annotations: + cnrm.cloud.google.com/deletion-policy: "abandon" + cnrm.cloud.google.com/disable-dependent-services: "false" + name: serviceusage-enablement + spec: + resourceID: serviceusage.googleapis.com + - id: sqlAdminEnable + template: + apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1 + kind: Service + metadata: + annotations: + cnrm.cloud.google.com/deletion-policy: "abandon" + cnrm.cloud.google.com/disable-dependent-services: "false" + name: sqladmin-enablement + spec: + resourceID: sqladmin.googleapis.com + - id: serviceidentity + template: + apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1 + kind: ServiceIdentity + metadata: + labels: + enabled-service: ${serviceUsageEnable.metadata.name} + name: sqladmin.googleapis.com + spec: + projectRef: + external: ${schema.spec.project} + - id: keyringPrimary + template: + apiVersion: kms.cnrm.cloud.google.com/v1beta1 + kind: KMSKeyRing + metadata: + labels: + enabled-service: ${cloudkmsEnable.metadata.name} + name: ${schema.spec.name}-primary + spec: + location: ${schema.spec.primaryRegion} + - id: keyringReplica + template: + apiVersion: kms.cnrm.cloud.google.com/v1beta1 + kind: KMSKeyRing + metadata: + labels: + enabled-service: ${cloudkmsEnable.metadata.name} + name: ${schema.spec.name}-replica + spec: + location: ${schema.spec.replicaRegion} + - id: kmskeyPrimary + template: + apiVersion: kms.cnrm.cloud.google.com/v1beta1 + kind: KMSCryptoKey + metadata: + labels: + enabled-service: ${cloudkmsEnable.metadata.name} + failure-zone: ${schema.spec.primaryRegion} + name: ${schema.spec.name}-primary + spec: + keyRingRef: + name: ${keyringPrimary.metadata.name} + #namespace: {{ cloudsqls.metadata.namespace }} + purpose: ENCRYPT_DECRYPT + versionTemplate: + algorithm: GOOGLE_SYMMETRIC_ENCRYPTION + protectionLevel: SOFTWARE + importOnly: false + - id: kmskeyReplica + template: + apiVersion: kms.cnrm.cloud.google.com/v1beta1 + kind: KMSCryptoKey + metadata: + labels: + enabled-service: ${cloudkmsEnable.metadata.name} + failure-zone: ${schema.spec.replicaRegion} + name: ${schema.spec.name}-replica + spec: + keyRingRef: + name: ${keyringReplica.metadata.name} + #namespace: {{ cloudsqls.metadata.namespace }} + purpose: ENCRYPT_DECRYPT + versionTemplate: + algorithm: GOOGLE_SYMMETRIC_ENCRYPTION + protectionLevel: SOFTWARE + importOnly: false + - id: iampolicymemberPrimary + template: + apiVersion: iam.cnrm.cloud.google.com/v1beta1 + kind: IAMPolicyMember + metadata: + labels: + enabled-service: ${iamEnable.metadata.name} + name: sql-kms-${schema.spec.primaryRegion}-policybinding + spec: + member: serviceAccount:${serviceidentity.status.email} + role: roles/cloudkms.cryptoKeyEncrypterDecrypter + resourceRef: + kind: KMSCryptoKey + name: ${kmskeyPrimary.metadata.name}-primary + #namespace: {{ cloudsqls.metadata.namespace }} + - id: iampolicymemberReplica + template: + apiVersion: iam.cnrm.cloud.google.com/v1beta1 + kind: IAMPolicyMember + metadata: + name: sql-kms-${schema.spec.replicaRegion}-policybinding + labels: + enabled-service: ${iamEnable.metadata.name} + spec: + member: serviceAccount:${serviceidentity.status.email} + role: roles/cloudkms.cryptoKeyEncrypterDecrypter + resourceRef: + kind: KMSCryptoKey + name: ${kmskeyReplica.metadata.name}-replica + #namespace: {{ cloudsqls.metadata.namespace }} + - id: sqlPrimary + template: + apiVersion: sql.cnrm.cloud.google.com/v1beta1 + kind: SQLInstance + metadata: + annotations: + cnrm.cloud.google.com/deletion-policy: abandon + labels: + failure-zone: ${schema.spec.primaryRegion} + enabled-service: ${sqlAdminEnable.metadata.name} + name: ${schema.spec.name}-primary + spec: + databaseVersion: POSTGRES_13 + encryptionKMSCryptoKeyRef: + external: projects/${schema.spec.project}/locations/${schema.spec.primaryRegion}/keyRings/${keyringPrimary.metadata.name}/cryptoKeys/${kmskeyPrimary.metadata.name} + region: ${schema.spec.primaryRegion} + settings: + availabilityType: REGIONAL + backupConfiguration: + backupRetentionSettings: + retainedBackups: 6 + enabled: true + location: us + diskSize: 50 + diskType: PD_SSD + maintenanceWindow: + day: 7 + hour: 3 + tier: db-custom-8-30720 + - id: sqlReplica + template: + apiVersion: sql.cnrm.cloud.google.com/v1beta1 + kind: SQLInstance + metadata: + annotations: + cnrm.cloud.google.com/deletion-policy: abandon + labels: + failure-zone: ${schema.spec.replicaRegion} + enabled-service: ${sqlAdminEnable.metadata.name} + name: ${schema.spec.name}-replica + spec: + databaseVersion: POSTGRES_13 + encryptionKMSCryptoKeyRef: + external: projects/${schema.spec.project}/locations/${schema.spec.replicaRegion}/keyRings/${keyringReplica.metadata.name}/cryptoKeys/${kmskeyReplica.metadata.name} + masterInstanceRef: + name: ${schema.spec.name}-primary + #namespace: {{ cloudsqls.metadata.namespace }} + region: ${schema.spec.replicaRegion} + settings: + availabilityType: REGIONAL + diskSize: 50 + diskType: PD_SSD + tier: db-custom-8-30720 + ``` +
diff --git a/website/docs/examples/gcp/gke-cluster.md b/website/docs/examples/gcp/gke-cluster.md new file mode 100644 index 00000000..264db6ef --- /dev/null +++ b/website/docs/examples/gcp/gke-cluster.md @@ -0,0 +1,233 @@ +--- +sidebar_position: 405 +--- + +# GKECluster + +A **Platform Administrator** wants to give end users in their organization self-service access to create GKE clusters. The platform administrator creates a kro ResourceGraphDefinition called *gkecluster.kro.run* that defines the required Kubernetes resources and a CRD called *GKEcluster* that exposes only the options they want to be configurable by end users. The ResourceGraphDefinition would define the following resources (using [KCC](https://github.com/GoogleCloudPlatform/k8s-config-connector) to provide the mappings from K8s CRDs to Google Cloud APIs): + +* GKE cluster +* Container Node Pool +* Network +* Subnetwork +* KMSKeyRing - Encrypt BootDisk +* KMSCryptoKey - Encrypt BootDisk + +Everything related to these resources would be hidden from the end user, simplifying their experience. + +![GKE Cluster Stack](gke-cluster.png) + +## End User: GKECluster + +The administrator needs to install the RGD first. +The end user creates a `GKECluster` resource something like this: + +```yaml +apiVersion: kro.run/v1alpha1 +kind: GKECluster +metadata: + name: krodemo + namespace: config-connector +spec: + name: krodemo # Name used for all resources created as part of this RGD + location: us-central1 # Region where the GCP resources are created + maxnodes: 4 # Max scaling limit for the nodes in the new nodepool +``` + +They can then check the status of the applied resource: + +``` +kubectl get gkeclusters +kubectl get gkeclusters krodemo -o yaml +``` + +Navigate to GKE Cluster page in the GCP Console and verify the cluster creation. + +Once done, the user can delete the `GKECluster`: + +``` +kubectl delete gkecluster $CLUSTER_NAME +``` + +## Administrator: ResourceGraphDefinition +The administrator needs to install the RGD in the cluster first before the user can consume it: + +``` +kubectl apply -f rgd.yaml +``` + +Validate the RGD is installed correctly: + +``` +kubectl get rgd gkecluster.kro.run +``` + +Once all user created instances are deleted, the administrator can choose to deleted the RGD. + +
+ ResourceGraphDefinition + ```yaml title="rgd.yaml" +apiVersion: kro.run/v1alpha1 +kind: ResourceGraphDefinition +metadata: + name: gkecluster.kro.run +spec: + schema: + apiVersion: v1alpha1 + kind: GKECluster + spec: + name: string + nodepool: string + maxnodes: integer + location: string + status: + masterVersion: ${cluster.status.masterVersion} + resources: + - id: network + template: + apiVersion: compute.cnrm.cloud.google.com/v1beta1 + kind: ComputeNetwork + metadata: + labels: + source: "gkecluster" + name: ${schema.spec.name} + spec: + #routingMode: GLOBAL + #deleteDefaultRoutesOnCreate: false + routingMode: REGIONAL + autoCreateSubnetworks: false + - id: subnet + template: + apiVersion: compute.cnrm.cloud.google.com/v1beta1 + kind: ComputeSubnetwork + metadata: + labels: + source: "gkecluster" + name: ${network.metadata.name} + spec: + ipCidrRange: 10.2.0.0/16 + #ipCidrRange: 10.10.90.0/24 + region: ${schema.spec.location} + networkRef: + name: ${schema.spec.name} + #privateIpGoogleAccess: true + - id: topic + template: + apiVersion: pubsub.cnrm.cloud.google.com/v1beta1 + kind: PubSubTopic + metadata: + labels: + source: "gkecluster" + name: ${subnet.metadata.name} + - id: keyring + template: + apiVersion: kms.cnrm.cloud.google.com/v1beta1 + kind: KMSKeyRing + metadata: + labels: + source: "gkecluster" + name: ${topic.metadata.name} + spec: + location: ${schema.spec.location} + - id: key + template: + apiVersion: kms.cnrm.cloud.google.com/v1beta1 + kind: KMSCryptoKey + metadata: + labels: + source: "gkecluster" + name: ${keyring.metadata.name} + spec: + keyRingRef: + name: ${schema.spec.name} + purpose: ASYMMETRIC_SIGN + versionTemplate: + algorithm: EC_SIGN_P384_SHA384 + protectionLevel: SOFTWARE + importOnly: false + - id: nodepool + template: + apiVersion: container.cnrm.cloud.google.com/v1beta1 + kind: ContainerNodePool + metadata: + labels: + source: "gkecluster" + name: ${cluster.metadata.name} + spec: + location: ${schema.spec.location} + autoscaling: + minNodeCount: 1 + maxNodeCount: ${schema.spec.maxnodes} + nodeConfig: + machineType: n1-standard-1 + diskSizeGb: 100 + diskType: pd-standard + #taint: + #- effect: NO_SCHEDULE + # key: originalKey + # value: originalValue + clusterRef: + name: ${schema.spec.name} + - id: cluster + template: + apiVersion: container.cnrm.cloud.google.com/v1beta1 + kind: ContainerCluster + metadata: + #annotations: + # cnrm.cloud.google.com/remove-default-node-pool: "false" + labels: + source: "gkecluster" + name: ${key.metadata.name} + spec: + location: ${schema.spec.location} + initialNodeCount: 1 + networkRef: + name: ${schema.spec.name} + subnetworkRef: + name: ${schema.spec.name} + ipAllocationPolicy: + clusterIpv4CidrBlock: /20 + servicesIpv4CidrBlock: /20 + #masterAuth: + # clientCertificateConfig: + # issueClientCertificate: false + #workloadIdentityConfig: + # # Workload Identity supports only a single namespace based on your project name. + # # Replace ${PROJECT_ID?} below with your project ID. + # workloadPool: ${PROJECT_ID?}.svc.id.goog + notificationConfig: + pubsub: + enabled: true + topicRef: + name: ${schema.spec.name} + loggingConfig: + enableComponents: + - "SYSTEM_COMPONENTS" + - "WORKLOADS" + monitoringConfig: + enableComponents: + - "SYSTEM_COMPONENTS" + - "APISERVER" + managedPrometheus: + enabled: true + clusterAutoscaling: + enabled: true + autoscalingProfile: BALANCED + resourceLimits: + - resourceType: cpu + maximum: 100 + minimum: 10 + - resourceType: memory + maximum: 1000 + minimum: 100 + autoProvisioningDefaults: + bootDiskKMSKeyRef: + name: ${schema.spec.name} + nodeConfig: + linuxNodeConfig: + sysctls: + net.core.somaxconn: "4096" + cgroupMode: "CGROUP_MODE_UNSPECIFIED" + + ``` +
diff --git a/website/docs/examples/gcp/gke-cluster.png b/website/docs/examples/gcp/gke-cluster.png new file mode 100644 index 00000000..37eaf087 Binary files /dev/null and b/website/docs/examples/gcp/gke-cluster.png differ diff --git a/website/docs/examples/kubernetes/category.json b/website/docs/examples/kubernetes/category.json new file mode 100644 index 00000000..38a0f950 --- /dev/null +++ b/website/docs/examples/kubernetes/category.json @@ -0,0 +1,10 @@ +{ + "label": "Kubernetes Examples", + "position": 200, + "link": { + "type": "generated-index", + "description": "Examples of using Kro with Kubernetes" + }, + "collapsible": true, + "collapsed": true +} \ No newline at end of file diff --git a/website/docs/examples/deploying-coredns.md b/website/docs/examples/kubernetes/deploying-coredns.md similarity index 100% rename from website/docs/examples/deploying-coredns.md rename to website/docs/examples/kubernetes/deploying-coredns.md