Skip to content

Commit

Permalink
Stop recording annotations set to false
Browse files Browse the repository at this point in the history
False is the assumed value, and inspect and podman generate kube are
being cluttered with a ton of annotations that indicate nothing.

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Dec 19, 2022
1 parent fb967aa commit 80de850
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 37 deletions.
5 changes: 0 additions & 5 deletions docs/source/markdown/podman-container-inspect.1.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,6 @@ $ podman container inspect foobar
"Annotations": {
"io.container.manager": "libpod",
"io.kubernetes.cri-o.Created": "2021-09-16T06:09:08.936623325-04:00",
"io.kubernetes.cri-o.TTY": "false",
"io.podman.annotations.autoremove": "FALSE",
"io.podman.annotations.init": "FALSE",
"io.podman.annotations.privileged": "FALSE",
"io.podman.annotations.publish-all": "FALSE",
"org.opencontainers.image.stopSignal": "15"
},
"StopSignal": 15,
Expand Down
2 changes: 0 additions & 2 deletions pkg/specgen/generate/namespaces_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ func specConfigureNamespaces(s *specgen.SpecGenerator, g *generate.Generator, rt
}
if s.PublishExposedPorts {
g.Config.Annotations[define.InspectAnnotationPublishAll] = define.InspectResponseTrue
} else {
g.Config.Annotations[define.InspectAnnotationPublishAll] = define.InspectResponseFalse
}

return nil
Expand Down
6 changes: 0 additions & 6 deletions pkg/specgen/generate/oci_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt

if s.Remove {
configSpec.Annotations[define.InspectAnnotationAutoremove] = define.InspectResponseTrue
} else {
configSpec.Annotations[define.InspectAnnotationAutoremove] = define.InspectResponseFalse
}

if len(s.VolumesFrom) > 0 {
Expand All @@ -73,14 +71,10 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt

if s.Privileged {
configSpec.Annotations[define.InspectAnnotationPrivileged] = define.InspectResponseTrue
} else {
configSpec.Annotations[define.InspectAnnotationPrivileged] = define.InspectResponseFalse
}

if s.Init {
configSpec.Annotations[define.InspectAnnotationInit] = define.InspectResponseTrue
} else {
configSpec.Annotations[define.InspectAnnotationInit] = define.InspectResponseFalse
}

if s.OOMScoreAdj != nil {
Expand Down
6 changes: 0 additions & 6 deletions pkg/specgen/generate/oci_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt

if s.Remove {
configSpec.Annotations[define.InspectAnnotationAutoremove] = define.InspectResponseTrue
} else {
configSpec.Annotations[define.InspectAnnotationAutoremove] = define.InspectResponseFalse
}

if len(s.VolumesFrom) > 0 {
Expand All @@ -296,14 +294,10 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt

if s.Privileged {
configSpec.Annotations[define.InspectAnnotationPrivileged] = define.InspectResponseTrue
} else {
configSpec.Annotations[define.InspectAnnotationPrivileged] = define.InspectResponseFalse
}

if s.Init {
configSpec.Annotations[define.InspectAnnotationInit] = define.InspectResponseTrue
} else {
configSpec.Annotations[define.InspectAnnotationInit] = define.InspectResponseFalse
}

if s.OOMScoreAdj != nil {
Expand Down
1 change: 0 additions & 1 deletion pkg/specgenutil/specgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions
annotations := make(map[string]string)

// First, add our default annotations
annotations[ann.TTY] = "false"
if c.TTY {
annotations[ann.TTY] = "true"
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ var _ = Describe("Podman run", func() {
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(conData[0]).To(HaveField("Path", "ls"))
Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "FALSE"))
Expect(conData[0].Config.Annotations).To(Not(HaveKey("io.podman.annotations.init")))
})

forbidGetCWDSeccompProfile := func() string {
Expand Down
16 changes: 0 additions & 16 deletions test/system/710-kube.bats
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ json.dump(yaml.safe_load(sys.stdin), sys.stdout)'
apiVersion | = | v1
kind | = | Pod
metadata.annotations.\"io.kubernetes.cri-o.TTY/$cname\" | = | false
metadata.annotations.\"io.podman.annotations.autoremove/$cname\" | = | FALSE
metadata.annotations.\"io.podman.annotations.init/$cname\" | = | FALSE
metadata.annotations.\"io.podman.annotations.privileged/$cname\" | = | FALSE
metadata.annotations.\"io.podman.annotations.publish-all/$cname\" | = | FALSE
metadata.creationTimestamp | =~ | [0-9T:-]\\+Z
metadata.labels.app | = | ${cname}-pod
metadata.name | = | ${cname}-pod
Expand Down Expand Up @@ -111,16 +105,6 @@ metadata.annotations.\"io.kubernetes.cri-o.ContainerType/$cname1\" | = | contai
metadata.annotations.\"io.kubernetes.cri-o.ContainerType/$cname2\" | = | container
metadata.annotations.\"io.kubernetes.cri-o.SandboxID/$cname1\" | =~ | [0-9a-f]\\{56\\}
metadata.annotations.\"io.kubernetes.cri-o.SandboxID/$cname2\" | =~ | [0-9a-f]\\{56\\}
metadata.annotations.\"io.kubernetes.cri-o.TTY/$cname1\" | = | false
metadata.annotations.\"io.kubernetes.cri-o.TTY/$cname2\" | = | false
metadata.annotations.\"io.podman.annotations.autoremove/$cname1\" | = | FALSE
metadata.annotations.\"io.podman.annotations.autoremove/$cname2\" | = | FALSE
metadata.annotations.\"io.podman.annotations.init/$cname1\" | = | FALSE
metadata.annotations.\"io.podman.annotations.init/$cname2\" | = | FALSE
metadata.annotations.\"io.podman.annotations.privileged/$cname1\" | = | FALSE
metadata.annotations.\"io.podman.annotations.privileged/$cname2\" | = | FALSE
metadata.annotations.\"io.podman.annotations.publish-all/$cname1\" | = | FALSE
metadata.annotations.\"io.podman.annotations.publish-all/$cname2\" | = | FALSE
metadata.creationTimestamp | =~ | [0-9T:-]\\+Z
metadata.labels.app | = | ${pname}
Expand Down

0 comments on commit 80de850

Please sign in to comment.