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

Makefile: fix kwok installation #3561

Merged
merged 1 commit into from
Dec 22, 2023
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ ovn-ic-0.yaml
ovn-ic-1.yaml
kind.yaml
kustomization.yaml
kwok.yaml
kwok-node.yaml
broker-info.subm
broker-info.subm.*
Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -854,11 +854,14 @@ kind-install-deepflow: kind-install
echo -e "\nGrafana URL: http://127.0.0.1:$(DEEPFLOW_GRAFANA_PORT)\nGrafana auth: admin:deepflow\n"

.PHONY: kind-install-kwok
kind-install-kwok: kind-install-underlay
kwok_version=$(KWOK_VERSION) j2 yamls/kwok-kustomization.yaml.j2 -o kustomization.yaml
kubectl kustomize ./ > kwok.yaml
kind-install-kwok:
kubectl label node --overwrite -l type!=kwok type=kind
kubectl -n kube-system patch ds kube-proxy -p '{"spec":{"template":{"spec":{"nodeSelector":{"type":"kind"}}}}}'
kubectl -n kube-system patch ds ovs-ovn -p '{"spec":{"template":{"spec":{"nodeSelector":{"type":"kind"}}}}}'
kubectl -n kube-system patch ds kube-ovn-cni -p '{"spec":{"template":{"spec":{"nodeSelector":{"type":"kind"}}}}}'
$(call kind_load_kwok_image,kube-ovn)
kubectl apply -f kwok.yaml
kubectl apply -f yamls/kwok.yaml
kubectl apply -f yamls/kwok-stage.yaml
kubectl -n kube-system rollout status deploy kwok-controller --timeout 60s
for i in {1..20}; do \
kwok_node_name=fake-node-$$i j2 yamls/kwok-node.yaml.j2 -o kwok-node.yaml; \
Expand Down Expand Up @@ -962,7 +965,7 @@ clean:
$(RM) yamls/clab-bgp.yaml yamls/clab-bgp-ha.yaml
$(RM) ovn.yaml kube-ovn.yaml kube-ovn-crd.yaml
$(RM) ovn-ic-0.yaml ovn-ic-1.yaml
$(RM) kustomization.yaml kwok.yaml kwok-node.yaml
$(RM) kwok-node.yaml
$(RM) kube-ovn.tar kube-ovn-dpdk.tar vpc-nat-gateway.tar image-amd64.tar image-amd64-dpdk.tar image-arm64.tar

.PHONY: changelog
Expand Down
7 changes: 0 additions & 7 deletions yamls/kwok-kustomization.yaml.j2

This file was deleted.

259 changes: 259 additions & 0 deletions yamls/kwok-stage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
apiVersion: kwok.x-k8s.io/v1alpha1
kind: Stage
metadata:
name: node-heartbeat-with-lease
spec:
delay:
durationMilliseconds: 600000
jitterDurationMilliseconds: 610000
next:
statusTemplate: |
{{ $now := Now }}
{{ $lastTransitionTime := or .metadata.creationTimestamp $now }}
conditions:
{{ range NodeConditions }}
- lastHeartbeatTime: {{ $now | Quote }}
lastTransitionTime: {{ $lastTransitionTime | Quote }}
message: {{ .message | Quote }}
reason: {{ .reason | Quote }}
status: {{ .status | Quote }}
type: {{ .type | Quote }}
{{ end }}

addresses:
{{ with .status.addresses }}
{{ YAML . 1 }}
{{ else }}
{{ with NodeIP }}
- address: {{ . | Quote }}
type: InternalIP
{{ end }}
{{ with NodeName }}
- address: {{ . | Quote }}
type: Hostname
{{ end }}
{{ end }}

{{ with NodePort }}
daemonEndpoints:
kubeletEndpoint:
Port: {{ . }}
{{ end }}
resourceRef:
apiGroup: v1
kind: Node
selector:
matchExpressions:
- key: .status.phase
operator: In
values:
- Running
- key: .status.conditions.[] | select( .type == "Ready" ) | .status
operator: In
values:
- "True"
---
apiVersion: kwok.x-k8s.io/v1alpha1
kind: Stage
metadata:
name: node-initialize
spec:
next:
statusTemplate: |
{{ $now := Now }}
{{ $lastTransitionTime := or .metadata.creationTimestamp $now }}
conditions:
{{ range NodeConditions }}
- lastHeartbeatTime: {{ $now | Quote }}
lastTransitionTime: {{ $lastTransitionTime | Quote }}
message: {{ .message | Quote }}
reason: {{ .reason | Quote }}
status: {{ .status | Quote }}
type: {{ .type | Quote}}
{{ end }}

addresses:
{{ with .status.addresses }}
{{ YAML . 1 }}
{{ else }}
{{ with NodeIP }}
- address: {{ . | Quote }}
type: InternalIP
{{ end }}
{{ with NodeName }}
- address: {{ . | Quote }}
type: Hostname
{{ end }}
{{ end }}

