Git Product home page Git Product logo

cloud-foundation-toolkit's Introduction

Cloud Foundation Toolkit Project

Overview

The Cloud Foundation toolkit (henceforth, CFT) includes the following parts:

  • A comprehensive set of production-ready resource templates that follow Google's best practices, which can be used with the CFT or the gcloud utility (part of the Google Cloud SDK) - see the template directory
  • A command-line interface (henceforth, CLI) that deploys resources defined in single or multiple CFT-compliant config files - see:
  • A growing set of sample Config Connector YAML configurations - see the solutions directory

In addition, the CFT repository includes a sample pipeline that enables running CFT deployment operations from Jenkins - see the pipeline directory.

You can see a comparison between CFT and Fabric here.

License

Apache 2.0 - See LICENSE for more information.

cloud-foundation-toolkit's People

Contributors

aaron-lane avatar alexkonkin avatar apeabody avatar bharathkkb avatar bohdanyurov-gl avatar brianpi avatar cloud-foundation-bot avatar cray0000 avatar daniel-cit avatar dependabot[bot] avatar g-awmalik avatar gtsorbo avatar imrannayer avatar ingwarr avatar jeffmccune avatar katze120 avatar kopachevsky avatar maqiuyujoyce avatar mikeweng avatar morgante avatar nick4fake avatar ocsig avatar omazin avatar paulpalamarchuk avatar release-please[bot] avatar renovate-bot avatar sjvanrossum avatar trodge avatar umairidris avatar vardhanrao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud-foundation-toolkit's Issues

Log sink template could be more flexible

Our current deployment looks something like this:

  • Log sink deployed on project-foo
  • Get log sink writer and set in dataset
  • Deploy dataset in project-bar

Two deployments in two projects.

The current template has a few problems with this:

  • it doesn't allow cross project sinks
  • due to the writer service account being in the form seviceAccount:[email protected] the bigquery access field cannot be set.

It would be great if cross project sinks + some workaround for the dataset could be made. Perhaps it can do some project id matching inside the template and the same template can be deployed in both projects and it will be smart enough to know which resource to deploy in which project?

DM/gcs_bucket: refactoring

Relevant templates: dm/templates/gcs_bucket

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Add uniqueItems: true to lists
  • Switch to using type provider
  • Add cross-project creation support
  • Add additionalProperties: false for nested object
  • Fix "bindings" schema
  • Add support for "requesterPays"
  • Add support for "acl", "billing", "cors", "defaultEventBasedHold", "defaultObjectAcl", "encryption", "iamConfiguration", "retentionPolicy": docs
  • Fix resource name

DM/instance_template: refactoring

Relevant templates: dm/templates/instance_template

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Switch to using type provider
  • Add cross-project creation support
  • Add additionalProperties: false for nested objects
  • Add support for "networkInterfaces[].accessConfigs[]", "disks", "scheduling", "minCpuPlatform", "guestAccelerators", "shieldedInstanceConfig", "sourceInstance", "sourceInstanceParams": [docs]
  • Fix resource name

DM/network: refactoring

Relevant templates: dm/templates/network

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Switch to using type provider
  • Add support for cross-project resource creation (both network and subnetwork)
  • Add oneOf check for subnets: autoCreateSubnetworks should be exclusive with subnet list
  • Fix network & subnetworks resources names
  • Add support for "description", "routingConfig" to network
  • Fix "secondaryIpRanges" definition in subnetwork
  • Add basic schema unit tests

DM/CLI implement default project id setup according to configuration rules

Currently go implementation support project id from command line --project and deployment yaml project: element, according to user guidee it should be:

  1. The --project command-line option. If a project is specified via this option, all configs in the run use that project. This is a way of quickly overriding the project specified in a config file, which should be used with caution.
  2. The project directive in the config file.
  3. The CLOUD_FOUNDATION_PROJECT_ID environment variable.
  4. The "default project" configured with the GCP SDK.

GKE DM template "The reference 'masterAuth.clientKey' is not found"

There would be an error "The reference 'masterAuth.clientKey' is not found" when users do not specify "issueClientCertificate" in config or the value of "issueClientCertificate" is false. That feature actually forces users to enable client certificate, which is not expected.

DM/instance: refactoring

Relevant templates: dm/templates/instance

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Switch to using type provider
  • Add cross-project creation support
  • Add additionalProperties: false for nested objects
  • Add support for "description", "networkInterfaces[].accessConfigs[]", "networkInterfaces[].aliasIpRanges[]", "disks", "scheduling", "labels", "minCpuPlatform", "guestAccelerators", "deletionProtection", "hostname", "shieldedInstanceConfig", "shieldedInstanceIntegrityPolicy": docs
  • Fix resource name

DM/project: refactoring

Relevant templates: dm/templates/project

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Add "labels" support
  • Add resource name prefix
  • Update compute-beta to compute-v1
  • Fix deprecated gcp-types/compute-v1:compute.subnetworks.setIamPolicy bindings
  • Refactor default resources removal: remove code duplication
  • Add usageExportBucket name prefix

