Skip to content

Commit

Permalink
Merge pull request #21 from janlauber/enhance-input-stuff
Browse files Browse the repository at this point in the history
Add args and command
  • Loading branch information
janlauber authored Mar 30, 2024
2 parents e3593a7 + d3c7ff1 commit b7dbd55
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 299 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ metadata:
name: nginx
namespace: test
spec:
args: ["nginx", "-g", "daemon off;"]
command: ["nginx"]
image:
registry: "docker.io"
repository: "nginx"
Expand Down Expand Up @@ -76,8 +78,9 @@ spec:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
rules:
- host: "reflex.oneclickapps.dev"
path: "/test"
tls: false
path: "/"
tls: true
tlsSecretName: "wildcard-tls-secret"
- host: "reflex.oneclickapps.dev"
path: "/test"
tls: false
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/rollout_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ type IngressRule struct {

// RolloutSpec defines the desired state of Rollout
type RolloutSpec struct {
Args []string `json:"args,omitempty"`
Command []string `json:"command,omitempty"`
Image ImageSpec `json:"image"`
SecurityContext SecurityContextSpec `json:"securityContext,omitempty"`
HorizontalScale HorizontalScaleSpec `json:"horizontalScale"`
Expand Down
10 changes: 10 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions config/crd/bases/one-click.dev_rollouts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ spec:
spec:
description: RolloutSpec defines the desired state of Rollout
properties:
args:
items:
type: string
type: array
command:
items:
type: string
type: array
env:
items:
properties:
Expand Down
297 changes: 0 additions & 297 deletions config/crd/bases/one-click.io_rollouts.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions controllers/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ func (r *RolloutReconciler) deploymentForRollout(ctx context.Context, f *oneclic
},
}

// if args are defined, add them to the container
if len(f.Spec.Args) > 0 {
dep.Spec.Template.Spec.Containers[0].Args = f.Spec.Args
}

// if command is defined, add it to the container
if len(f.Spec.Command) > 0 {
dep.Spec.Template.Spec.Containers[0].Command = f.Spec.Command
}

// if security context is defined, add it to the pod security context
if !reflect.DeepEqual(f.Spec.SecurityContext, oneclickiov1alpha1.SecurityContextSpec{}) {
dep.Spec.Template.Spec.SecurityContext = &corev1.PodSecurityContext{
Expand Down
Loading

0 comments on commit b7dbd55

Please sign in to comment.