{{ with NodePort }}
daemonEndpoints:
kubeletEndpoint:
Port: {{ . }}
{{ end }}

allocatable:
{{ with .status.allocatable }}
{{ YAML . 1 }}
{{ else }}
cpu: 1k
memory: 1Ti
pods: 1M
{{ end }}
capacity:
{{ with .status.capacity }}
{{ YAML . 1 }}
{{ else }}
cpu: 1k
memory: 1Ti
pods: 1M
{{ end }}
{{ with .status.nodeInfo }}
nodeInfo:
architecture: {{ with .architecture }} {{ . }} {{ else }} "amd64" {{ end }}
bootID: {{ with .bootID }} {{ . }} {{ else }} "" {{ end }}
containerRuntimeVersion: {{ with .containerRuntimeVersion }} {{ . }} {{ else }} "kwok-{{ Version }}" {{ end }}
kernelVersion: {{ with .kernelVersion }} {{ . }} {{ else }} "kwok-{{ Version }}" {{ end }}
kubeProxyVersion: {{ with .kubeProxyVersion }} {{ . }} {{ else }} "kwok-{{ Version }}" {{ end }}
kubeletVersion: {{ with .kubeletVersion }} {{ . }} {{ else }} "kwok-{{ Version }}" {{ end }}
machineID: {{ with .machineID }} {{ . }} {{ else }} "" {{ end }}
operatingSystem: {{ with .operatingSystem }} {{ . }} {{ else }} "linux" {{ end }}
osImage: {{ with .osImage }} {{ . }} {{ else }} "" {{ end }}
systemUUID: {{ with .systemUUID }} {{ . }} {{ else }} "" {{ end }}
{{ end }}
phase: Running
resourceRef:
apiGroup: v1
kind: Node
selector:
matchExpressions:
- key: .status.conditions.[] | select( .type == "Ready" ) | .status
operator: NotIn
values:
- "True"
---
apiVersion: kwok.x-k8s.io/v1alpha1
kind: Stage
metadata:
name: pod-complete
spec:
next:
statusTemplate: |
{{ $now := Now }}
{{ $root := . }}
containerStatuses:
{{ range $index, $item := .spec.containers }}
{{ $origin := index $root.status.containerStatuses $index }}
- image: {{ $item.image | Quote }}
name: {{ $item.name | Quote }}
ready: false
restartCount: 0
started: false
state:
terminated:
exitCode: 0
finishedAt: {{ $now | Quote }}
reason: Completed
startedAt: {{ $now | Quote }}
{{ end }}
phase: Succeeded
resourceRef:
apiGroup: v1
kind: Pod
selector:
matchExpressions:
- key: .metadata.deletionTimestamp
operator: DoesNotExist
- key: .status.phase
operator: In
values:
- Running
- key: .metadata.ownerReferences.[].kind
operator: In
values:
- Job
---
apiVersion: kwok.x-k8s.io/v1alpha1
kind: Stage
metadata:
name: pod-delete
spec:
next:
delete: true
finalizers:
empty: true
resourceRef:
apiGroup: v1
kind: Pod
selector:
matchExpressions:
- key: .metadata.deletionTimestamp
operator: Exists
---
apiVersion: kwok.x-k8s.io/v1alpha1
kind: Stage
metadata:
name: pod-ready
spec:
next:
statusTemplate: |
{{ $now := Now }}

conditions:
- lastTransitionTime: {{ $now | Quote }}
status: "True"
type: Initialized
- lastTransitionTime: {{ $now | Quote }}
status: "True"
type: Ready
- lastTransitionTime: {{ $now | Quote }}
status: "True"
type: ContainersReady
{{ range .spec.readinessGates }}
- lastTransitionTime: {{ $now | Quote }}
status: "True"
type: {{ .conditionType | Quote }}
{{ end }}

containerStatuses:
{{ range .spec.containers }}
- image: {{ .image | Quote }}
name: {{ .name | Quote }}
ready: true
restartCount: 0
state:
running:
startedAt: {{ $now | Quote }}
{{ end }}

initContainerStatuses:
{{ range .spec.initContainers }}
- image: {{ .image | Quote }}
name: {{ .name | Quote }}
ready: true
restartCount: 0
state:
terminated:
exitCode: 0
finishedAt: {{ $now | Quote }}
reason: Completed
startedAt: {{ $now | Quote }}
{{ end }}

hostIP: {{ NodeIPWith .spec.nodeName | Quote }}
podIP: {{ index .metadata.annotations "ovn.kubernetes.io/ip_address" }}
phase: Running
startTime: {{ $now | Quote }}
resourceRef:
apiGroup: v1
kind: Pod
selector:
matchExpressions:
- key: .metadata.deletionTimestamp
operator: DoesNotExist
- key: .status.podIP
operator: DoesNotExist
- key: .metadata.annotations."ovn.kubernetes.io/routed"
operator: In
values:
- "true"
Loading
Loading