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
export GITHUB_USER=magickatt | |
export GITHUB_TOKEN=secret | |
export GITHUB_REPOSITORY=magickatt/ContainerisingLegacyApplicationsTalk | |
git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} |
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
ctx := context.TODO() | |
queueName := "something" | |
endpointURL := "http://localhost:9324" | |
messageBody := "test" | |
// Create a custom endpoint resolver for ElasticMQ | |
elasticmqResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) { | |
if service == sqs.ServiceID { | |
return aws.Endpoint{URL: endpointURL}, nil | |
} |
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
resource "google_service_account" "service_account" { | |
account_id = "test | |
display_name = "Test" | |
} | |
resource "google_service_account_key" "service_account" { | |
service_account_id = google_service_account.service_account.name | |
public_key_type = "TYPE_X509_PEM_FILE" | |
} |
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
- name: 'gcr.io/cloud-builders/git' | |
secretEnv: ['SSH_KEY'] | |
entrypoint: 'bash' | |
args: | |
- -c | |
- | | |
echo "$$SSH_KEY" >> /root/.ssh/id_rsa | |
chmod 400 /root/.ssh/id_rsa | |
volumes: | |
- name: 'ssh' |
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
PARENT_NAMESPACE=pizzeria | |
CHILD_NAMESPACE=pepperoni | |
$ kubectl annotate namespace $CHILD_NAMESPACE \ | |
hnc.x-k8s.io/subnamespace-of=$PARENT_NAMESPACE | |
# namespace/pepperoni annotated | |
$ cat <<EOF | kubectl apply -f - | |
apiVersion: hnc.x-k8s.io/v1alpha2 |
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
apiVersion: batch/v1 | |
kind: CronJob | |
metadata: | |
name: "restart-{{ $application.name }}" | |
namespace: "{{ $.Release.Namespace }}" | |
spec: | |
concurrencyPolicy: Forbid | |
schedule: "* * * * *" # crontab.guru | |
jobTemplate: | |
spec: |
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
name: Latest Release | |
# Customise for the tag format you are using | |
on: | |
push: | |
tags: | |
- v* | |
# Required for the release action to upload artifacts | |
permissions: |
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
filebeat.autodiscover: | |
providers: | |
- type: kubernetes | |
hints.enabled: true | |
hints.default_config.enabled: false | |
add_resource_metadata: | |
namespace: | |
enabled: true | |
processors: | |
- add_kubernetes_metadata: |
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
#!/bin/bash | |
IMAGE_NAME=test-1 | |
# 1-liner | |
until [ $(docker inspect -f "{{json .State.Status }}" $(docker ps -a -q --filter ancestor=$IMAGE_NAME --format="{{.ID}}" | head -n 1)) == '"running"' ]; do echo "Waiting for container to start..." && sleep 1; done | |
# More readable | |
CONTAINER_ID=$(docker ps --all --quiet --filter ancestor=$IMAGE_NAME --format="{{.ID}}" | head -n 1) | |
CONTAINER_STATUS=$(docker inspect --format "{{json .State.Status }}" $CONTAINER_ID) | |
until [ $CONTAINER_STATUS == '"running"' ] |
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
# Can use https://gist.github.com/magickatt/e7885f748c2ecd5bb88dd64828b30fbf | |
# to adopt the Deployment resources themselves | |
NAME=test | |
NAMESPACE=default | |
kubectl get -n $NAMESPACE deployment -o name \ | |
| xargs -I % kubectl patch -n $NAMESPACE % -p \ | |
'{"spec": {"template":{"metadata":{"annotations":{"meta.helm.sh/release-name": "$NAME"}}}}}' |
NewerOlder