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

Use shorter DNS name for pod-to-pod networking #764

Merged
merged 3 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CHANGELOG
- Stack Controller: watch for delete events. [#756](https://github.com/pulumi/pulumi-kubernetes-operator/pull/756)
- Stack Controller: fix an issue where new commits weren't detected when using git sources. https://github.com/pulumi/pulumi-kubernetes-operator/issues/762
- Ensure cleanup of Stack in foreground deletion. [#760](https://github.com/pulumi/pulumi-kubernetes-operator/pull/760)
- Use shorter DNS name for pod-to-pod networking. [#764](https://github.com/pulumi/pulumi-kubernetes-operator/pull/764)

## 2.0.0-beta.2 (2024-11-11)

Expand Down
11 changes: 11 additions & 0 deletions deploy/helm/pulumi-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,14 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the advertised address for the controller
*/}}
{{- define "pulumi-kubernetes-operator.advertisedAddress" -}}
{{- if .Values.controller.advertisedAddress }}
{{- .Values.controller.advertisedAddress }}
{{- else }}
{{- include "pulumi-kubernetes-operator.fullname" . }}.$(POD_NAMESPACE)
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion deploy/helm/pulumi-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
- --leader-elect
- --health-probe-bind-address=:8081
- --metrics-bind-address=:8383
- --program-fs-adv-addr=pulumi-kubernetes-operator.$(POD_NAMESPACE).svc.cluster.local:80
- --program-fs-adv-addr={{ include "pulumi-kubernetes-operator.advertisedAddress" . }}:80
- --zap-log-level={{ .Values.controller.logLevel }}
- --zap-time-encoding=iso8601
env:
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/pulumi-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ imagePullSecrets: ""
controller:
# -- Log Level ('debug', 'info', 'error', or any integer value > 0 which corresponds to custom debug levels of increasing verbosity)
logLevel: error
# -- the advertised address for the controller's service
# advertisedAddress: "pulumi-kubernetes-operator.pulumi-kubernetes-operator.svc.cluster.local"

# -- Extra Environments to be passed to the operator
extraEnv: []
Expand Down
2 changes: 1 addition & 1 deletion deploy/yaml/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28579,7 +28579,7 @@ spec:
- --metrics-bind-address=:8443
- --leader-elect
- --health-probe-bind-address=:8081
- --program-fs-adv-addr=pulumi-kubernetes-operator.$(POD_NAMESPACE).svc.cluster.local:80
- --program-fs-adv-addr=pulumi-kubernetes-operator.$(POD_NAMESPACE):80
- --zap-log-level=info
- --zap-time-encoding=iso8601
env:
Expand Down
4 changes: 4 additions & 0 deletions operator/cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ func TestDetermineAdvAddr(t *testing.T) {
addr: "0.0.0.0:9090",
want: fakehostname + ":9090",
},
{
addr: "fake.default:9090",
want: "fake.default:9090",
},
{
addr: "fake.default.svc.cluster.local:9090",
want: "fake.default.svc.cluster.local:9090",
Expand Down
2 changes: 1 addition & 1 deletion operator/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
- /manager
- --leader-elect
- --health-probe-bind-address=:8081
- --program-fs-adv-addr=pulumi-kubernetes-operator.$(POD_NAMESPACE).svc.cluster.local:80
- --program-fs-adv-addr=pulumi-kubernetes-operator.$(POD_NAMESPACE):80
- --zap-log-level=info
- --zap-time-encoding=iso8601
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ spec:
image: pulumi/pulumi:3.134.1-nonroot
securityProfile: restricted
serviceAccountName: default

# git:
# url: https://github.com/pulumi/examples.git
# revision: 1e2fc471709448f3c9f7a250f28f1eafcde7017b
# dir: random-yaml
flux:
url: http://source-controller.flux-system.svc.cluster.local./gitrepository/default/pulumi-examples/1e2fc471709448f3c9f7a250f28f1eafcde7017b.tar.gz
digest: sha256:6560311e95689086aa195a82c0310080adc31bea2457936ce528a014d811407a
git:
url: https://github.com/pulumi/examples.git
revision: 1e2fc471709448f3c9f7a250f28f1eafcde7017b
dir: random-yaml
env:
- name: PULUMI_ACCESS_TOKEN
Expand Down
41 changes: 41 additions & 0 deletions operator/examples/program/stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: random-yaml-program
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: random-yaml-program:system:auth-delegator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:auth-delegator
subjects:
- kind: ServiceAccount
name: random-yaml-program
namespace: default
---
apiVersion: pulumi.com/v1
kind: Stack
metadata:
name: random-yaml-program
namespace: default
spec:
serviceAccountName: random-yaml-program
programRef:
name: random-yaml
stack: random-yaml-program
refresh: true
destroyOnFinalize: true
envRefs:
PULUMI_ACCESS_TOKEN:
type: Secret
secret:
name: pulumi-api-secret
key: accessToken
workspaceTemplate:
spec:
image: pulumi/pulumi:3.134.1-nonroot

7 changes: 0 additions & 7 deletions operator/examples/random-yaml/update-.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion operator/internal/controller/auto/workspace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func nameForService(w *autov1alpha1.Workspace) string {
}

func fqdnForService(w *autov1alpha1.Workspace) string {
return fmt.Sprintf("%s.%s.svc.cluster.local", nameForService(w), w.Namespace)
return fmt.Sprintf("%s.%s", nameForService(w), w.Namespace)
}

func labelsForStatefulSet(w *autov1alpha1.Workspace) map[string]string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var _ = Describe("Program Controller", func() {
BeforeEach(func() {
ctx = context.Background()

advertisedAddress = "http://fake-svc.fake-namespace.svc.cluster.local"
advertisedAddress = "http://fake-svc.fake-namespace"

r = &ProgramReconciler{
Client: k8sClient,
Expand Down