Skip to content

Commit

Permalink
fix: rebase refactors
Browse files Browse the repository at this point in the history
Signed-off-by: Mateusz Urbanek <mateusz.urbanek.98@gmail.com>
  • Loading branch information
shanduur committed Sep 29, 2023
1 parent e36c9ec commit b56299d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/adapter/converter/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (converter *DockerAPIConverter) UpdateJobFromContainerInfo(job *batch.Job,
job.ObjectMeta.Annotations = make(map[string]string)
}

job.ObjectMeta.Annotations["kubectl.kubernetes.io/last-applied-configuration"] = container.Labels[k2dtypes.WorkloadLastAppliedConfigLabelKey]
job.ObjectMeta.Annotations["kubectl.kubernetes.io/last-applied-configuration"] = container.Labels[k2dtypes.LastAppliedConfigLabelKey]

containerState := container.State

Expand Down
4 changes: 2 additions & 2 deletions internal/adapter/filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func AllDeployments(namespace string) filters.Args {
// // Now 'filter' can be used in Docker API calls to filter Job resources in the 'default' Kubernetes namespace.
func AllJobs(namespace string) filters.Args {
filter := filters.NewArgs()
filter.Add("label", fmt.Sprintf("%s=%s", types.WorkloadLabelKey, types.JobWorkloadType))
filter.Add("label", fmt.Sprintf("%s=%s", types.NamespaceLabelKey, namespace))
filter.Add("label", fmt.Sprintf("%s=%s", types.WorkloadTypeLabelKey, types.JobWorkloadType))
filter.Add("label", fmt.Sprintf("%s=%s", types.NamespaceNameLabelKey, namespace))
return filter
}

Expand Down
10 changes: 5 additions & 5 deletions internal/adapter/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (adapter *KubeDockerAdapter) CreateContainerFromJob(ctx context.Context, jo
opts.labels = make(map[string]string)
}

opts.labels[k2dtypes.WorkloadLabelKey] = k2dtypes.JobWorkloadType
opts.labels[k2dtypes.WorkloadTypeLabelKey] = k2dtypes.JobWorkloadType

if job.Labels["app.kubernetes.io/managed-by"] == "Helm" {
jobData, err := json.Marshal(job)
Expand All @@ -44,7 +44,7 @@ func (adapter *KubeDockerAdapter) CreateContainerFromJob(ctx context.Context, jo
if err != nil {
return fmt.Errorf("unable to marshal job: %w", err)
}
opts.labels[k2dtypes.WorkloadLastAppliedConfigLabelKey] = string(jobData)
opts.labels[k2dtypes.LastAppliedConfigLabelKey] = string(jobData)
}

opts.lastAppliedConfiguration = job.ObjectMeta.Annotations["kubectl.kubernetes.io/last-applied-configuration"]
Expand Down Expand Up @@ -127,11 +127,11 @@ func (adapter *KubeDockerAdapter) ListJobs(ctx context.Context, namespace string
}

func (adapter *KubeDockerAdapter) buildJobFromContainer(ctx context.Context, container types.Container) (*batch.Job, error) {
if container.Labels[k2dtypes.WorkloadLastAppliedConfigLabelKey] == "" {
return nil, fmt.Errorf("unable to build job, missing %s label on container %s", k2dtypes.WorkloadLastAppliedConfigLabelKey, container.Names[0])
if container.Labels[k2dtypes.LastAppliedConfigLabelKey] == "" {
return nil, fmt.Errorf("unable to build job, missing %s label on container %s", k2dtypes.LastAppliedConfigLabelKey, container.Names[0])
}

jobData := container.Labels[k2dtypes.WorkloadLastAppliedConfigLabelKey]
jobData := container.Labels[k2dtypes.LastAppliedConfigLabelKey]

versionedJob := batchv1.Job{}

Expand Down

0 comments on commit b56299d

Please sign in to comment.