Skip to content

OCPBUGS-28230: fallback to logs for termination message #3203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/controller/bundle/bundle_unpacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func (c *ConfigMapUnpacker) job(cmRef *corev1.ObjectReference, bundlePath string
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
InitContainers: []corev1.Container{
Expand All @@ -182,6 +183,7 @@ func (c *ConfigMapUnpacker) job(cmRef *corev1.ObjectReference, bundlePath string
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
{
Name: "pull",
Expand Down Expand Up @@ -210,6 +212,7 @@ func (c *ConfigMapUnpacker) job(cmRef *corev1.ObjectReference, bundlePath string
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
Volumes: []corev1.Volume{
Expand Down
18 changes: 18 additions & 0 deletions pkg/controller/bundle/bundle_unpacker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
InitContainers: []corev1.Container{
Expand All @@ -292,6 +293,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
{
Name: "pull",
Expand Down Expand Up @@ -320,6 +322,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
Volumes: []corev1.Volume{
Expand Down Expand Up @@ -498,6 +501,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
InitContainers: []corev1.Container{
Expand All @@ -523,6 +527,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
{
Name: "pull",
Expand Down Expand Up @@ -551,6 +556,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
Volumes: []corev1.Volume{
Expand Down Expand Up @@ -769,6 +775,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
InitContainers: []corev1.Container{
Expand All @@ -794,6 +801,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
{
Name: "pull",
Expand Down Expand Up @@ -822,6 +830,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
Volumes: []corev1.Volume{
Expand Down Expand Up @@ -1035,6 +1044,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
InitContainers: []corev1.Container{
Expand All @@ -1060,6 +1070,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
{
Name: "pull",
Expand Down Expand Up @@ -1088,6 +1099,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
Volumes: []corev1.Volume{
Expand Down Expand Up @@ -1270,6 +1282,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
InitContainers: []corev1.Container{
Expand All @@ -1295,6 +1308,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
{
Name: "pull",
Expand Down Expand Up @@ -1323,6 +1337,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
Volumes: []corev1.Volume{
Expand Down Expand Up @@ -1516,6 +1531,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
InitContainers: []corev1.Container{
Expand All @@ -1541,6 +1557,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
{
Name: "pull",
Expand Down Expand Up @@ -1569,6 +1586,7 @@ func TestConfigMapUnpacker(t *testing.T) {
Drop: []corev1.Capability{"ALL"},
},
},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
},
Volumes: []corev1.Volume{
Expand Down
14 changes: 8 additions & 6 deletions pkg/controller/registry/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,12 @@ func Pod(source *operatorsv1alpha1.CatalogSource, name, opmImg, utilImage, img s
MountPath: catalogPath,
}
pod.Spec.InitContainers = append(pod.Spec.InitContainers, corev1.Container{
Name: "extract-utilities",
Image: utilImage,
Command: []string{"cp"},
Args: []string{"/bin/copy-content", fmt.Sprintf("%s/copy-content", utilitiesPath)},
VolumeMounts: []corev1.VolumeMount{utilitiesVolumeMount},
Name: "extract-utilities",
Image: utilImage,
Command: []string{"cp"},
Args: []string{"/bin/copy-content", fmt.Sprintf("%s/copy-content", utilitiesPath)},
VolumeMounts: []corev1.VolumeMount{utilitiesVolumeMount},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
}, corev1.Container{
Name: "extract-content",
Image: img,
Expand All @@ -295,7 +296,8 @@ func Pod(source *operatorsv1alpha1.CatalogSource, name, opmImg, utilImage, img s
"--cache.from=" + grpcPodConfig.ExtractContent.CacheDir,
"--cache.to=" + fmt.Sprintf("%s/cache", catalogPath),
},
VolumeMounts: []corev1.VolumeMount{utilitiesVolumeMount, contentVolumeMount},
VolumeMounts: []corev1.VolumeMount{utilitiesVolumeMount, contentVolumeMount},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
})

pod.Spec.Containers[0].Image = opmImg
Expand Down
14 changes: 8 additions & 6 deletions pkg/controller/registry/reconciler/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func TestPodExtractContent(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{
GenerateName: "test-",
Namespace: "testns",
Labels: map[string]string{"olm.pod-spec-hash": "2AHzz8IDqQLwPsDyu4UjUmnROr4E59PMKm9OCm", "olm.managed": "true"},
Labels: map[string]string{"olm.pod-spec-hash": "5MSUJs07MqD3fl9supmPaRNxD9N6tK8Bjo4OFl", "olm.managed": "true"},
Annotations: map[string]string{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
},
Spec: corev1.PodSpec{
Expand All @@ -293,11 +293,12 @@ func TestPodExtractContent(t *testing.T) {
},
InitContainers: []corev1.Container{
{
Name: "extract-utilities",
Image: "utilImage",
Command: []string{"cp"},
Args: []string{"/bin/copy-content", "/utilities/copy-content"},
VolumeMounts: []corev1.VolumeMount{{Name: "utilities", MountPath: "/utilities"}},
Name: "extract-utilities",
Image: "utilImage",
Command: []string{"cp"},
Args: []string{"/bin/copy-content", "/utilities/copy-content"},
VolumeMounts: []corev1.VolumeMount{{Name: "utilities", MountPath: "/utilities"}},
TerminationMessagePolicy: "FallbackToLogsOnError",
},
{
Name: "extract-content",
Expand All @@ -314,6 +315,7 @@ func TestPodExtractContent(t *testing.T) {
{Name: "utilities", MountPath: "/utilities"},
{Name: "catalog-content", MountPath: "/extracted-catalog"},
},
TerminationMessagePolicy: "FallbackToLogsOnError",
},
},
Containers: []corev1.Container{
Expand Down
Loading