Skip to content

Instantly share code, notes, and snippets.

Avatar
🐟
*

Tiexin Guo IronCore864

🐟
*
View GitHub Profile
View CNCF_CLA.md

Cloud Native Computing Foundation

A project of The Linux Foundation

Individual Contributor License Agreement ("Agreement") v1.0

Thank you for your interest in the Cloud Native Computing Foundation project (“CNCF”) of The Linux Foundation (the "Foundation"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Foundation must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of CNCF, the Foundation and its users; it does not change your rights to use your own Contributions for any other purpose.

@IronCore864
IronCore864 / main.go
Last active Dec 7, 2021
Go Resty with GitHub Releases
View main.go
package main
import (
"fmt"
"log"
"time"
resty "github.com/go-resty/resty/v2"
)
@IronCore864
IronCore864 / Dockerfile
Created Aug 1, 2021
Dockerfile Example
View Dockerfile
FROM golang:alpine
WORKDIR /app
COPY . .
RUN apk add git
RUN go get ./... && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o app
View gist:783ad7ae25fa799e0c993caa472a9008
I0803 10:03:13.689964 1 static_autoscaler.go:147] Starting main loop
I0803 10:03:13.780154 1 auto_scaling_groups.go:354] Regenerating instance to ASG map for ASGs: [eks-1cb9d9ce-32fe-2f15-35db-3a088d186141]
I0803 10:03:13.842713 1 aws_manager.go:263] Refreshed ASG list, next refresh after 2020-08-03 10:04:13.842705977 +0000 UTC m=+561.584674568
I0803 10:03:13.842938 1 utils.go:626] No pod using affinity / antiaffinity found in cluster, disabling affinity predicate for this loop
I0803 10:03:13.842955 1 static_autoscaler.go:303] Filtering out schedulables
I0803 10:03:13.843012 1 static_autoscaler.go:320] No schedulable pods
I0803 10:03:13.843034 1 static_autoscaler.go:328] No unschedulable pods
I0803 10:03:13.843047 1 static_autoscaler.go:375] Calculating unneeded nodes
I0803 10:03:13.843106 1 scale_down.go:379] Scale-down calculation: ignoring 2 nodes unremovable in the last 5m0s
I0803 10:03:13.843120 1 scale_down.go:410] Node ip-192-168-85-16.eu-cent
View gist:912c01c101a923b0ceb093d3914aefb3
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeAutoScalingInstances",
"autoscaling:DescribeLaunchConfigurations",
"autoscaling:DescribeTags",
"autoscaling:SetDesiredCapacity",
View gist:0d30b77fc8f86b158e58b47149a3624c
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
namespace: default
labels:
app: nginx
spec:
replicas: 4
selector:
View test.sh
tiexin@Tiexins-MacBook-Pro ~ $ eksctl create cluster -n test --managed
[ℹ] eksctl version 0.24.0
[ℹ] using region eu-central-1
[ℹ] setting availability zones to [eu-central-1c eu-central-1b eu-central-1a]
[ℹ] subnets for eu-central-1c - public:192.168.0.0/19 private:192.168.96.0/19
[ℹ] subnets for eu-central-1b - public:192.168.32.0/19 private:192.168.128.0/19
[ℹ] subnets for eu-central-1a - public:192.168.64.0/19 private:192.168.160.0/19
[ℹ] using Kubernetes version 1.16
[ℹ] creating EKS cluster "test" in "eu-central-1" region with managed nodes
[ℹ] will create 2 separate CloudFormation stacks for cluster itself and the initial managed nodegroup
View gist:3b6d60a6911144415c15ee7f26f05322
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
containers:
- name: test
# run as user 1000
image: docker.io/ironcore864/go-hello-http:latest
View gist:3d86cb63f9850656c0bfa8254dcb669f
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
containers:
- name: test
# run as user 0
image: docker.io/ironcore864/go-hello-http:root
View gist:c599a34c8556cbfd0c874a9cccf54947
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: eks:podsecuritypolicy:privileged
namespace: kube-system
labels:
kubernetes.io/cluster-service: "true"
eks.amazonaws.com/component: pod-security-policy
rules: