Comments (10)
Hi @gadaldo ,
Yes, this is a limitation of the Google Cloud Storage API. Deployment Manager can only interact with APIs, so there is no declarative way for us to delete bucket contents, hence the suggestion to use a gcloud script like described in our Cloud Container Builder example (linked above).
Best,
Kyle
from deploymentmanager-samples.
Hi Davide,
You could probably hack something into Deployment Manager using a feature we're working on (documentation coming sometime Q4), but uploading objects to Cloud Storage isn't really a supported use case. Your best tool for that is gcloud or the API.
What's your particular use case though? Is this file the same for every deployment? Are you referencing a GCS object in your deployment template?
from deploymentmanager-samples.
Hi,
I've a project that hosts golden images for others projects and (in a GCS bucket) their startup scripts.
I'm managing project and bucket with DM and images with Packer.
I can manage this GCS objects with gcloud or gsutil, but with something like DM the overall process should be more clear.
from deploymentmanager-samples.
As a workaround you can define a cloud function that does that for you, here is a sample to call a cloud function within DM
from deploymentmanager-samples.
Closing this issue. Please re-open if more is needed.
from deploymentmanager-samples.
Hi Davide,
In the sample Alejandro linked to, you can see DM calling the raw Cloud Function. If the content you wanted was in your deployment, you could get it into Cloud Storage using their insert API in a similar way:
https://cloud.google.com/storage/docs/json_api/v1/objects/insert
You would need to do some configuring to get rid of that object on deletion of the deployment though (something we don't have docs for yet). Alternatively, you could copy objects between buckets with something like the following
resources:
- # All your existing resources.
...
- name: some-name
action: gcp-types/storage-v1:storage.objects.copy
metadata:
runtimePolicy:
- CREATE
properties:
sourceBucket: my-source-bucket
sourceObject: object-name
destinationBucket: us-central1-bucket # Put the proper bucket name here.
destinationObject: object-name
You would want to also add an action for deleting the object. It would look like the above but use a DELETE runtime policy and call the object delete API. Other acceptable policies are UPDATE_ALWAYS and UPDATE_ON_CHANGE (change of the deployment, not the object).
Hopefully that helps and gets you going in the right direction. Let us know if there's anything else we can do to help.
Happy Monday.
from deploymentmanager-samples.
Hi,
what about deleting a bucket with content in it (such as a previously created staging location)?
Regards
from deploymentmanager-samples.
Hi @gadaldo,
There isn't an API to delete a bucket with content, so you would need to delete the contents first. This can be done via gcloud or the console. If you want to do the whole thing with Deployment Manager, I would recommend looking into running a a Cloud Container Builder script in DM.
Hopefully that helps.
Happy Monday,
Kyle
from deploymentmanager-samples.
Oh so there is not a way of say:
- name: {{ PROJECT_NAME }}-event-dataflow
type: storage.v1.bucket
properties:
location: europe-west2
storageClass: REGIONAL
deleteContents: True
cause I am trying but no luck.
Regards
from deploymentmanager-samples.
Ok thank you for replying. We are running out of python so I'll go via gcloud command line for this object deletion in my containerized deployment project. The idea was to have a completely idempotent deployment project with no dependencies (only docker) and as much as declarative as possible.
thank you for your reply
Happy monday
Giuseppe
from deploymentmanager-samples.
Related Issues (20)
- Incorrect assignment to database_name
- property should be notFoundPage instead of notFoundpage
- bucket property on defaultObjectAcl keeps throwing me an error
- Ref in Instance Template errors with CYCLIC_REFERENCES
- Broken link to community/cloud-foundation on front page HOT 1
- Create service accounts return INVALID_ARGUMENT
- Project creation sample missing HOT 2
- Miss
- Multiple Instances - Lables HOT 1
- How to assign roles to service account using jinja & YAML file HOT 2
- how to initially we can invoke cloud function from deployment manager?
- Assigning roles to groups using deployment manager
- Unable to provide conditional access to a service account on a project using DM HOT 1
- Create workload identity federation resources with gcloud
- lustre doesn't deploy if existing VPC is specified.
- How to Roll Back (Undo) a Deployment in GCP with Google Cloud Deployment Manager?
- Provide Support for Inline Function Code for Cloud Function Creation via Deployment Manager
- Deployment manager UPDATE error
- Failure issue with google deployment manager CLI
- container_manifest.yaml missing link to reference
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deploymentmanager-samples.