diff --git a/internal/adapter/converter/job.go b/internal/adapter/converter/job.go index 494f54f..b4ce213 100644 --- a/internal/adapter/converter/job.go +++ b/internal/adapter/converter/job.go @@ -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 diff --git a/internal/adapter/filters/filters.go b/internal/adapter/filters/filters.go index 43af0f7..2e07f68 100644 --- a/internal/adapter/filters/filters.go +++ b/internal/adapter/filters/filters.go @@ -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 } diff --git a/internal/adapter/job.go b/internal/adapter/job.go index 73fee92..5ad258d 100644 --- a/internal/adapter/job.go +++ b/internal/adapter/job.go @@ -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) @@ -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"] @@ -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{}