Last active
July 3, 2018 14:13
-
-
Save DazWilkin/ba3f94f54a066509ea10ca5b997f68f5 to your computer and use it in GitHub Desktop.
Kubernetes Deployment Dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| name: second | |
| labels: | |
| app: simple-config | |
| component: second | |
| spec: | |
| restartPolicy: Never | |
| initContainers: | |
| - name: wait | |
| image: alpine | |
| imagePullPolicy: Always | |
| command: | |
| - ash | |
| - -c | |
| - | | |
| apk --no-cache add curl | |
| # Endpoint to check | |
| ENDPOINT="http://$(SIMPLE_CONFIG_NAME):$(SIMPLE_CONFIG_PORT)/?variable=$(SIMPLE_CONFIG_PATH)" | |
| echo Checking: ${ENDPOINT} | |
| while [[ $(curl --silent --output /dev/null --request GET --write-out "%{http_code}" ${ENDPOINT}) -ne 200 ]]; do | |
| echo "Not ready" | |
| sleep 5s | |
| done | |
| echo Ready | |
| env: | |
| - name: SIMPLE_CONFIG_NAME | |
| value: simple-config | |
| - name: SIMPLE_CONFIG_PORT | |
| value: "9999" | |
| - name: SIMPLE_CONFIG_PATH | |
| # Matches the metadata.name of the test Pod | |
| value: first/container | |
| containers: | |
| - name: container | |
| image: busybox | |
| imagePullPolicy: Always | |
| args: | |
| - wget | |
| - --quiet | |
| - --output-document=- | |
| - --post-data={"variable":"$(SIMPLE_CONFIG_PATH)/dependent"} | |
| - http://$(SIMPLE_CONFIG_NAME):$(SIMPLE_CONFIG_PORT) | |
| env: | |
| - name: SIMPLE_CONFIG_NAME | |
| value: simple-config | |
| - name: SIMPLE_CONFIG_PORT | |
| value: "9999" | |
| - name: SIMPLE_CONFIG_PATH | |
| valueFrom: | |
| fieldRef: | |
| fieldPath: metadata.name | |
| ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment