feat: add default-container annotation everywhere
This commit is contained in:
1 parent
cee47b4836
commit
86da40ba19
1 file changed
+15
-2
@@ -212,6 +212,9 @@ func templateKubernetesCronJob(input Job) (batchv1.CronJob, error) {
|
|||||||
}
|
}
|
||||||
annotations["dokku.com/job-suffix"] = suffix
|
annotations["dokku.com/job-suffix"] = suffix
|
||||||
|
|
||||||
|
podAnnotations := annotations
|
||||||
|
podAnnotations["kubectl.kubernetes.io/default-container"] = fmt.Sprintf("%s-%s", input.AppName, input.ProcessType)
|
||||||
|
|
||||||
job := batchv1.CronJob{
|
job := batchv1.CronJob{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: fmt.Sprintf("%s-%s-%s", input.AppName, input.ProcessType, suffix),
|
Name: fmt.Sprintf("%s-%s-%s", input.AppName, input.ProcessType, suffix),
|
||||||
@@ -236,6 +239,10 @@ func templateKubernetesCronJob(input Job) (batchv1.CronJob, error) {
|
|||||||
BackoffLimit: ptr.To(int32(0)),
|
BackoffLimit: ptr.To(int32(0)),
|
||||||
PodReplacementPolicy: ptr.To(batchv1.Failed),
|
PodReplacementPolicy: ptr.To(batchv1.Failed),
|
||||||
Template: corev1.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Labels: labels,
|
||||||
|
Annotations: podAnnotations,
|
||||||
|
},
|
||||||
Spec: corev1.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []corev1.Container{
|
Containers: []corev1.Container{
|
||||||
{
|
{
|
||||||
@@ -353,6 +360,9 @@ func templateKubernetesDeployment(input Deployment) (appsv1.Deployment, error) {
|
|||||||
}
|
}
|
||||||
secretName := fmt.Sprintf("env-%s.DEPLOYMENT_ID", input.AppName)
|
secretName := fmt.Sprintf("env-%s.DEPLOYMENT_ID", input.AppName)
|
||||||
|
|
||||||
|
podAnnotations := annotations
|
||||||
|
podAnnotations["kubectl.kubernetes.io/default-container"] = fmt.Sprintf("%s-%s", input.AppName, input.ProcessType)
|
||||||
|
|
||||||
deployment := appsv1.Deployment{
|
deployment := appsv1.Deployment{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: fmt.Sprintf("%s-%s", input.AppName, input.ProcessType),
|
Name: fmt.Sprintf("%s-%s", input.AppName, input.ProcessType),
|
||||||
@@ -369,7 +379,7 @@ func templateKubernetesDeployment(input Deployment) (appsv1.Deployment, error) {
|
|||||||
Template: corev1.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
Annotations: annotations,
|
Annotations: podAnnotations,
|
||||||
},
|
},
|
||||||
Spec: corev1.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []corev1.Container{
|
Containers: []corev1.Container{
|
||||||
@@ -646,6 +656,9 @@ func templateKubernetesJob(input Job) (batchv1.Job, error) {
|
|||||||
}
|
}
|
||||||
annotations["dokku.com/job-suffix"] = suffix
|
annotations["dokku.com/job-suffix"] = suffix
|
||||||
|
|
||||||
|
podAnnotations := annotations
|
||||||
|
podAnnotations["kubectl.kubernetes.io/default-container"] = fmt.Sprintf("%s-%s", input.AppName, input.ProcessType)
|
||||||
|
|
||||||
job := batchv1.Job{
|
job := batchv1.Job{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: fmt.Sprintf("%s-%s-%s", input.AppName, input.ProcessType, suffix),
|
Name: fmt.Sprintf("%s-%s-%s", input.AppName, input.ProcessType, suffix),
|
||||||
@@ -658,7 +671,7 @@ func templateKubernetesJob(input Job) (batchv1.Job, error) {
|
|||||||
Template: corev1.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
Annotations: annotations,
|
Annotations: podAnnotations,
|
||||||
},
|
},
|
||||||
Spec: corev1.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []corev1.Container{
|
Containers: []corev1.Container{
|
||||||
|
|||||||
Reference in new issue
Block a user