summaryrefslogtreecommitdiff
path: root/pkg/domain
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-07-11 15:13:49 +0000
committerGitHub <noreply@github.com>2022-07-11 15:13:49 +0000
commit810cbf1fb9411f75868b82c1071937374e9d57e4 (patch)
tree1860bb310b7e53e3a755cc6628ae0f9304f9d647 /pkg/domain
parentea2c31c98893c6e9e907bf3661d4456c886575bd (diff)
parent81a19a568f6234be47882b1c2b066a637749fd39 (diff)
downloadpodman-810cbf1fb9411f75868b82c1071937374e9d57e4.tar.gz
podman-810cbf1fb9411f75868b82c1071937374e9d57e4.tar.bz2
podman-810cbf1fb9411f75868b82c1071937374e9d57e4.zip
Merge pull request #14181 from umohnani8/kube-hostname
Add ports and hostname correctly in kube yaml
Diffstat (limited to 'pkg/domain')
-rw-r--r--pkg/domain/infra/abi/generate.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/generate.go b/pkg/domain/infra/abi/generate.go
index 5c1047b74..31885ce54 100644
--- a/pkg/domain/infra/abi/generate.go
+++ b/pkg/domain/infra/abi/generate.go
@@ -50,6 +50,7 @@ func (ic *ContainerEngine) GenerateKube(ctx context.Context, nameOrIDs []string,
content [][]byte
)
+ defaultKubeNS := true
// Lookup for podman objects.
for _, nameOrID := range nameOrIDs {
// Let's assume it's a container, so get the container.
@@ -75,6 +76,17 @@ func (ic *ContainerEngine) GenerateKube(ctx context.Context, nameOrIDs []string,
return nil, err
}
} else {
+ // Get the pod config to see if the user has modified the default
+ // namespace sharing values as this might affect the pods when run
+ // in a k8s cluster
+ podConfig, err := pod.Config()
+ if err != nil {
+ return nil, err
+ }
+ if !(podConfig.UsePodIPC && podConfig.UsePodNet && podConfig.UsePodUTS) {
+ defaultKubeNS = false
+ }
+
pods = append(pods, pod)
continue
}
@@ -94,6 +106,15 @@ func (ic *ContainerEngine) GenerateKube(ctx context.Context, nameOrIDs []string,
return nil, fmt.Errorf("name or ID %q not found", nameOrID)
}
+ if !defaultKubeNS {
+ warning := `
+# NOTE: The namespace sharing for a pod has been modified by the user and is not the same as the
+# default settings for kubernetes. This can lead to unexpected behavior when running the generated
+# kube yaml in a kubernetes cluster.
+`
+ content = append(content, []byte(warning))
+ }
+
// Generate kube persistent volume claims from volumes.
if len(vols) >= 1 {
pvs, err := getKubePVCs(vols)