diff --git a/Tiltfile b/Tiltfile index c4b3a7d8..7f2d2c66 100644 --- a/Tiltfile +++ b/Tiltfile @@ -1,11 +1,33 @@ -local_resource( - 'compile smee', - 'make cmd/smee/smee-linux-amd64' +local_resource('compile smee', + cmd='make cmd/smee/smee-linux-amd64', + deps=["go.mod", "go.sum", "internal", "Dockerfile", "cmd/smee/main.go", "cmd/smee/flag.go", "cmd/smee/backend.go"] ) docker_build( 'quay.io/tinkerbell/smee', '.', dockerfile='Dockerfile', - only=['.'] ) -k8s_yaml(kustomize('./manifests/kustomize/overlays/kind')) +#k8s_yaml(kustomize('./manifests/kustomize/overlays/k3d')) +default_registry('ttl.sh/meohmy-dghentld') + +trusted_proxies = os.getenv('trusted_proxies', '') +lb_ip = os.getenv('LB_IP', '192.168.2.114') +stack_version = os.getenv('STACK_CHART_VERSION', '0.5.0') +layer2_interface = os.getenv('LAYER2_INTERFACE', 'eth1') + +load('ext://helm_resource', 'helm_resource') +helm_resource('stack', + chart='oci://ghcr.io/tinkerbell/charts/stack', + namespace='tink', + image_deps=['quay.io/tinkerbell/smee'], + image_keys=[('smee.image')], + flags=[ + '--create-namespace', + '--version=%s' % stack_version, + '--set=global.trustedProxies={%s}' % trusted_proxies, + '--set=global.publicIP=%s' % lb_ip, + '--set=stack.kubevip.interface=%s' % layer2_interface, + '--set=stack.relay.sourceInterface=%s' % layer2_interface, + ], + release_name='tink-stack' +) diff --git a/internal/iso/iso.go b/internal/iso/iso.go index 8b286a5c..b695165e 100644 --- a/internal/iso/iso.go +++ b/internal/iso/iso.go @@ -122,7 +122,7 @@ func (h *Handler) RoundTrip(req *http.Request) (*http.Response, error) { return nil, err } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusPartialContent { - log.Info("the request to get the source ISO returned a status other than ok (200)", "sourceIso", h.SourceISO, "status", resp.Status) + log.Info("the request to get the source ISO returned a status other than ok (200) or partial content (206)", "sourceIso", h.SourceISO, "status", resp.Status) return resp, nil } // by setting this header we are telling the logging middleware to not log its default log message. diff --git a/manifests/kind/config.yaml b/manifests/kind/config.yaml deleted file mode 100644 index d1811f0a..00000000 --- a/manifests/kind/config.yaml +++ /dev/null @@ -1,21 +0,0 @@ -kind: Cluster -apiVersion: kind.x-k8s.io/v1alpha4 -nodes: - - role: control-plane - extraPortMappings: - - containerPort: 67 - hostPort: 6767 - listenAddress: "0.0.0.0" - protocol: udp - - containerPort: 69 - hostPort: 69 - listenAddress: "0.0.0.0" - protocol: udp - - containerPort: 514 - hostPort: 514 - listenAddress: "0.0.0.0" - protocol: udp - - containerPort: 80 - hostPort: 80 - listenAddress: "0.0.0.0" - protocol: tcp diff --git a/manifests/kustomize/base/deployment.yaml b/manifests/kustomize/base/deployment.yaml deleted file mode 100644 index 92e0e762..00000000 --- a/manifests/kustomize/base/deployment.yaml +++ /dev/null @@ -1,65 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: tinkerbell-smee - name: smee-deployment - namespace: tink-system -spec: - selector: - matchLabels: - app: tinkerbell-smee - strategy: - type: Recreate - template: - metadata: - labels: - app: tinkerbell-smee - spec: - containers: - - args: ["-log-level", "debug", "-dhcp-addr", "0.0.0.0:67"] - env: - - name: SMEE_EXTRA_KERNEL_ARGS - value: "tink_worker_image=quay.io/tinkerbell/tink-worker:latest" - - name: DATA_MODEL_VERSION - value: "kubernetes" - - name: FACILITY_CODE - value: "lab1" - - name: HTTP_BIND - value: ":80" - - name: MIRROR_BASE_URL - value: http://192.168.2.59:8080 - - name: PUBLIC_IP - value: 192.168.2.59 - - name: PUBLIC_SYSLOG_FQDN - value: 192.168.2.59 - - name: SYSLOG_BIND - value: 0.0.0.0:514 - - name: TINKERBELL_GRPC_AUTHORITY - value: 192.168.2.59:42113 - - name: TINKERBELL_TLS - value: "false" - image: smee:latest - imagePullPolicy: IfNotPresent - name: tinkerbell-smee - ports: - - name: dhcp - containerPort: 67 - protocol: UDP - - name: tftp - containerPort: 69 - protocol: UDP - - name: syslog - containerPort: 514 - protocol: UDP - - name: http - containerPort: 80 - protocol: TCP - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - serviceAccountName: tinkerbell-smee diff --git a/manifests/kustomize/base/kustomization.yaml b/manifests/kustomize/base/kustomization.yaml deleted file mode 100644 index 1c61210a..00000000 --- a/manifests/kustomize/base/kustomization.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -namespace: tink-system - -images: - - name: quay.io/tinkerbell/smee - newTag: latest -resources: - - github.com/tinkerbell/tink/config/crd?ref=main - - namespace.yaml - - rbac.yaml - - deployment.yaml diff --git a/manifests/kustomize/base/namespace.yaml b/manifests/kustomize/base/namespace.yaml deleted file mode 100644 index 34cfce72..00000000 --- a/manifests/kustomize/base/namespace.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: tink-system diff --git a/manifests/kustomize/base/rbac.yaml b/manifests/kustomize/base/rbac.yaml deleted file mode 100644 index bf38f6be..00000000 --- a/manifests/kustomize/base/rbac.yaml +++ /dev/null @@ -1,46 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: tinkerbell-smee - namespace: tink-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: tinkerbell-smee-role - namespace: tink-system -rules: - - apiGroups: - - tinkerbell.org - resources: - - hardware - - hardware/status - verbs: - - get - - list - - watch - - apiGroups: - - tinkerbell.org - resources: - - workflows - - workflows/status - verbs: - - get - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: tinkerbell-smee-role - namespace: tink-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: tinkerbell-smee-role -subjects: - - kind: ServiceAccount - name: tinkerbell-smee - namespace: tink-system ---- - diff --git a/manifests/kustomize/overlays/dev/ingress.yaml b/manifests/kustomize/overlays/dev/ingress.yaml deleted file mode 100644 index e20bf7c4..00000000 --- a/manifests/kustomize/overlays/dev/ingress.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: smee-ingress - namespace: tinkerbell -spec: - ingressClassName: nginx - rules: - - http: - paths: - - pathType: Prefix - path: "/" - backend: - service: - name: smee-svc - port: - number: 80 diff --git a/manifests/kustomize/overlays/dev/kustomization.yaml b/manifests/kustomize/overlays/dev/kustomization.yaml deleted file mode 100644 index 730c2ace..00000000 --- a/manifests/kustomize/overlays/dev/kustomization.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -namespace: tink-system - -resources: - - ./../../base - - service.yaml - - github.com/kubernetes/ingress-nginx/deploy/static/provider/cloud?ref=controller-v1.2.0 - - ingress.yaml diff --git a/manifests/kustomize/overlays/dev/service.yaml b/manifests/kustomize/overlays/dev/service.yaml deleted file mode 100644 index 199a1f04..00000000 --- a/manifests/kustomize/overlays/dev/service.yaml +++ /dev/null @@ -1,26 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - app: tinkerbell-smee - name: smee-svc - namespace: tinkerbell -spec: - ports: - - name: dhcp - port: 67 - protocol: UDP - targetPort: dhcp - - name: tftp - port: 69 - protocol: UDP - targetPort: tftp - - name: syslog - port: 514 - protocol: UDP - targetPort: syslog - - name: http - port: 80 - targetPort: http - selector: - app: tinkerbell-smee diff --git a/manifests/kustomize/overlays/k3d/deployment_patch.yaml b/manifests/kustomize/overlays/k3d/deployment_patch.yaml deleted file mode 100644 index 17dcb9fa..00000000 --- a/manifests/kustomize/overlays/k3d/deployment_patch.yaml +++ /dev/null @@ -1,3 +0,0 @@ -- op: add - path: /spec/template/spec/hostNetwork - value: true diff --git a/manifests/kustomize/overlays/k3d/kustomization.yaml b/manifests/kustomize/overlays/k3d/kustomization.yaml deleted file mode 100644 index 56f2d3ee..00000000 --- a/manifests/kustomize/overlays/k3d/kustomization.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -namespace: tink-system - -resources: - - ./../../base - -patches: - - path: deployment_patch.yaml - target: - kind: Deployment - labelSelector: "app=tinkerbell-smee" diff --git a/manifests/kustomize/overlays/kind/deployment_patch.yaml b/manifests/kustomize/overlays/kind/deployment_patch.yaml deleted file mode 100644 index b7312e08..00000000 --- a/manifests/kustomize/overlays/kind/deployment_patch.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# name: dhcp -- op: add - path: /spec/template/spec/containers/0/ports/0/hostPort - value: 67 -# name: tftp -- op: add - path: /spec/template/spec/containers/0/ports/1/hostPort - value: 69 -# name: syslog -- op: add - path: /spec/template/spec/containers/0/ports/2/hostPort - value: 514 -# name: http -- op: add - path: /spec/template/spec/containers/0/ports/3/hostPort - value: 80 diff --git a/manifests/kustomize/overlays/kind/kustomization.yaml b/manifests/kustomize/overlays/kind/kustomization.yaml deleted file mode 100644 index 56f2d3ee..00000000 --- a/manifests/kustomize/overlays/kind/kustomization.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -namespace: tink-system - -resources: - - ./../../base - -patches: - - path: deployment_patch.yaml - target: - kind: Deployment - labelSelector: "app=tinkerbell-smee"