Skip to content

Commit

Permalink
Merge pull request kubevirt#558 from cynepco3hahue/use_kube_system_as…
Browse files Browse the repository at this point in the history
…_namespace

Move our manifests to kube-system namespace
  • Loading branch information
rmohr authored Nov 17, 2017
2 parents da40779 + 8845905 commit 54c961c
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 29 deletions.
21 changes: 7 additions & 14 deletions automation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,34 +113,27 @@ done
cluster/sync.sh

# Wait until kubevirt pods are running
while [ -n "$(kubectl get pods --no-headers | grep -v Running)" ]; do
while [ -n "$(kubectl get pods -n kube-system --no-headers | grep -v Running)" ]; do
echo "Waiting for kubevirt pods to enter the Running state ..."
kubectl get pods --no-headers | >&2 grep -v Running || true
kubectl get pods -n kube-system --no-headers | >&2 grep -v Running || true
sleep 10
done

# Make sure all containers except virt-controller are ready
while [ -n "$(kubectl get pods -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '!/virt-controller/ && /false/')" ]; do
while [ -n "$(kubectl get pods -n kube-system -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '!/virt-controller/ && /false/')" ]; do
echo "Waiting for KubeVirt containers to become ready ..."
kubectl get pods -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '!/virt-controller/ && /false/' || true
kubectl get pods -n kube-system -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '!/virt-controller/ && /false/' || true
sleep 10
done

# Make sure that at least one virt-controller container is ready
while [ "$(kubectl get pods -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '/virt-controller/ && /true/' | wc -l)" -lt "1" ]; do
while [ "$(kubectl get pods -n kube-system -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '/virt-controller/ && /true/' | wc -l)" -lt "1" ]; do
echo "Waiting for KubeVirt virt-controller container to become ready ..."
kubectl get pods -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '/virt-controller/ && /true/' | wc -l
kubectl get pods -n kube-system -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | awk '/virt-controller/ && /true/' | wc -l
sleep 10
done

# Wait until all pods are running
while [ -n "$(kubectl get pods --no-headers --all-namespaces | grep -v Running)" ]; do
echo "Waiting for pods in all namespaces to enter the Running state ..."
kubectl get pods --no-headers --all-namespaces | >&2 grep -v Running || true
sleep 5
done

kubectl get pods --all-namespaces
kubectl get pods -n kube-system
kubectl version

# Disable proxy configuration since it causes test issues
Expand Down
1 change: 1 addition & 0 deletions cluster/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ apiVersion: v1
kind: Service
metadata:
name: external-$NAME
namespace: kube-system
spec:
externalIPs:
- "$master_ip"
Expand Down
2 changes: 1 addition & 1 deletion cluster/vagrant/setup_kubernetes_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ yum install -y \
# Latest docker on CentOS uses systemd for cgroup management
cat << EOT >>/etc/systemd/system/kubelet.service.d/09-kubeadm.conf
[Service]
Environment="KUBELET_EXTRA_ARGS=--cgroup-driver=systemd --fail-swap-on=false"
Environment="KUBELET_EXTRA_ARGS=--cgroup-driver=systemd --fail-swap-on=false --runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice"
EOT
systemctl daemon-reload

