Skip to content
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

feat : add Lifecycle to AppSpec #11

Merged
merged 3 commits into from
May 28, 2024
Merged

Conversation

ekgns33
Copy link
Contributor

@ekgns33 ekgns33 commented May 15, 2024

작업내역

✅ : AppSpec에 라이프사이클 관련 구조체 추가
✅ : UpsertDeployment에 Appspec의 추가된 내용 반영 코드 작성

Screenshot 2024-05-15 at 11 12 44 PM

추가된 내용

  • Optional 옵션을 위해서 json tag에 omitempty를 추가, // +optional추가

@ekgns33 ekgns33 self-assigned this May 15, 2024
@ekgns33 ekgns33 linked an issue May 15, 2024 that may be closed by this pull request
Comment on lines +17 to +23
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]
preStop:
exec:
command: ["/bin/sh","-c","nginx -s quit; while killall -0 nginx; do sleep 1; done"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lifecycle 추가 안하고 돌렸을때는 문제 없이 돌아가나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppSpec에 추가된 상태에서 위 lifecycle에 명시된 내용이 없는 경우를 말씀하시는 걸까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make install의 경우 지우고 실행해도 이전 yaml로 돌아가는 것 같아보이네요 😢
그런데 kubectl apply -f config/samples/app_v1alpha1_application.yaml로 실행하면 명시된 필드가 비어있다고 실행되지 않습니다.

@@ -31,6 +31,7 @@ type AppSpec struct {
AppType string `json:"appType,omitempty"` // back, front-spa, front-srr
Annotations map[string]string `json:"annotations,omitempty"`
ContainerName string `json:"containerName"`
LifeCycle *v1.Lifecycle `json:"lifeCycle"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LifeCycle *v1.Lifecycle `json:"lifeCycle"`
// +optional
LifeCycle *v1.Lifecycle `json:"lifeCycle,omitempty"`

@tae2089 tae2089 merged commit 5c40abd into dev May 28, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

how to control pod lifecycle
2 participants