Permalink
Browse files

version complete of pod generation, command/args injection to be veri…

…fied
  • Loading branch information...
Francesco Gualazzi
Francesco Gualazzi committed May 5, 2018
1 parent 2d52573 commit 5a17429d206475bcef85077d1f9aeb6fdda50357
@@ -1,4 +1,25 @@
apiVersion: "delivery.inge.4pr.es/v1alpha1"
kind: "Pipeline"
metadata:
name: "example"
name: "doing-nothing"
namespace: default
spec:
repo: "http://github.com/inge4pres/just-a-test"
buildImage: "busybox"
buildCmds:
- "/bin/sh"
- "-c"
buildArgs:
- echo
- "building something..."
- "&&"
- sleep
- 30
- "&&"
- "echo"
- "I'm done"
targetName: "testapp"
targetVersion: "0.1"



@@ -1,4 +1,4 @@
apiVersion: apps/v1
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: cdkube
@@ -1,16 +1,16 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
namespace: default
name: cdkube
rules:
- apiGroups:
- delivery.inge.4pr.es
- "delivery.inge.4pr.es"
resources:
- "*"
verbs:
- "*"
- apiGroups:
- ""
- apiGroups: [""]
resources:
- pods
- services
@@ -21,22 +21,19 @@ rules:
- secrets
verbs:
- "*"
- apiGroups:
- apps
- apiGroups: ["extensions", "apps"]
resources:
- deployments
- daemonsets
- replicasets
- statefulsets
verbs:
- "*"

verbs: ["*"]
---

kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: default-account-cdkube
namespace: default
subjects:
- kind: ServiceAccount
name: default
@@ -26,6 +26,7 @@ type PipelineSpec struct {
Repo string `json:"repo"`
BuildImage string `json:"buildImage"`
BuildCmds []string `json:"buildCommands"`
BuildArgs []string `json:"buildArguments"`
TargetVersion string `json:"targetVersion"`
TargetName string `json:"targetName"`
}
@@ -79,6 +79,11 @@ func (in *PipelineSpec) DeepCopyInto(out *PipelineSpec) {
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.BuildArgs != nil {
in, out := &in.BuildArgs, &out.BuildArgs
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}

@@ -76,15 +76,15 @@ func newDockerBuilderPod(pipe *v1alpha1.Pipeline) *v1.Pod {
Name: "builder",
Image: pipe.Spec.BuildImage,
Command: pipe.Spec.BuildCmds,
Args: pipe.Spec.BuildArgs,
},
}
return pod
}

func namespacedPodForPipeline(pipe *v1alpha1.Pipeline, namespace string) *v1.Pod {
labels := map[string]string{
"app": pipe.Spec.TargetName,
"repo": pipe.Spec.Repo,
"app": pipe.Spec.TargetName,
}
return &v1.Pod{
TypeMeta: metav1.TypeMeta{

0 comments on commit 5a17429

Please sign in to comment.