Notes:

  • There is no "gcp-type" for cloudbilling. There is only legacy deploymentmanager.v2.virtual.projectBillingInfo
  • We should probably use gcs_bucket.py template for usage + add additional fields
  • We should probably have a separate template for service accounts

Instance template sample diskImage does not work

the sample diskImage in schema documentation does not work (e.g. "specify family/debian-9 to use the latest Debian 9 image projects/debian-cloud/global/images/family/debian-9").

I had to use the full projects/ path.

ERROR: (gcloud.deployment-manager.deployments.update) Error in Operation [operation-1559621223205-58a779cfe4aba-8b821d49-371b680c]: errors:

  • code: RESOURCE_ERROR
    location: /deployments/data-protect-toolkit-resources/resources/work-machine-1
    message: "{"ResourceType":"compute.v1.instance","ResourceErrorCode":"400"
    ,"ResourceErrorMessage":{"code":400,"errors":[{"domain":"global","
    message":"Invalid value for field 'resource.disks[0].initializeParams.sourceImage':
    \ 'family/debian-9'. The URL is malformed.","reason":"invalid"}],"message"
    :"Invalid value for field 'resource.disks[0].initializeParams.sourceImage': 'family/debian-9'.
    \ The URL is malformed.","statusMessage":"Bad Request","requestPath":"
    https://www.googleapis.com/compute/v1/projects/umairidris-test42/zones/us-east1-a/instances\"\
    ,"httpMethod":"POST"}}"

DM templates refactoring: template and schema improvements

I've created this issue to track process of code base update.

Template/schema checklist:

Template batch 1:

Template batch 2:

Template batch 3:

Template batch 4:

bigquery template can't create dataset, table, and view at the same time

The following template is trying to create dataset, table, and view at the same time.

imports:
  - path: templates/bigquery/bigquery_dataset.py
    name: bigquery_dataset.py
  - path: templates/bigquery/bigquery_table.py
    name: bigquery_table.py

resources:
  - name: pun-bq-dataset
    type: bigquery_dataset.py
    properties:
      name: pun_bq_dataset
      location: US
      access:
        - role: OWNER
          userByEmail: <YOUR EMAIL>
  - name: pun-bq-table
    type: bigquery_table.py
    properties:
      name: pun_bq_table
      datasetId: $(ref.pun-bq-dataset.datasetId)
      schema:
        - name: firstname
          type: STRING
        - name: lastname
          type: STRING
        - name: age
          type: INTEGER
  - name: pun-bq-view
    type: bigquery_table.py
    metadata:
      dependsOn:
      - pun-bq-table
    properties:
      name: pun_bq_view
      datasetId: $(ref.pun-bq-dataset.datasetId)
      view:
        description: pun_bq_view
        useLegacySql: false
        query: "SELECT firstname, age FROM `<PROJECT_ID>.pun_bq_dataset.pun_bq_table`"

I'm not sure if this is the template issue or API issue but 75% of the time the deployment fails with error:

ERROR: (gcloud.deployment-manager.deployments.create) Error in Operation [operation-1559665247835-58a81dd10d54c-8bfdbf01-df6ae411]: errors:
- code: RESOURCE_ERROR
  location: /deployments/pun-bq-create1/resources/pun_bq_view
  message: '{"ResourceType":"bigquery.v2.table","ResourceErrorCode":"404","ResourceErrorMessage":{"code":404,"errors":[{"domain":"global","message":"Not
    found: Table <PROJECT_ID>:pun_bq_dataset.pun_bq_table","reason":"notFound"}],"message":"Not
    found: Table <PROJECT_ID>:pun_bq_dataset.pun_bq_table","statusMessage":"Not
    Found","requestPath":"https://www.googleapis.com/bigquery/v2/projects/<PROJECT_ID>/datasets/pun_bq_dataset/tables","httpMethod":"POST"}}'

When i run update after the failure all resources get created (missing view gets created on retry).

I also tried changing

    metadata:
      dependsOn:
      - pun-bq-table

to

    metadata:
      dependsOn:
      - <PROJECT_ID>:pun_bq_dataset.pun_bq_table

but that didn't help either. It seems that dependOn doesn't always behave as expected.

DM/backend_service: refactoring

Relevant templates: dm/templates/backend_service

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Switch to using type provider
  • Add support for cross-project resource creation
  • Add new fields: "backends[].maxRatePerEndpoint, .maxConnectionsPerEndpoint", "iap", "customRequestHeaders[]"
  • Change healthCheck to healthChecks[]
  • Add checks for INTERNAL/EXTERNAL LB schemes for all relevant fields
  • Add checks for backends[].balancingMode

DM/cloud_spanner: refactoring

Relevant templates: dm/templates/cloud_spanner

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Add support for "labels"
  • Switch to using type provider
  • Make "name" optional, correctly handle it
  • Add support for cross-project resource creation
  • Update "instanceConfig" enum with new values
  • Add basic schema unit tests
  • Add additionalProperties: false for nested objects

Notes:

  • TODO: check database "createStatement" & "extraStatements" fields
  • TODO: check IAM policy for possible additional fields (both instance and database)

DM/cloud_sql: refactoring

Relevant templates: dm/templates/cloud_sql

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Switch to using type provider
  • Add enum for "databaseVersion", "region", "settings.pricingPlan", "settings.replicationType"
  • Add additionalProperties: false for nested object
  • Fix "users" schema
  • Add basic schemas unit tests

Notes:

DM/gke: refactoring

Relevant templates: dm/templates/gke

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Switch to using type provider
  • Add support for cross-project resource creation
  • Fix resource names
  • Remove deprecated "nodeConfig", switch to "nodePools[].config"
  • Remove deprecated "initialNodeCount", switch to "nodePools[].initial_node_count"
  • Remove deprecated "privateCluster", "masterIpv4CidrBlock" -> "privateClusterConfig"
  • Update parameters: "masterAuth", "loggingService", "monitoringService", "addonsConfig",
    "ipAllocationPolicy" and others
  • Add support for "nodePools[]", "binaryAuthorization", "autoscaling", "networkConfig", "defaultMaxPodsConstraint", "resourceUsageExportConfig", "authenticatorGroupsConfig", "verticalPodAutoscaling", "tierSettings", "workloadIdentityConfig", "nodeConfig->diskType,sandboxConfig,shieldedInstanceConfig", "enableTpu", "databaseEncryption"
  • Add uniqueItems: true and additionalProperties: false

DM/firewall: refactoring

Relevant templates: dm/templates/firewall

Main issue: #47: DM templates refactoring: template and schema improvements

Relevant: Firewall template broken

TODO list:

  • Add version, links to docs
  • Switch to using type provider
  • Add support for cross-project resource creation
  • Upgrade compute-beta to compute-v1
  • Fix resource names
  • Add schema to "rules": "name", "description", "priority", "sourceRanges", "destinationRanges", "sourceTags", "targetTags", "sourceServiceAccounts", "targetServiceAccounts", "allowed", "denied", "direction", "logConfig", "disabled"

DM/pubsub: refactoring

Relevant templates: dm/templates/pubsub

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Switch to using type provider
  • Add support for cross-project resource creation
  • Fix resource names
  • Add topic fields: "labels"
  • Add subscription fields: "pushConfig", "retainAckedMessages", "messageRetentionDuration", "labels", "expirationPolicy"

Notes:

  • Type provider is broken:
    • It requires "topic" field as input for topic, while api schema and documentation state, that we should use "name"
    • It requires "subscription" field as input for subscription, while api schema and documentation state, that we should use "name"
  • Setting "gcpIamPolicy" does not work for gcp-type
  • Cross-project creation is not supported

DM/cloud_function: refactoring

Relevant templates: dm/templates/cloud_function

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Switch to using type provider
  • Upgrade API version: v1beta2 -> v1
  • Add cross-project creation support (including upload.py)
  • Add support for "labels", "environmentVariables" fields
  • Rename "region" to "location" with backward compatibility + there is oneOf check
  • Add new runtimes, change default to nodejs10
  • Fix function upload code (it is not redeployed after code upload when using other project)
  • Update source upload logic (see below)

Notes:

  • Type provider is broken. It requires "parent" and "function" fields as input, while api schema and documentation state, that we should use "location" and "name"
  • It does not support correct cross-project resource creation/update, cloudfunctions API must be enabled on the seed project due to API limitations
  • Cloud build is triggered on the seed project, projectId parameter is ignored. It also has the same limitations as cloudfunctions
  • Due to the fact that cloudbuild is scheduled on the seed project, cloudbuild.gserviceaccount.com service account should have storage.buckets.create on the target project
  • "|| true" on bucket creation step hides all errors
  • Any non-asci characters (especially binary files) break uploads

New source upload logic

Relevant issue: Cloud functions python template error uploading functions

gcp-type for cloud function has a bit different logic for source fields. Sourcing logic that should be implemented:

  • If "sourceRepository" field is present, use it as-is
  • If "sourceRepositoryUrl" field is provided, change it to "sourceRepository" format
  • If "sourceArchiveUrl" is provided, use it as-is
  • If "localUploadPath" is present, create cloudbuild build for function zip file. Use "sourceArchiveUrl" as target or generate it automatically (providing generated path via ""sourceArchiveUrl")
  • If "sourceUploadUrl" is present, use it as-is
  • All other parameter combinations should be restricted

DM/bigquery: refactoring

Relevant templates: dm/templates/bigquery

Main issue: #47: DM templates refactoring: template and schema improvements

TODO list:

  • Add version, links to docs
  • Switch to using type provider
  • Add support for cross-project resource creation
  • Add missing fields to datasets: "friendlyName", "defaultPartitionExpirationMs", "labels", "access"
  • Add missing fields to tables: "description", "labels", "clustering", "requirePartitionFilter", "externalDataConfiguration", "encryptionConfiguration"
  • Fix resource names
  • Add uniqueItems: true and additionalProperties: false

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.