Skip to content

Instantly share code, notes, and snippets.

View developer-guy's full-sized avatar
🐾
Every artifact can be verifiably traced to Source Code and Hardware

Batuhan Apaydın developer-guy

🐾
Every artifact can be verifiably traced to Source Code and Hardware
View GitHub Profile
@developer-guy
developer-guy / main.go
Created April 20, 2021 20:03
Working with etcd through Go client
package main
import (
"context"
"crypto/tls"
"time"
"github.com/sirupsen/logrus"
v3 "go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/pkg/transport"
@developer-guy
developer-guy / main.go
Created April 19, 2021 07:32
Install Helm Chart using Go
package main
import (
"flag"
"log"
"os"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/cli"
@developer-guy
developer-guy / readme.md
Created April 16, 2021 07:24 — forked from jimangel/readme.md
Examples of how to test the impact of the v1.16 API deprecations

Kubernetes v1.16 API deprecation testing

Examples of how to test the impact of the v1.16 API deprecations and ways to debug early!

If this is the first time you're hearing of these deprecations STOP and read this blog post (thanks @vllry!).

Common misunderstandings

  1. The exact apiVersion: value that I use in my manifest is stored on disk (etcd).
@developer-guy
developer-guy / rsa_sign.go
Created April 15, 2021 20:00 — forked from Grrrben/rsa_sign.go
Signing and Verifying using Golang RSA
// Sign returns a signature made by combining the message and the signers private key
// With the r.Verify function, the signature can be checked.
func (r *RsaIdentity) Sign(msg []byte) (signature []byte, err error) {
hs := r.getHashSum(msg)
signature, err := rsa.SignPKCS1v15(rand.Reader, r.private, crypto.SHA256, hs)
return
}
@developer-guy
developer-guy / sign_and_verify_test.go
Created April 15, 2021 19:59 — forked from nilsmagnus/sign_and_verify_test.go
Sign a message and verify signature with go using PKCS1. Compatible with java (SHA256withRSA)
package main
import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"encoding/base64"
"testing"
)
@developer-guy
developer-guy / main.go
Last active April 14, 2021 21:50
Provision a Local Kubernetes Cluster Using KinD with Go
package main
import (
"os"
"os/signal"
"syscall"
"github.com/sirupsen/logrus"
"sigs.k8s.io/kind/pkg/cluster"
"sigs.k8s.io/kind/pkg/log"
@developer-guy
developer-guy / registerwebhook.go
Last active April 5, 2021 19:38
register webhook
pv := v1.NewPodValidator(mgr.GetClient())
mgr.GetWebhookServer().Register("/validate-core-v1-pod", &webhook.Admission{Handler: pv})
@developer-guy
developer-guy / pod_webhook.go
Last active April 5, 2021 19:36
PodValidator implementation of controller-runtime
package v1
import (
"context"
"fmt"
"net/http"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
@developer-guy
developer-guy / after-deploy.yaml
Created March 29, 2021 10:45
test-deployment after deploy
apiVersion: v1
kind: Pod
metadata:
annotations:
vault.security.banzaicloud.io/vault-addr: https://vault:8200
vault.security.banzaicloud.io/vault-tls-secret: vault-tls
labels:
app.kubernetes.io/name: hello-secrets
pod-template-hash: 66757f644f
name: hello-secrets-66757f644f-25rv7
@developer-guy
developer-guy / commands
Created March 29, 2021 10:43
test-deployment test commands
# lets feed Vault with the corresponding secret first.
$ vault kv put secret/accounts/aws AWS_SECRET_ACCESS_KEY=s3cr3t
$ kubectl apply -f test-deployment.yaml
deployment.apps/hello-secrets created
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-secrets-66757f644f-25rv7 1/1 Running 0 74s
vault-0 3/3 Running 0 50m