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

refactor(operator/inventory): deploy hw discovery from operator #182

Merged
merged 1 commit into from
Feb 1, 2024
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
6 changes: 1 addition & 5 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,11 @@ jobs:
- name: K8S test operator inventory GRPC ports
working-directory: ${{ env.GOPATH }}/src/github.com/akash-network/provider
run: |
__pod=$(kubectl -n akash-services get pods -l app.kubernetes.io/part-of=provider -l app.kubernetes.io/component=operator -l app.kubernetes.io/instance=inventory-node --no-headers -o custom-columns=":metadata.name")
kubectl -n akash-services port-forward --address 0.0.0.0 pod/$__pod 8454:grpc &
kubectl -n akash-services port-forward --address 0.0.0.0 service/operator-inventory 8455:grpc &

timeout 10 bash -c -- 'while ! nc -vz localhost 8454 > /dev/null 2>&1 ; do sleep 0.1; done'
timeout 10 bash -c -- 'while ! nc -vz localhost 8455 > /dev/null 2>&1 ; do sleep 0.1; done'

${{ env.GOPATH }}/src/github.com/akash-network/akash-api/script/grpc-probe.sh --host=localhost:8454 --mode=plaintext akash.inventory.v1.NodeRPC/QueryNode
${{ env.GOPATH }}/src/github.com/akash-network/akash-api/script/grpc-probe.sh --host=localhost:8455 --mode=plaintext akash.inventory.v1.ClusterRPC/QueryCluster
grpcurl -plaintext localhost:8455 akash.inventory.v1.ClusterRPC/QueryCluster
kubectl -n akash-services logs service/operator-inventory
- name: Run E2E Tests
working-directory: ${{ env.GOPATH }}/src/github.com/akash-network/provider
Expand Down
33 changes: 18 additions & 15 deletions _docs/kustomize/akash-operator-inventory/cluster-roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ rules:
resources:
- namespaces
- nodes
- pods
- events
- services
- persistentvolumes
Expand All @@ -30,6 +29,16 @@ rules:
- nodes
verbs:
- patch
- apiGroups:
- ''
resources:
- pods
verbs:
- create
- delete
- get
- list
- watch
- apiGroups:
- ''
resources:
Expand All @@ -40,6 +49,12 @@ rules:
- get
- list
- watch
- apiGroups:
- ''
resources:
- pods/proxy
verbs:
- get
- apiGroups:
- storage.k8s.io
resources:
Expand Down Expand Up @@ -75,27 +90,15 @@ rules:
- get
- list
- watch
- apiGroups:
- ''
resources:
- configmaps
verbs:
- create
- update
- patch
- delete
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: operator-inventory-node
name: operator-inventory-hardware-discovery
labels:
akash.network: "true"
app.kubernetes.io/name: inventory
app.kubernetes.io/instance: inventory-node
app.kubernetes.io/instance: inventory-hardware-discovery
app.kubernetes.io/component: operator
app.kubernetes.io/part-of: provider
rules:
Expand Down
77 changes: 0 additions & 77 deletions _docs/kustomize/akash-operator-inventory/daemonset.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions _docs/kustomize/akash-operator-inventory/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ spec:
env:
- name: AP_CONFIG
value: /akash/config.yaml
- name: AP_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: AP_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
resources:
limits:
cpu: 500m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ resources:
- cluster-roles.yaml
- role-bindings.yaml
- service.yaml
- daemonset.yaml
- deployment.yaml
configMapGenerator:
- name: operator-inventory
Expand Down
8 changes: 4 additions & 4 deletions _docs/kustomize/akash-operator-inventory/role-bindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ subjects:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: operator-inventory-node
name: operator-inventory-hardware-discovery
labels:
akash.network: "true"
app.kubernetes.io/name: inventory
app.kubernetes.io/instance: inventory-node
app.kubernetes.io/instance: inventory-hardware-discovery
app.kubernetes.io/component: operator
app.kubernetes.io/part-of: provider
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: operator-inventory-node
name: operator-inventory-hardware-discovery
subjects:
- kind: ServiceAccount
name: operator-inventory-node
name: operator-inventory-hardware-discovery
namespace: akash-services
---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ automountServiceAccountToken: true
apiVersion: v1
kind: ServiceAccount
metadata:
name: operator-inventory-node
name: operator-inventory-hardware-discovery
namespace: akash-services
labels:
akash.network: "true"
app.kubernetes.io/name: inventory
app.kubernetes.io/instance: inventory-node
app.kubernetes.io/instance: inventory-hardware-discovery
app.kubernetes.io/component: operator
app.kubernetes.io/part-of: provider
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,3 @@ patches:
group: apps
name: operator-inventory
version: v1
- path: docker-image.yaml
target:
kind: DaemonSet
group: apps
name: operator-inventory-node
version: v1
16 changes: 6 additions & 10 deletions _run/common-kube.mk
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ kube-setup-ingress-calico:

