Skip to content

Instantly share code, notes, and snippets.

@joatmon08
joatmon08 / hello-stateful-cr-v1yaml
Created October 3, 2018 12:00
Hello Stateful CR v1
apiVersion: "hello-stateful.example.com/v1alpha1"
kind: "HelloStateful"
metadata:
name: "minikube-hello-stateful"
spec:
persistentVolume:
metadata:
name: hello-stateful-pv
spec:
storageClassName: standard
@joatmon08
joatmon08 / hello-stateful-types-v1.go
Created October 3, 2018 12:10
Hello Stateful types.go V1
package v1alpha1
import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@joatmon08
joatmon08 / hello-stateful-rbac.yml
Created October 7, 2018 15:41
Hello Stateful Final RBAC
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: hello-stateful-operator
rules:
- apiGroups:
- hello-stateful.example.com
resources:
- "*"
@joatmon08
joatmon08 / hello-stateful-new-cr.yaml
Created October 7, 2018 15:56
Hello Stateful New CustomResource
---
apiVersion: "hello-stateful.example.com/v1alpha1"
kind: "HelloStateful"
metadata:
name: "new-hello-stateful"
spec:
replicas: 1
restoreFromExisting: false
backupSchedule: "*/5 * * * *"
@joatmon08
joatmon08 / hello-stateful-new-cr-restore.yml
Created October 7, 2018 16:06
Hello Stateful New CustomResource with Restore
---
apiVersion: "hello-stateful.example.com/v1alpha1"
kind: "HelloStateful"
metadata:
name: "new-hello-stateful"
spec:
replicas: 1
restoreFromExisting: true
backupSchedule: "*/5 * * * *"
@joatmon08
joatmon08 / TDD-Infra-bucket-test-01.go
Last active May 2, 2019 19:54
TDD-Infra-bucket-01
package test
import (
"testing"
"github.com/stretchr/testify/assert"
)
const BucketPolicyFilePath = "../../policies/bucket.json"
@joatmon08
joatmon08 / TDD-Infra-bucket-02.json
Created April 20, 2019 19:18
TDD-Infra-bucket-02
{
"Version": "2012-10-17",
"Id": "MyBucketPolicy",
"Statement": [
{
"Sid": "AllowWriteUser",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::AccountID:user/test"
},
@joatmon08
joatmon08 / TDD-Infra-bucket-test-write.go
Last active April 20, 2019 19:42
TDD-Infra-bucket-test-write
package test
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
const BucketPolicyFilePath = "../../policies/bucket.json"
@joatmon08
joatmon08 / TDD-Infra-bucket-03.json
Created April 20, 2019 19:35
TDD-Infra-bucket-03
{
"Version": "2012-10-17",
"Id": "MyBucketPolicy",
"Statement": [
{
"Sid": "AllowWriteUser",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::REDACTED:user/MyBucketWriteUser"
},
@joatmon08
joatmon08 / TDD-Infra-bucket-04.json
Created April 20, 2019 19:44
TDD-Infra-bucket-04
{
"Version": "2012-10-17",
"Id": "MyBucketPolicy",
"Statement": [
{
"Sid": "AllowWriteUser",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::REDACTED:user/MyBucketWriteUser"
},