Skip to content

Commit

Permalink
Tests passing with storage-provisioner in addons
Browse files Browse the repository at this point in the history
  • Loading branch information
Priya Wadhwa committed Oct 30, 2017
1 parent a8fedc8 commit 71b38d1
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 6 deletions.
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,13 @@ $(ISO_BUILD_IMAGE): deploy/iso/minikube-iso/Dockerfile
@echo ""
@echo "$(@) successfully built"

out/storage-provisioner-main: cmd/storage-provisioner/main.go
storage-provisioner-main: cmd/storage-provisioner/main.go
go build cmd/storage-provisioner/main.go

.PHONY: storage-provisioner-image
storage-provisioner-image: out/storage-provisioner-main
storage-provisioner-image: storage-provisioner-main
docker build -t $(REGISTRY)/storage-provisioner:$(TAG) -f deploy/storage-provisioner/Dockerfile .
gcloud docker -- push $(REGISTRY)/storage-provisioner:$(TAG)
# docker build -t gcr.io/priya-wadhwa/storage-provisioner:$(TAG) -f deploy/storage-provisioner/Dockerfile .
# gcloud docker -- push gcr.io/priya-wadhwa/storage-provisioner:$(TAG)

.PHONY: release-iso
release-iso: minikube_iso checksum
Expand Down
2 changes: 0 additions & 2 deletions cmd/localkube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,4 @@ func SetupServer(s *localkube.LocalkubeServer) {
proxy := s.NewProxyServer()
s.AddServer(proxy)

storageProvisioner := s.NewStorageProvisionerServer()
s.AddServer(storageProvisioner)
}
29 changes: 29 additions & 0 deletions deploy/addons/storage-provisioner/storage-provisioner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Pod
metadata:
name: storage-provisioner
namespace: kube-system
labels:
integration-test: storage-provisioner
addonmanager.kubernetes.io/mode: Reconcile
kubernetes.io/minikube-addons: storage-provisioner
spec:
hostNetwork: true
containers:
- name: storage-provisioner
image: gcr.io/k8s-minikube/storage-provisioner:v1.8.0
imagePullPolicy: IfNotPresent
7 changes: 7 additions & 0 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ var Addons = map[string]*Addon{
"storageclass.yaml",
"0640"),
}, true, "default-storageclass"),
"storage-provisioner": NewAddon([]*BinDataAsset{
NewBinDataAsset(
"deploy/addons/storage-provisioner/storage-provisioner.yaml",
constants.AddonsPath,
"storage-provisioner.yaml",
"0640"),
}, true, "storage-provisioner"),
"coredns": NewAddon([]*BinDataAsset{
NewBinDataAsset(
"deploy/addons/coredns/coreDNS-controller.yaml",
Expand Down
22 changes: 22 additions & 0 deletions test/integration/pv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ package integration

import (
"fmt"
"github.com/pkg/errors"
"path/filepath"
"testing"
"time"

"k8s.io/apimachinery/pkg/labels"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/storage"
commonutil "k8s.io/minikube/pkg/util"
"k8s.io/minikube/test/integration/util"
)

Expand Down Expand Up @@ -58,6 +61,25 @@ func testProvisioning(t *testing.T) {
t.Fatalf("No default storage class: %s", err)
}

// Check that the storage provisioner pod is running

checkPodRunning := func() error {
client, err := commonutil.GetClient()
if err != nil {
return errors.Wrap(err, "getting kubernetes client")
}
selector := labels.SelectorFromSet(labels.Set(map[string]string{"integration-test": "storage-provisioner"}))

if err := commonutil.WaitForPodsWithLabelRunning(client, "kube-system", selector); err != nil {
return err
}
return nil
}

if err := checkPodRunning(); err != nil {
t.Fatal("Check storage-provisioner pod running failed with error: ", err)
}

// Now create the PVC
pvcPath := filepath.Join(*testdataDir, "pvc.yaml")
if _, err := kubectlRunner.RunCommand([]string{"create", "-f", pvcPath}); err != nil {
Expand Down

0 comments on commit 71b38d1

Please sign in to comment.