Commit 33a9d251 authored by Manuel Kieweg's avatar Manuel Kieweg 🤷
Browse files

add docker image and token

parent cfd058d6
...@@ -10,17 +10,17 @@ import ( ...@@ -10,17 +10,17 @@ import (
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/homedir"
"log" "log"
"os" "os"
"path/filepath"
) )
func main() { func main() {
kubeconfig, err := clientcmd.BuildConfigFromFlags("", filepath.Join(homedir.HomeDir(), ".kube", "config")) kubeconfig, err := clientcmd.BuildConfigFromFlags("https://api.ocp.fbi.h-da.de:6443", "")
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
kubeconfig.Username = os.Getenv("K8S_DEPLOY_USER")
kubeconfig.BearerToken = os.Getenv("K8S_DEPLOY_TOKEN")
clientset, err := kubernetes.NewForConfig(kubeconfig) clientset, err := kubernetes.NewForConfig(kubeconfig)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
......
...@@ -9,6 +9,7 @@ build: ...@@ -9,6 +9,7 @@ build:
- ./k8s-bot - ./k8s-bot
.deploy: &deploy .deploy: &deploy
image: bitnami/kubectl:latest
variables: variables:
K8S_OP: "create" K8S_OP: "create"
script: script:
...@@ -31,6 +32,7 @@ deploy:develop: ...@@ -31,6 +32,7 @@ deploy:develop:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
destroy: destroy:
image: bitnami/kubectl:latest
stage: .post stage: .post
variables: variables:
K8S_OP: "delete" K8S_OP: "delete"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment