Skip to content

Commit

Permalink
Merge pull request #148 from KevFan/pullPolicy
Browse files Browse the repository at this point in the history
refactor: use k8score.PullPolicy type for image pull policy type in spec
  • Loading branch information
KevFan authored Oct 26, 2023
2 parents 57023d1 + eceb8d1 commit c2e167d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 20 deletions.
32 changes: 16 additions & 16 deletions api/v1beta1/authorino_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@ type AuthorinoSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

Image string `json:"image,omitempty"`
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
Replicas *int32 `json:"replicas,omitempty"`
Volumes VolumesSpec `json:"volumes,omitempty"`
LogLevel string `json:"logLevel,omitempty"`
LogMode string `json:"logMode,omitempty"`
ClusterWide bool `json:"clusterWide,omitempty"`
Listener Listener `json:"listener"`
OIDCServer OIDCServer `json:"oidcServer"`
AuthConfigLabelSelectors string `json:"authConfigLabelSelectors,omitempty"`
SecretLabelSelectors string `json:"secretLabelSelectors,omitempty"`
SupersedingHostSubsets bool `json:"supersedingHostSubsets,omitempty"`
EvaluatorCacheSize *int `json:"evaluatorCacheSize,omitempty"`
Tracing Tracing `json:"tracing,omitempty"`
Metrics Metrics `json:"metrics,omitempty"`
Healthz Healthz `json:"healthz,omitempty"`
Image string `json:"image,omitempty"`
ImagePullPolicy k8score.PullPolicy `json:"imagePullPolicy,omitempty"`
Replicas *int32 `json:"replicas,omitempty"`
Volumes VolumesSpec `json:"volumes,omitempty"`
LogLevel string `json:"logLevel,omitempty"`
LogMode string `json:"logMode,omitempty"`
ClusterWide bool `json:"clusterWide,omitempty"`
Listener Listener `json:"listener"`
OIDCServer OIDCServer `json:"oidcServer"`
AuthConfigLabelSelectors string `json:"authConfigLabelSelectors,omitempty"`
SecretLabelSelectors string `json:"secretLabelSelectors,omitempty"`
SupersedingHostSubsets bool `json:"supersedingHostSubsets,omitempty"`
EvaluatorCacheSize *int `json:"evaluatorCacheSize,omitempty"`
Tracing Tracing `json:"tracing,omitempty"`
Metrics Metrics `json:"metrics,omitempty"`
Healthz Healthz `json:"healthz,omitempty"`
}

type Listener struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ spec:
image:
type: string
imagePullPolicy:
description: PullPolicy describes a policy for if/when to pull a container
image
type: string
listener:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ spec:
image:
type: string
imagePullPolicy:
description: PullPolicy describes a policy for if/when to pull a container
image
type: string
listener:
properties:
Expand Down
2 changes: 2 additions & 0 deletions config/deploy/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5451,6 +5451,8 @@ spec:
image:
type: string
imagePullPolicy:
description: PullPolicy describes a policy for if/when to pull a container
image
type: string
listener:
properties:
Expand Down
2 changes: 2 additions & 0 deletions config/install/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ spec:
image:
type: string
imagePullPolicy:
description: PullPolicy describes a policy for if/when to pull a container
image
type: string
listener:
properties:
Expand Down
2 changes: 1 addition & 1 deletion controllers/authorino_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func newFullAuthorinoInstance() *api.Authorino {
Spec: api.AuthorinoSpec{
Image: image,
Replicas: &replicas,
ImagePullPolicy: string(k8score.PullAlways),
ImagePullPolicy: k8score.PullAlways,
Volumes: api.VolumesSpec{
Items: []api.VolumeSpec{
{
Expand Down
6 changes: 3 additions & 3 deletions pkg/resources/k8s_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ func GetDeployment(name, namespace, saName string, replicas *int32, containers [
}
}

func GetContainer(image, imagePullPolicy, containerName string, args []string, envVars []k8score.EnvVar, volMounts []k8score.VolumeMount) k8score.Container {
func GetContainer(image string, imagePullPolicy k8score.PullPolicy, containerName string, args []string, envVars []k8score.EnvVar, volMounts []k8score.VolumeMount) k8score.Container {
if imagePullPolicy == "" {
imagePullPolicy = "Always"
imagePullPolicy = k8score.PullAlways
}
c := k8score.Container{
Image: image,
ImagePullPolicy: k8score.PullPolicy(imagePullPolicy),
ImagePullPolicy: imagePullPolicy,
Name: containerName,
Env: envVars,
VolumeMounts: volMounts,
Expand Down

0 comments on commit c2e167d

Please sign in to comment.