Skip to content

Commit

Permalink
chore: expose file server in deployment manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
rquitales committed Sep 20, 2024
1 parent d6aba98 commit d1dd21c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion operator/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func main() {
// startProgramFileServer starts a simple file server to serve Program objects as compressed tarballs. This allows
// children pods with restricted permissions to access the Program objects, without needing read permissions granted.
func startProgramFileServer(programHandler *pulumi.ProgramHandler, address string) {
setupLog.Info("starting file server to serve Program objects", "address", programHandler.Address())
setupLog.Info("starting file server to serve Program objects", "address", address, "advertisedAddress", programHandler.Address())
mux := http.NewServeMux()
mux.Handle("/programs/", programHandler.HandleProgramServing())
err := http.ListenAndServe(address, mux)
Expand Down
1 change: 0 additions & 1 deletion operator/config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ kind: Kustomization
images:
- name: controller
newName: pulumi/pulumi-kubernetes-operator-v2
newTag: latest
resources:
- manager.yaml
27 changes: 27 additions & 0 deletions operator/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,19 @@ spec:
containers:
- command:
- /manager
env:
- name: RUNTIME_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
args:
- --leader-elect
- --health-probe-bind-address=:8081
- --program-fs-adv-addr=pulumi-kubernetes-operator.$(RUNTIME_NAMESPACE).svc.cluster.local
ports:
- containerPort: 9090
name: http-fileserver
protocol: TCP
image: controller:latest
imagePullPolicy: IfNotPresent
name: manager
Expand Down Expand Up @@ -63,3 +73,20 @@ spec:
memory: 64Mi
serviceAccountName: controller-manager
terminationGracePeriodSeconds: 60
---
# Service is required to expose the file server for workspace pods to fetch Program objects.
apiVersion: v1
kind: Service
metadata:
name: pulumi-kubernetes-operator
labels:
control-plane: controller-manager
spec:
type: ClusterIP
selector:
control-plane: controller-manager
ports:
- name: http-fileserver
port: 80
protocol: TCP
targetPort: http-fileserver
2 changes: 0 additions & 2 deletions operator/internal/controller/pulumi/program_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ func (p *ProgramHandler) HandleProgramServing() http.HandlerFunc {
w.Header().Set("Content-Type", "application/x-tar")
w.Header().Set("Content-Disposition", "attachment; filename=project.tar")
w.Write([]byte(out))
w.WriteHeader(http.StatusOK)

}
}

Expand Down

0 comments on commit d1dd21c

Please sign in to comment.