Skip to content

Commit

Permalink
add image pull secrets to api
Browse files Browse the repository at this point in the history
  • Loading branch information
m-terra committed May 17, 2024
1 parent cef3474 commit 92f8cb6
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ test: generate manifests docs golint helm-test unit-test

manifests: controller-gen
$(CONTROLLER_GEN) crd rbac:roleName=manager-role webhook paths="./.../..." output:crd:artifacts:config=config/crd/bases
cp config/crd/bases/config.haproxy.com*.yaml helm/haproxy-operator/crds/
cp config/crd/bases/*.haproxy.com*.yaml helm/haproxy-operator/crds/

generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack\\boilerplate.go.txt" paths="./.../..."
Expand Down
3 changes: 3 additions & 0 deletions apis/proxy/v1alpha1/instance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ type InstanceSpec struct {
// ServiceAccountName is the name of the ServiceAccount to use to run this Instance.
// +optional
ServiceAccountName string `json:"serviceAccountName,omitempty"`
// ImagePullSecrets is an optional list of secret names in the same namespace to use for pulling any of the images used.
// +optional
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
// AllowPrivilegedPorts allows to bind sockets with port numbers less than 1024.
// +optional
// +nullable
Expand Down
5 changes: 5 additions & 0 deletions apis/proxy/v1alpha1/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions controllers/instance/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func (r *Reconciler) reconcileStatefulSet(ctx context.Context, instance *proxyv1
},
Spec: corev1.PodSpec{
ServiceAccountName: instance.Spec.ServiceAccountName,
ImagePullSecrets: instance.Spec.ImagePullSecrets,
Containers: []corev1.Container{
{
Name: "haproxy",
Expand Down
47 changes: 45 additions & 2 deletions helm/haproxy-operator/crds/proxy.haproxy.com_instances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
name: instances.proxy.haproxy.com
spec:
group: proxy.haproxy.com
Expand Down Expand Up @@ -525,13 +524,33 @@ spec:
- global
- selector
type: object
env:
additionalProperties:
type: string
description: Env additional environment variables
nullable: true
type: object
image:
default: haproxy:latest
description: Image specifies the HaProxy image including th tag.
type: string
imagePullPolicy:
description: ImagePullPolicy one of Always, Never, IfNotPresent.
type: string
imagePullSecrets:
description: ImagePullSecrets is an optional list of secret names
in the same namespace to use for pulling any of the images used.
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
labels:
additionalProperties:
type: string
Expand Down Expand Up @@ -1232,6 +1251,18 @@ spec:
required:
- port
type: object
sleep:
description: Sleep represents the duration that the
container should sleep before being terminated.
properties:
seconds:
description: Seconds is the number of seconds to
sleep.
format: int64
type: integer
required:
- seconds
type: object
tcpSocket:
description: Deprecated. TCPSocket is NOT supported
as a LifecycleHandler and kept for the backward compatibility.
Expand Down Expand Up @@ -1330,6 +1361,18 @@ spec:
required:
- port
type: object
sleep:
description: Sleep represents the duration that the
container should sleep before being terminated.
properties:
seconds:
description: Seconds is the number of seconds to
sleep.
format: int64
type: integer
required:
- seconds
type: object
tcpSocket:
description: Deprecated. TCPSocket is NOT supported
as a LifecycleHandler and kept for the backward compatibility.
Expand Down

0 comments on commit 92f8cb6

Please sign in to comment.