Skip to content

Instantly share code, notes, and snippets.

View cloudrun-getting-started-create-subscription.sh
echo "create iam binding"
gcloud projects add-iam-policy-binding ${GCLOUD_PROJECT} \
--member=serviceAccount:service-${PROJECT_NUMBER}@gcp-sa-pubsub.iam.gserviceaccount.com \
--role=roles/iam.serviceAccountTokenCreator
echo "create service account"
gcloud iam service-accounts create ${INVOKER_NAME} \
--display-name "Cloud Run Pub/Sub Invoker"
echo "iam roles"
View cloudrun-getting-started-scheduler.sh
gcloud scheduler jobs create pubsub ${SCHEDULER_NAME} \
--schedule="* * * * *" \
--topic=${TOPIC_NAME} \
--message-body="scheduler system"
View cloudrun-getting-started-enable-pubsub.sh
echo "enable pubsub"
gcloud services enable pubsub.googleapis.com
echo "create topic"
gcloud pubsub topics create ${TOPIC_NAME}
View cloudrun-getting-started-deploy.sh
gcloud beta run deploy ${PROJECT_NAME} \
--image gcr.io/${GCLOUD_PROJECT}/${IMAGE_NAME} \
--region ${INSTANCE_REGION} \
--platform managed
View cloudrun-getting-started-build.sh
gcloud builds submit --tag gcr.io/${GCLOUD_PROJECT}/${IMAGE_NAME} .
View cloudrun-getting-started-index.js
// imports
const express = require("express");
const bodyParser = require("body-parser");
const app = express();
// setup
app.use(bodyParser.json());
// POST endpoint
app.post("/", (req, res) => {
// parse body
if (!req.body) {
View install-spinnaker.sh
# set the account to install spinnaker into
$ACCOUNT=spinnaker-account
# install spinnaker
hal config deploy edit --type distributed --account-name $ACCOUNT
View spinnaker-create-account.sh
# login into GCP
gcloud auth login
# set project id that your cluster belongs to
gcloud config set project <your-gcp-project-id>
# login to kubectl
gcloud auth application-default login
# download kubeconfig to local computer from a cluster by name
gcloud container clusters get-credentials <your-cluster-name> --zone <your-cluster-zone>
# get kubeconfig context
CONTEXT=$(kubectl config current-context)
@jonbcampos
jonbcampos / get-kubeconfig.sh
Created Feb 12, 2019
spinnaker-install-base-service
View get-kubeconfig.sh
# login into GCP
gcloud auth login
# set project id that your cluster belongs to
gcloud config set project <your-gcp-project-id>
# login to kubectl
gcloud auth application-default login
# download kubeconfig to local computer from a cluster by name
gcloud container clusters get-credentials <your-cluster-name> --zone <your-cluster-zone>
# get kubeconfig context
CONTEXT=$(kubectl config current-context)
View medium_configmaps_and_secrets_p2.yaml
...
ports:
- containerPort: 80
volumeMounts:
# volumes to mount
- name: secret-volume # matches secret name
# path for this secret to be available at
mountPath: "/opt/firebase"
readOnly: true # no editing!
volumes:
You can’t perform that action at this time.