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
FROM node | |
ADD index.js package.json /app/ | |
WORKDIR /app | |
RUN npm install | |
EXPOSE 3000 | |
ENTRYPOINT ["node","index.js"] |
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
var express = require("express"); | |
var app = express(); | |
app.use(express.json()) | |
app.get("/", (req, res, next) => { | |
res.json({message: "Hello World"}); | |
}); | |
app.listen(3000, () => { | |
console.log("Server running on port 3000"); | |
}); |
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: v1 | |
kind: ConfigMap | |
metadata: | |
name: fluent-bit-config | |
labels: | |
k8s-app: fluent-bit | |
data: | |
# Configuration files: server, input, filters and output | |
# ====================================================== | |
fluent-bit.conf: | |
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
package main | |
import ( | |
"context" | |
"crypto/rand" | |
"crypto/rsa" | |
"crypto/x509" | |
"crypto/x509/pkix" | |
"encoding/asn1" | |
"encoding/base64" |
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: v1 | |
clusters: | |
- cluster: | |
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMwekNDQWJ1Z0F3SUJBZ0lNRmhPQ3Y4MDFIcUQwWmR6Rk1BMEdDU3FHU0liM0RRRUJDd1VBTUJVeEV6QVIKQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13SGhjTk1qQXdOVEkzTVRNeU56TXpXaGNOTXpBd05USTNNVE15TnpNegpXakFWTVJNd0VRWURWUVFERXdwcmRXSmxjbTVsZEdWek1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBCk1JSUJDZ0tDQVFFQXNuaW5VZldIOU5IU2FBYnd3YnB4VVppYmxMOStEN0ZwNkVSbUlVV2MwVExRTUhHSXdrYTIKcjZLVGh3UnBZZ0xNaTI5YnVTOU4vR1kxQ1JTaGk0T0owMlZKTXF5dGQrMmRsN1dJazcveHN0ckc0YmkwNTQvcApFU0RqNkJOYTZUM1RMUWZYK1Y0NGRHOWdVZG5Kc0plYnQ2Mno2Qnp6ajI3dC81MDNNcmtVQnhtRWtORGtCZHBVCmtPbWdocXgyYSt0dExiTjR1WUswVE4rRjdCQkNuUkVVeHBnNFJDRmc5VG1HaUM5b09vbmE2dWsxTklvMElyeTkKTDNDc3FmUlYrOVBRL3FBT3FrVjNwSnVXSSs1WTJ4Y2JocVJnVWI2QW5QdkpiWkp2Mys2TWt6TkVGNFovWVNYaQp4VGF0VTVGcUJPWDRLNUJ5Y2MvVWRZZG5HKzQ1VjE4cUpRSURBUUFCb3lNd0lUQU9CZ05WSFE4QkFmOEVCQU1DCkFRWXdEd1lEVlIwVEFRSC9CQVV3QXdFQi96QU5CZ2txaGtpRzl3MEJBUXNGQUFPQ0FRRUFldmRXWXZXOGE0bU4KNjZGTHRENXJwR0xsc2VGMFpXSmVVc2dKZTlLTDNXaDBxalNrNEVP |
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
kubeConfig, err := clientcmd.LoadFromFile(kubeconfig) | |
check("The following error occured while loading the KubeConfig file", err) | |
if _, v := kubeConfig.Clusters[*clusterPtr]; !v { | |
log.Fatal(fmt.Sprintf("Cluster \"%s\" was not found in the current Kube Config file", *clusterPtr)) | |
} | |
kc := &KubeConfig{ | |
APIVersion: "v1", | |
Clusters: Clusters{ | |
0: { | |
Cluster{ |
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
csr, err = clientset.CertificatesV1beta1().CertificateSigningRequests().Get(context.TODO(), csr.GetName(), v1.GetOptions{}) | |
clientset.CertificatesV1beta1().CertificateSigningRequests().Delete(context.TODO(), csr.GetName(), v1.DeleteOptions{}) |
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
check("The following error occured while sending the Certificate Signing Request", err) | |
csr.Status.Conditions = append(csr.Status.Conditions, certificates.CertificateSigningRequestCondition{ | |
Type: certificates.CertificateApproved, | |
Reason: "User activation", | |
Message: "This CSR was approved", | |
LastUpdateTime: v1.Now(), | |
}) | |
csr, err = clientset.CertificatesV1beta1().CertificateSigningRequests().UpdateApproval(context.Background(), csr, v1.UpdateOptions{}) | |
check("The following error occured while approving the Certificate Signing Request", err) |
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
cat <<EOF | kubectl apply -f - | |
apiVersion: certificates.k8s.io/v1beta1 | |
kind: CertificateSigningRequest | |
metadata: | |
name: tempcsr | |
spec: | |
request: $(cat server.csr | base64 | tr -d '\n') | |
groups: | |
- system:authenticated | |
EOF |
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
config, err := clientcmd.BuildConfigFromFlags("", kubeconfig) | |
clientset, err := kubernetes.NewForConfig(config) | |
check("The following error occured while loading the Kube Config file", err) | |
csr := &certificates.CertificateSigningRequest{ | |
ObjectMeta: v1.ObjectMeta{ | |
Name: "tempcsr", | |
}, | |
Spec: certificates.CertificateSigningRequestSpec{ | |
Groups: []string{ | |
"system:authenticated", |
NewerOlder