aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kud/demo/firewall/charts/sink/templates/configmap.yaml2
-rw-r--r--kud/deployment_infra/playbooks/configure-multus.yml38
-rw-r--r--src/k8splugin/internal/app/client.go4
-rw-r--r--src/k8splugin/internal/config/config.go2
-rw-r--r--src/k8splugin/internal/connection/connection.go17
5 files changed, 31 insertions, 32 deletions
diff --git a/kud/demo/firewall/charts/sink/templates/configmap.yaml b/kud/demo/firewall/charts/sink/templates/configmap.yaml
index 95a30513..89be1f77 100644
--- a/kud/demo/firewall/charts/sink/templates/configmap.yaml
+++ b/kud/demo/firewall/charts/sink/templates/configmap.yaml
@@ -1,4 +1,4 @@
-piVersion: v1
+apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "sink.name" .}}-configmap
diff --git a/kud/deployment_infra/playbooks/configure-multus.yml b/kud/deployment_infra/playbooks/configure-multus.yml
index 9cca54d1..47109162 100644
--- a/kud/deployment_infra/playbooks/configure-multus.yml
+++ b/kud/deployment_infra/playbooks/configure-multus.yml
@@ -62,27 +62,25 @@
mode: 0755
when: multus_source_type == "tarball"
- name: create multus configuration file
- blockinfile:
- marker: ""
- path: /etc/cni/net.d/00-multus.conf
- create: yes
- block: |
- {
- "type": "multus",
- "name": "multus-cni",
- "cniVersion": "0.3.1",
- "kubeconfig": "/etc/kubernetes/admin.conf",
- "delegates": [
- {
- "type": "flannel",
+ copy:
+ dest: /etc/cni/net.d/00-multus.conf
+ content: |
+ {
+ "type": "multus",
+ "name": "multus-cni",
"cniVersion": "0.3.1",
- "masterplugin": true,
- "delegate": {
- "isDefaultGateway": true
- }
- }
- ]
- }
+ "kubeconfig": "/etc/kubernetes/admin.conf",
+ "delegates": [
+ {
+ "type": "flannel",
+ "cniVersion": "0.3.1",
+ "masterplugin": true,
+ "delegate": {
+ "isDefaultGateway": true
+ }
+ }
+ ]
+ }
- hosts: localhost
pre_tasks:
diff --git a/src/k8splugin/internal/app/client.go b/src/k8splugin/internal/app/client.go
index 4fdce599..8d2af297 100644
--- a/src/k8splugin/internal/app/client.go
+++ b/src/k8splugin/internal/app/client.go
@@ -18,7 +18,6 @@ import (
"os"
"time"
- "github.com/onap/multicloud-k8s/src/k8splugin/internal/config"
"github.com/onap/multicloud-k8s/src/k8splugin/internal/connection"
"github.com/onap/multicloud-k8s/src/k8splugin/internal/helm"
"github.com/onap/multicloud-k8s/src/k8splugin/internal/plugin"
@@ -45,8 +44,9 @@ type KubernetesClient struct {
// getKubeConfig uses the connectivity client to get the kubeconfig based on the name
// of the cloudregion. This is written out to a file.
func (k *KubernetesClient) getKubeConfig(cloudregion string) (string, error) {
+
conn := connection.NewConnectionClient()
- kubeConfigPath, err := conn.Download(cloudregion, config.GetConfiguration().KubeConfigDir)
+ kubeConfigPath, err := conn.Download(cloudregion)
if err != nil {
return "", pkgerrors.Wrap(err, "Downloading kubeconfig")
}
diff --git a/src/k8splugin/internal/config/config.go b/src/k8splugin/internal/config/config.go
index dc3f7a11..90204c99 100644
--- a/src/k8splugin/internal/config/config.go
+++ b/src/k8splugin/internal/config/config.go
@@ -37,7 +37,6 @@ type Configuration struct {
EtcdCert string `json:"etcd-cert"`
EtcdKey string `json:"etcd-key"`
EtcdCAFile string `json:"etcd-ca-file"`
- KubeConfigDir string `json:"kube-config-dir"`
OVNCentralAddress string `json:"ovn-central-address"`
ServicePort string `json:"service-port"`
}
@@ -86,7 +85,6 @@ func defaultConfiguration() *Configuration {
EtcdCert: "etcd.cert",
EtcdKey: "etcd.key",
EtcdCAFile: "etcd-ca.cert",
- KubeConfigDir: cwd,
OVNCentralAddress: "127.0.0.1",
ServicePort: "9015",
}
diff --git a/src/k8splugin/internal/connection/connection.go b/src/k8splugin/internal/connection/connection.go
index adb1e992..df1400b5 100644
--- a/src/k8splugin/internal/connection/connection.go
+++ b/src/k8splugin/internal/connection/connection.go
@@ -20,8 +20,6 @@ import (
"encoding/base64"
"encoding/json"
"io/ioutil"
- "log"
- "path/filepath"
"github.com/onap/multicloud-k8s/src/k8splugin/internal/db"
@@ -149,7 +147,6 @@ func (v *ConnectionClient) GetConnectivityRecordByName(connectionName string,
}
for _, value := range conn.OtherConnectivityList.ConnectivityRecords {
- log.Println(value)
if connectivityRecordName == value["connectivity-record-name"] {
return value, nil
}
@@ -173,7 +170,7 @@ func (v *ConnectionClient) Delete(name string) error {
// Download the connection information onto a kubeconfig file
// The file is named after the name of the connection and will
// be placed in the provided parent directory
-func (v *ConnectionClient) Download(name string, parentdir string) (string, error) {
+func (v *ConnectionClient) Download(name string) (string, error) {
conn, err := v.Get(name)
if err != nil {
@@ -186,11 +183,17 @@ func (v *ConnectionClient) Download(name string, parentdir string) (string, erro
return "", pkgerrors.Wrap(err, "Converting from base64")
}
- target := filepath.Join(parentdir, conn.CloudRegion)
- err = ioutil.WriteFile(target, kubeContent, 0644)
+ //Create temp file to write kubeconfig
+ //Assume this file will be deleted after usage by the consumer
+ tempF, err := ioutil.TempFile("", "kube-config-temp-")
+ if err != nil {
+ return "", pkgerrors.Wrap(err, "Creating temp file")
+ }
+
+ _, err = tempF.Write(kubeContent)
if err != nil {
return "", pkgerrors.Wrap(err, "Writing kubeconfig to file")
}
- return target, nil
+ return tempF.Name(), nil
}