.PHONY: kube-setup-ingress-default
kube-setup-ingress-default:
kubectl label nodes $(KIND_NAME)-control-plane akash.network/role=ingress
kubectl apply -f "$(INGRESS_CONFIG_PATH)"
kubectl rollout status deployment -n ingress-nginx ingress-nginx-controller --timeout=$(KUBE_ROLLOUT_TIMEOUT)s
kubectl apply -f "$(METALLB_CONFIG_PATH)"
Expand All @@ -161,8 +160,6 @@ kube-status-ingress-%:

.PHONY: kube-deployment-rollout-operator-inventory
kube-deployment-rollout-operator-inventory:
kubectl -n akash-services rollout status daemonset operator-inventory-node --timeout=$(KUBE_ROLLOUT_TIMEOUT)s
kubectl -n akash-services wait pods -l app.kubernetes.io/part-of=provider -l app.kubernetes.io/component=operator -l app.kubernetes.io/instance=inventory-node --for condition=Ready --timeout=$(KUBE_ROLLOUT_TIMEOUT)s
kubectl -n akash-services rollout status deployment operator-inventory --timeout=$(KUBE_ROLLOUT_TIMEOUT)s
kubectl -n akash-services wait pods -l app.kubernetes.io/part-of=provider -l app.kubernetes.io/component=operator -l app.kubernetes.io/instance=inventory-service --for condition=Ready --timeout=$(KUBE_ROLLOUT_TIMEOUT)s

Expand Down Expand Up @@ -192,13 +189,12 @@ akash-node-ready:
)


.PHONY: kube-operator-inventory-logs
kube-operator-inventory-logs:
.PHONY: kube-logs-operator-inventory
kube-logs-operator-inventory:
kubectl -n akash-services logs -f \
-l app.kubernetes.io/part-of=provider,app.kubernetes.io/component=operator,app.kubernetes.io/instance=inventory-service,app.kubernetes.io/name=inventory

.PHONY: kube-operator-inventory-node-logs
kube-operator-inventory-node-logs:
kubectl -n akash-services logs -f \
-l app.kubernetes.io/part-of=provider,app.kubernetes.io/component=operator,app.kubernetes.io/instance=inventory-node,app.kubernetes.io/name=inventory

#.PHONY: kube-operator-inventory-node-logs
#kube-operator-inventory-node-logs:
# kubectl -n akash-services logs -f \
# -l app.kubernetes.io/part-of=provider,app.kubernetes.io/component=operator,app.kubernetes.io/instance=inventory-node,app.kubernetes.io/name=inventory
23 changes: 12 additions & 11 deletions _run/kind-config-calico.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
---
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
disableDefaultCNI: true
#podSubnet: 192.168.0.0/16 # Default Calico subnet
nodes:
- role: control-plane
kubeadmConfigPatches:
- kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
protocol: TCP
- containerPort: 443
protocol: TCP
- role: control-plane
kubeadmConfigPatches:
- kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
protocol: TCP
- containerPort: 443
protocol: TCP
23 changes: 12 additions & 11 deletions _run/kube/kind-config-80.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
21 changes: 11 additions & 10 deletions _run/kube/kind-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
protocol: TCP
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
protocol: TCP
1 change: 1 addition & 0 deletions cluster/kube/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const (
AkashNetworkStorageClasses = "akash.network/storageclasses"
AkashServiceTarget = "akash.network/service-target"
AkashServiceCapabilityGPU = "akash.network/capabilities.gpu"
AkashServiceCapabilityStorage = "akash.network/capabilities.storage"
AkashMetalLB = "metal-lb"
akashDeploymentPolicyName = "akash-deployment-restrictions"
akashNetworkNamespace = "akash.network/namespace"
Expand Down
Loading
Loading