Expand Down
2 changes: 2 additions & 0 deletions manifests/haproxy.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: haproxy
namespace: kube-system
spec:
ports:
- port: 8184
Expand All @@ -13,6 +14,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: haproxy
namespace: kube-system
spec:
template:
metadata:
Expand Down
3 changes: 3 additions & 0 deletions manifests/iscsi-auth-demo-target.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Secret
metadata:
name: iscsi-auth-demo-secret
namespace: kube-system
type: "kubernetes.io/iscsi-chap"
data:
node.session.auth.username: ZGVtb3VzZXI=
Expand All @@ -11,6 +12,7 @@ apiVersion: v1
kind: Service
metadata:
name: iscsi-auth-demo-target
namespace: kube-system
spec:
ports:
- name: iscsi
Expand All @@ -23,6 +25,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: iscsi-auth-demo-target-tgtd
namespace: kube-system
spec:
template:
metadata:
Expand Down
8 changes: 5 additions & 3 deletions manifests/iscsi-demo-target.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ spec:
iscsi:
iqn: iqn.2017-01.io.kubevirt:sn.42
lun: 1
targetPortal: iscsi-demo-target.default.svc.cluster.local
targetPortal: iscsi-demo-target.kube-system.svc.cluster.local
---
apiVersion: v1
kind: PersistentVolume
Expand All @@ -75,7 +75,7 @@ spec:
iscsi:
iqn: iqn.2017-01.io.kubevirt:sn.42
lun: 2
targetPortal: iscsi-demo-target.default.svc.cluster.local
targetPortal: iscsi-demo-target.kube-system.svc.cluster.local
---
apiVersion: v1
kind: PersistentVolume
Expand All @@ -91,12 +91,13 @@ spec:
iscsi:
iqn: iqn.2017-01.io.kubevirt:sn.42
lun: 3
targetPortal: iscsi-demo-target.default.svc.cluster.local
targetPortal: iscsi-demo-target.kube-system.svc.cluster.local
---
apiVersion: v1
kind: Service
metadata:
name: iscsi-demo-target
namespace: kube-system
spec:
ports:
- name: iscsi
Expand All @@ -109,6 +110,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: iscsi-demo-target-tgtd
namespace: kube-system
spec:
template:
metadata:
Expand Down
1 change: 1 addition & 0 deletions manifests/libvirt.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: libvirt
namespace: kube-system
spec:
template:
metadata:
Expand Down
9 changes: 7 additions & 2 deletions manifests/rbac.authorization.k8s.io.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: kubevirt-infra
namespace: kube-system
labels:
name: kubevirt
rules:
Expand Down Expand Up @@ -44,20 +45,23 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: kubevirt-infra
namespace: kube-system
labels:
name: kubevirt
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kubevirt-admin
namespace: kube-system
labels:
name: kubevirt-admin
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kubevirt-infra
namespace: kube-system
labels:
name: kubevirt
roleRef:
Expand All @@ -67,12 +71,13 @@ roleRef:
subjects:
- kind: ServiceAccount
name: kubevirt-infra
namespace: default
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kubevirt-infra-cluster-admin
namespace: kube-system
labels:
name: kubevirt
roleRef:
Expand All @@ -82,4 +87,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: kubevirt-infra
namespace: default
namespace: kube-system
2 changes: 2 additions & 0 deletions manifests/squid.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: spice-proxy
namespace: kube-system
spec:
ports:
- port: 3128
Expand All @@ -13,6 +14,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: spice-proxy
namespace: kube-system
spec:
template:
metadata:
Expand Down
2 changes: 2 additions & 0 deletions manifests/virt-api.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: virt-api
namespace: kube-system
spec:
ports:
- port: 8183
Expand All @@ -13,6 +14,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: virt-api
namespace: kube-system
spec:
template:
metadata:
Expand Down
2 changes: 2 additions & 0 deletions manifests/virt-controller.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: virt-controller
namespace: kube-system
spec:
ports:
- port: 8182
Expand All @@ -13,6 +14,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: virt-controller
namespace: kube-system
spec:
replicas: 2
template:
Expand Down
1 change: 1 addition & 0 deletions manifests/virt-handler.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: virt-handler
namespace: kube-system
spec:
template:
metadata:
Expand Down
2 changes: 2 additions & 0 deletions manifests/virt-manifest.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: virt-manifest
namespace: kube-system
spec:
ports:
- port: 8186
Expand All @@ -13,6 +14,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: virt-manifest
namespace: kube-system
spec:
template:
metadata:
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/expectations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func newReplicationController(replicas int) *v1.ReplicationController {
ObjectMeta: metav1.ObjectMeta{
UID: uuid.NewUUID(),
Name: "foobar",
Namespace: metav1.NamespaceDefault,
Namespace: metav1.NamespaceSystem,
ResourceVersion: "18",
},
Spec: v1.ReplicationControllerSpec{
Expand Down
2 changes: 1 addition & 1 deletion pkg/virt-controller/leaderelectionconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const (
DefaultLeaseDuration = 15 * time.Second
DefaultRenewDeadline = 10 * time.Second
DefaultRetryPeriod = 2 * time.Second
DefaultNamespace = "default"
DefaultNamespace = "kube-system"
DefaultEndpointName = "virt-controller"
)

Expand Down
6 changes: 3 additions & 3 deletions tests/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var _ = Describe("Storage", func() {
})

getTargetLogs := func(tailLines int64) string {
pods, err := virtClient.CoreV1().Pods(k8sv1.NamespaceDefault).List(metav1.ListOptions{LabelSelector: "app in (iscsi-demo-target)"})
pods, err := virtClient.CoreV1().Pods(metav1.NamespaceSystem).List(metav1.ListOptions{LabelSelector: "app in (iscsi-demo-target)"})
Expect(err).ToNot(HaveOccurred())

//FIXME Sometimes pods hang in terminating state, select the pod which does not have a deletion timestamp
Expand All @@ -60,7 +60,7 @@ var _ = Describe("Storage", func() {
Expect(podName).ToNot(BeEmpty())

logsRaw, err := virtClient.CoreV1().
Pods("default").
Pods(metav1.NamespaceSystem).
GetLogs(podName,
&k8sv1.PodLogOptions{TailLines: &tailLines}).
DoRaw()
Expand Down Expand Up @@ -99,7 +99,7 @@ var _ = Describe("Storage", func() {
Context("Given a fresh iSCSI target", func() {

It("should be available and ready", func() {
logs := getTargetLogs(70)
logs := getTargetLogs(75)
Expect(logs).To(ContainSubstring("Target 1: iqn.2017-01.io.kubevirt:sn.42"))
Expect(logs).To(ContainSubstring("Driver: iscsi"))
Expect(logs).To(ContainSubstring("State: ready"))
Expand Down
8 changes: 4 additions & 4 deletions tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,11 @@ func newPV(os string, lun int32, withAuth bool) *k8sv1.PersistentVolume {
PanicOnError(err)

name := fmt.Sprintf("iscsi-disk-%s-for-tests", os)
target := "iscsi-demo-target.default.svc.cluster.local"
target := "iscsi-demo-target.kube-system.svc.cluster.local"
label := os
if withAuth {
name = fmt.Sprintf("iscsi-auth-disk-%s-for-tests", os)
target = "iscsi-auth-demo-target.default.svc.cluster.local"
target = "iscsi-auth-demo-target.kube-system.svc.cluster.local"
label = fmt.Sprintf("%s-auth", os)
}

Expand Down Expand Up @@ -602,7 +602,7 @@ func NewRandomVMWithDirectLun(lun int, withAuth bool) *v1.VirtualMachine {
},
Source: v1.DiskSource{
Host: &v1.DiskSourceHost{
Name: "iscsi-demo-target.default",
Name: "iscsi-demo-target.kube-system",
Port: "3260",
},
Protocol: "iscsi",
Expand All @@ -618,7 +618,7 @@ func NewRandomVMWithDirectLun(lun int, withAuth bool) *v1.VirtualMachine {
Usage: "iscsi-demo-secret",
},
}
vm.Spec.Domain.Devices.Disks[0].Source.Host.Name = "iscsi-auth-demo-target.default"
vm.Spec.Domain.Devices.Disks[0].Source.Host.Name = "iscsi-auth-demo-target.kube-system"
}
return vm
}
Expand Down

0 comments on commit 54c961c

Please sign in to comment.