Skip to content

Commit

Permalink
add image-upload command to virtctl
Browse files Browse the repository at this point in the history
  • Loading branch information
mhenriks committed Oct 22, 2018
1 parent 2f54966 commit f167234
Show file tree
Hide file tree
Showing 3 changed files with 605 additions and 0 deletions.
322 changes: 322 additions & 0 deletions manifests/testing/cdi-v1.2.0.yaml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
kind: ServiceAccount
apiVersion: v1
metadata:
name: cdi-sa
namespace: {{ .Namespace }}
labels:
cdi.kubevirt.io: ""
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: cdi
labels:
cdi.kubevirt.io: ""
rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["persistentvolumeclaims/finalizers"]
verbs: ["update"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["pods/finalizers"]
verbs: ["update"]
- apiGroups: [""]
resources: ["services"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "watch", "create"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list", "watch", "create"]
- apiGroups: ["cdi.kubevirt.io"]
resources:
- '*'
verbs:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: cdi-sa
labels:
cdi.kubevirt.io: ""
roleRef:
kind: ClusterRole
name: cdi
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: cdi-sa
namespace: {{ .Namespace }}
---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: cdi-deployment
namespace: {{ .Namespace }}
labels:
cdi.kubevirt.io: ""
app: containerized-data-importer
spec:
selector:
matchLabels:
app: containerized-data-importer
replicas: 1
template:
metadata:
labels:
app: containerized-data-importer
spec:
serviceAccountName: cdi-sa
containers:
- name: cdi-controller
image: kubevirt/cdi-controller:v1.2.0
imagePullPolicy: IfNotPresent
args: ["-v=2"] # default verbosity; change to 2 or 3 for more detailed logging
env:
- name: IMPORTER_IMAGE
value: kubevirt/cdi-importer:v1.2.0
- name: CLONER_IMAGE
value: kubevirt/cdi-cloner:v1.2.0
- name: UPLOADSERVER_IMAGE
value: kubevirt/cdi-uploadserver:v1.2.0
- name: PULL_POLICY
value: IfNotPresent
- name: UPLOADPROXY_SERVICE
value: cdi-uploadproxy
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
labels:
cdi.kubevirt.io: ""
name: datavolumes.cdi.kubevirt.io
spec:
group: cdi.kubevirt.io
names:
kind: DataVolume
plural: datavolumes
shortNames:
- dv
- dvs
singular: datavolume
scope: Namespaced
version: v1alpha1
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: cdi-apiserver
namespace: {{ .Namespace }}
labels:
kubevirt.io: ""
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: cdi-apiserver
namespace: {{ .Namespace }}
labels:
kubevirt.io: ""
roleRef:
kind: Role
name: cdi-apiserver
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: cdi-apiserver
namespace: {{ .Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: cdi-apiserver
namespace: {{ .Namespace }}
labels:
kubevirt.io: ""
rules:
- apiGroups:
- ''
resources:
- secrets
verbs:
- get
- create
- apiGroups:
- ''
resources:
- configmaps
verbs:
- get
- create
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: cdi-apiserver
labels:
kubevirt.io: ""
roleRef:
kind: ClusterRole
name: cdi-apiserver
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: cdi-apiserver
namespace: {{ .Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: cdi-apiserver
labels:
kubevirt.io: ""
rules:
- apiGroups:
- apiregistration.k8s.io
resources:
- apiservices
verbs:
- get
- create
- update
- apiGroups:
- ''
resources:
- pods
- persistentvolumeclaims
verbs:
- get
- list
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: cdi-apiserver-auth-delegator
labels:
kubevirt.io: ""
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:auth-delegator
subjects:
- kind: ServiceAccount
name: cdi-apiserver
namespace: {{ .Namespace }}
---
apiVersion: v1
kind: Service
metadata:
name: cdi-api
namespace: {{ .Namespace }}
labels:
cdi.kubevirt.io: "cdi-api"
spec:
ports:
- port: 443
targetPort: 8443
protocol: TCP
selector:
cdi.kubevirt.io: cdi-api
---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: cdi-api
namespace: {{ .Namespace }}
labels:
cdi.kubevirt.io: "cdi-api"
spec:
selector:
matchLabels:
cdi.kubevirt.io: "cdi-api"
replicas: 1
template:
metadata:
labels:
cdi.kubevirt.io: "cdi-api"
spec:
serviceAccountName: cdi-apiserver
containers:
- name: cdi-apiserver-api
image: kubevirt/cdi-apiserver:v1.2.0
imagePullPolicy: IfNotPresent
args: ["-v=2"] # default verbosity; change to 2 or 3 for more detailed logging
---
apiVersion: v1
kind: Service
metadata:
name: cdi-uploadproxy
namespace: {{ .Namespace }}
labels:
cdi.kubevirt.io: "cdi-uploadproxy"
spec:
ports:
- port: 443
targetPort: 8443
protocol: TCP
selector:
cdi.kubevirt.io: cdi-uploadproxy
---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: cdi-uploadproxy
namespace: {{ .Namespace }}
labels:
cdi.kubevirt.io: "cdi-uploadproxy"
spec:
selector:
matchLabels:
cdi.kubevirt.io: "cdi-uploadproxy"
replicas: 1
template:
metadata:
labels:
cdi.kubevirt.io: "cdi-uploadproxy"
spec:
containers:
- name: cdi-uploadproxy
image: kubevirt/cdi-uploadproxy:v1.2.0
imagePullPolicy: IfNotPresent
args: ["-v=2"] # default verbosity; change to 2 or 3 for more detailed logging
env:
- name: APISERVER_PUBLIC_KEY
valueFrom:
secretKeyRef:
name: cdi-api-signing-key
key: id_rsa.pub
- name: UPLOAD_SERVER_CLIENT_KEY
valueFrom:
secretKeyRef:
name: cdi-upload-server-client-key
key: tls.key
- name: UPLOAD_SERVER_CLIENT_CERT
valueFrom:
secretKeyRef:
name: cdi-upload-server-client-key
key: tls.crt
- name: UPLOAD_SERVER_CA_CERT
valueFrom:
secretKeyRef:
name: cdi-upload-server-client-key
key: ca.crt
- name: SERVICE_TLS_KEY
valueFrom:
secretKeyRef:
name: cdi-upload-proxy-server-key
key: tls.key
- name: SERVICE_TLS_CERT
valueFrom:
secretKeyRef:
name: cdi-upload-proxy-server-key
key: tls.crt
2 changes: 2 additions & 0 deletions pkg/virtctl/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"kubevirt.io/kubevirt/pkg/virtctl/console"
"kubevirt.io/kubevirt/pkg/virtctl/expose"
"kubevirt.io/kubevirt/pkg/virtctl/templates"
"kubevirt.io/kubevirt/pkg/virtctl/uploadimage"
"kubevirt.io/kubevirt/pkg/virtctl/version"
"kubevirt.io/kubevirt/pkg/virtctl/vm"
"kubevirt.io/kubevirt/pkg/virtctl/vnc"
Expand Down Expand Up @@ -47,6 +48,7 @@ func NewVirtctlCommand() *cobra.Command {
vm.NewStopCommand(clientConfig),
expose.NewExposeCommand(clientConfig),
version.VersionCommand(clientConfig),
uploadimage.NewImageUploadCommand(clientConfig),
optionsCmd,
)
return rootCmd
Expand Down
Loading

0 comments on commit f167234

Please sign in to comment.