Skip to content

Instantly share code, notes, and snippets.

@lordofthejars
Created December 24, 2018 10:04
func newPodForCR(cr *hellov1alpha1.Hello) *corev1.Pod {
msg := cr.Spec.Message
labels := map[string]string{
"app": cr.Name,
}
return &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: cr.Name + "-pod",
Namespace: cr.Namespace,
Labels: labels,
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "whalesay",
Image: "docker/whalesay",
Command: []string{"cowsay", msg},
},
},
RestartPolicy: "Never",
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment