Skip to content

Commit

Permalink
version complete of pod generation, command/args injection to be veri…
Browse files Browse the repository at this point in the history
…fied
  • Loading branch information
Francesco Gualazzi committed May 5, 2018
1 parent 2d52573 commit 5a17429
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 13 deletions.
23 changes: 22 additions & 1 deletion deploy/cr.yaml
@@ -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"



2 changes: 1 addition & 1 deletion deploy/operator.yaml
@@ -1,4 +1,4 @@
apiVersion: apps/v1
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: cdkube
Expand Down
15 changes: 6 additions & 9 deletions deploy/rbac.yaml
@@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/delivery/v1alpha1/types.go
Expand Up @@ -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"`
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/delivery/v1alpha1/zz_generated.deepcopy.go
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/stub/handler.go
Expand Up @@ -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{
Expand Down

0 comments on commit 5a17429

Please sign in to comment.