mirror of
https://github.com/lukaszraczylo/jobs-manager-operator.git
synced 2026-07-11 07:21:50 +00:00
Add annotations support.
This commit is contained in:
@@ -94,6 +94,8 @@ type ManagedJobParameters struct {
|
|||||||
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
|
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
|
||||||
// +kubebuilder:validation:Optional
|
// +kubebuilder:validation:Optional
|
||||||
Labels map[string]string `json:"labels,omitempty"`
|
Labels map[string]string `json:"labels,omitempty"`
|
||||||
|
// +kubebuilder:validation:Optional
|
||||||
|
Annotations map[string]string `json:"annotations,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ManagedJobSpec defines the desired state of ManagedJob
|
// ManagedJobSpec defines the desired state of ManagedJob
|
||||||
|
|||||||
@@ -213,6 +213,13 @@ func (in *ManagedJobParameters) DeepCopyInto(out *ManagedJobParameters) {
|
|||||||
(*out)[key] = val
|
(*out)[key] = val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if in.Annotations != nil {
|
||||||
|
in, out := &in.Annotations, &out.Annotations
|
||||||
|
*out = make(map[string]string, len(*in))
|
||||||
|
for key, val := range *in {
|
||||||
|
(*out)[key] = val
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedJobParameters.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedJobParameters.
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ type: application
|
|||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
# to the chart and its templates, including the app version.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 0.0.20
|
version: 0.0.21
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# This is the version number of the application being deployed. This version number should be
|
||||||
# incremented each time you make changes to the application. Versions are not expected to
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
# It is recommended to use it with quotes.
|
# It is recommended to use it with quotes.
|
||||||
appVersion: "0.0.20"
|
appVersion: "0.0.21"
|
||||||
keywords:
|
keywords:
|
||||||
- operator
|
- operator
|
||||||
- jobs
|
- jobs
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ spec:
|
|||||||
type: array
|
type: array
|
||||||
compiledParams:
|
compiledParams:
|
||||||
properties:
|
properties:
|
||||||
|
annotations:
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
env:
|
env:
|
||||||
items:
|
items:
|
||||||
description: EnvVar represents an environment variable
|
description: EnvVar represents an environment variable
|
||||||
@@ -2135,6 +2139,10 @@ spec:
|
|||||||
type: boolean
|
type: boolean
|
||||||
params:
|
params:
|
||||||
properties:
|
properties:
|
||||||
|
annotations:
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
env:
|
env:
|
||||||
items:
|
items:
|
||||||
description: EnvVar represents an environment variable
|
description: EnvVar represents an environment variable
|
||||||
@@ -4205,6 +4213,10 @@ spec:
|
|||||||
type: boolean
|
type: boolean
|
||||||
params:
|
params:
|
||||||
properties:
|
properties:
|
||||||
|
annotations:
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
env:
|
env:
|
||||||
items:
|
items:
|
||||||
description: EnvVar represents an environment variable present
|
description: EnvVar represents an environment variable present
|
||||||
@@ -6131,6 +6143,10 @@ spec:
|
|||||||
type: array
|
type: array
|
||||||
params:
|
params:
|
||||||
properties:
|
properties:
|
||||||
|
annotations:
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
env:
|
env:
|
||||||
items:
|
items:
|
||||||
description: EnvVar represents an environment variable present
|
description: EnvVar represents an environment variable present
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ spec:
|
|||||||
type: array
|
type: array
|
||||||
compiledParams:
|
compiledParams:
|
||||||
properties:
|
properties:
|
||||||
|
annotations:
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
env:
|
env:
|
||||||
items:
|
items:
|
||||||
description: EnvVar represents an environment variable
|
description: EnvVar represents an environment variable
|
||||||
@@ -2205,6 +2209,10 @@ spec:
|
|||||||
type: boolean
|
type: boolean
|
||||||
params:
|
params:
|
||||||
properties:
|
properties:
|
||||||
|
annotations:
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
env:
|
env:
|
||||||
items:
|
items:
|
||||||
description: EnvVar represents an environment variable
|
description: EnvVar represents an environment variable
|
||||||
@@ -4345,6 +4353,10 @@ spec:
|
|||||||
type: boolean
|
type: boolean
|
||||||
params:
|
params:
|
||||||
properties:
|
properties:
|
||||||
|
annotations:
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
env:
|
env:
|
||||||
items:
|
items:
|
||||||
description: EnvVar represents an environment variable
|
description: EnvVar represents an environment variable
|
||||||
@@ -6317,6 +6329,10 @@ spec:
|
|||||||
type: array
|
type: array
|
||||||
params:
|
params:
|
||||||
properties:
|
properties:
|
||||||
|
annotations:
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
env:
|
env:
|
||||||
items:
|
items:
|
||||||
description: EnvVar represents an environment variable present
|
description: EnvVar represents an environment variable present
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ type compiledParams struct {
|
|||||||
ImagePullSecrets []corev1.LocalObjectReference
|
ImagePullSecrets []corev1.LocalObjectReference
|
||||||
ImagePullPolicy string
|
ImagePullPolicy string
|
||||||
Labels map[string]string
|
Labels map[string]string
|
||||||
|
Annotations map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cp *connPackage) compileParameters(params ...jobsmanagerv1beta1.ManagedJobParameters) jobsmanagerv1beta1.ManagedJobParameters {
|
func (cp *connPackage) compileParameters(params ...jobsmanagerv1beta1.ManagedJobParameters) jobsmanagerv1beta1.ManagedJobParameters {
|
||||||
@@ -56,6 +57,11 @@ func (cp *connPackage) compileParameters(params ...jobsmanagerv1beta1.ManagedJob
|
|||||||
cparams.Labels[k] = v
|
cparams.Labels[k] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if params.Annotations != nil {
|
||||||
|
for k, v := range params.Annotations {
|
||||||
|
cparams.Annotations[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cparams
|
return cparams
|
||||||
@@ -242,6 +248,12 @@ func (cp *connPackage) executeJob(j *jobsmanagerv1beta1.ManagedJobDefinition, g
|
|||||||
labels[k] = v
|
labels[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
annotations := map[string]string{}
|
||||||
|
|
||||||
|
for k, v := range j.CompiledParams.Annotations {
|
||||||
|
annotations[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
job_handler := kbatch.Job{
|
job_handler := kbatch.Job{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: generatedJobName,
|
Name: generatedJobName,
|
||||||
@@ -250,9 +262,10 @@ func (cp *connPackage) executeJob(j *jobsmanagerv1beta1.ManagedJobDefinition, g
|
|||||||
Spec: kbatch.JobSpec{
|
Spec: kbatch.JobSpec{
|
||||||
Template: corev1.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: generatedJobName,
|
Name: generatedJobName,
|
||||||
Namespace: cp.mj.Namespace,
|
Namespace: cp.mj.Namespace,
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
|
Annotations: annotations,
|
||||||
},
|
},
|
||||||
Spec: corev1.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Volumes: j.CompiledParams.Volumes,
|
Volumes: j.CompiledParams.Volumes,
|
||||||
|
|||||||
Reference in New Issue
Block a user