Skip to content

Commit

Permalink
vectorized/v1alpha1: add image pull options to console deployment spec
Browse files Browse the repository at this point in the history
vectorized/v1alpha1: run all the tasks
  • Loading branch information
bojand committed May 27, 2024
1 parent 52079ad commit 1db8561
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/go/k8s/api/vectorized/v1alpha1/console_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ type Schema struct {
type Deployment struct {
Image string `json:"image"`

// +optional
// Specifies credentials for a private image repository. For details, see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/.
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`

// +optional
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`

// +kubebuilder:default=1
Replicas int32 `json:"replicas,omitempty"`

Expand Down
5 changes: 5 additions & 0 deletions src/go/k8s/api/vectorized/v1alpha1/zz_generated.deepcopy.go

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

18 changes: 18 additions & 0 deletions src/go/k8s/config/crd/bases/redpanda.vectorized.io_consoles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,24 @@ spec:
properties:
image:
type: string
imagePullPolicy:
description: PullPolicy describes a policy for if/when to pull
a container image
type: string
imagePullSecrets:
description: Specifies credentials for a private image repository.
For details, see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/.
items:
description: LocalObjectReference contains enough information
to let you locate the referenced object inside the same namespace.
properties:
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
x-kubernetes-map-type: atomic
type: array
maxSurge:
default: 1
format: int32
Expand Down
8 changes: 5 additions & 3 deletions src/go/k8s/pkg/console/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (d *Deployment) Ensure(ctx context.Context) error {
Containers: containers,
TerminationGracePeriodSeconds: getGracePeriod(d.consoleobj.Spec.Server.ServerGracefulShutdownTimeout.Duration),
ServiceAccountName: sa,
ImagePullSecrets: d.consoleobj.Spec.Deployment.ImagePullSecrets,
},
},
Strategy: v1.DeploymentStrategy{
Expand Down Expand Up @@ -555,9 +556,10 @@ func (d *Deployment) getContainers(ctx context.Context, ss map[string]string) ([

return []corev1.Container{
{
Name: ConsoleContainerName,
Image: d.consoleobj.Spec.Deployment.Image,
Args: []string{fmt.Sprintf("--config.filepath=%s/%s", configMountPath, "config.yaml")},
Name: ConsoleContainerName,
Image: d.consoleobj.Spec.Deployment.Image,
ImagePullPolicy: d.consoleobj.Spec.Deployment.ImagePullPolicy,
Args: []string{fmt.Sprintf("--config.filepath=%s/%s", configMountPath, "config.yaml")},
Ports: []corev1.ContainerPort{
{
Name: "http",
Expand Down

0 comments on commit 1db8561

Please sign in to comment.