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

Configurable Allocation API Port #419

Merged
merged 28 commits into from
Oct 10, 2022
Merged

Configurable Allocation API Port #419

merged 28 commits into from
Oct 10, 2022

Conversation

nottagg
Copy link
Contributor

@nottagg nottagg commented Sep 27, 2022

fixes #379

Did not get this in time for the hackathon so I'll have to settle with it being my first real OSS PR instead. Never worked with Go or K8s so if there's some unclean code, I can adjust it as needed.

Changes:

  • Allocation API port is now configurable within the makefile as LISTENING_PORT (still defaulted to 5000)
  • e2e tests also require the e2e/kind-config.yaml to adjust the first container/hostport to match

Kustomize is moving away from env variables (see - kubernetes-sigs/kustomize#3485 ) and there was an issue with kustomize removing double quotes when replacing variables in the yaml. The workaround in this PR is sending the env variable as both a string and integer (9eae5ff). It might be worth exploring revamping the kustomization.yaml files in the future.

@ghost
Copy link

ghost commented Sep 27, 2022

CLA assistant check
All CLA requirements met.

@nottagg
Copy link
Contributor Author

nottagg commented Sep 27, 2022

Closes #392
I also upped the version of kustomize as it made things a lot faster (and while I was trying to trouble shoot the double quote issue). After looking over #392 this PR should close it as I pushed up the new installfiles

@dgkanatsios
Copy link
Collaborator

@nottagg thanks for the PR and sorry we haven't yet taken a look at it. Promise that I'll do it soon, thanks for understanding!

@dgkanatsios dgkanatsios self-requested a review October 2, 2022 20:57
@dgkanatsios
Copy link
Collaborator

dgkanatsios commented Oct 2, 2022

@nottagg apologies again for the delay. I really am not a fan of injecting both the integer and the string form of the port, have spent all day trying to find an alternative.
FWIW, the problem is not with kustomize env variables, we are not using them. What we use is envsubst to replace the env values in the YAML files. envsubst (or the shell? not 100% sure about that) unfortunately replaces the entire "${ENV_NAME}" removing the double quotes. Will continue looking for an alternative. At the same, we can always replace the value 5000 with a port that does not collide with any known apps. Thanks again, appreciate the hard work in this!

@dgkanatsios
Copy link
Collaborator

Now that I think about it though, an alternative solution would be NOT to define the port in the Makefile. We can do something like that on the pkg/operator/config/manager/manager.yaml file:

# rest of YAML file...
 - name: ALLOC_API_SVC_PORT
    value: "5000"
  - name: TLS_SECRET_NAMESPACE
    valueFrom:
      fieldRef:
        fieldPath: metadata.namespace
name: manager
securityContext:
  allowPrivilegeEscalation: false
livenessProbe:
  httpGet:
    path: /healthz
    port: 8081
  initialDelaySeconds: 15
  periodSeconds: 20
readinessProbe:
  httpGet:
    path: /readyz
    port: 8081
  initialDelaySeconds: 5
  periodSeconds: 10
resources:
  requests:
    cpu: 100m
    memory: 500Mi
  limits:
    cpu: 1000m
    memory: 500Mi
ports:
  - containerPort: 5000
    hostPort: 5000
# rest of YAML file...

People that use the port 5000 can manually change it on this file. Agreed, it's more cumbersome than customizing directly but I think it partially solves the problem. Can we do it this way? Left some more comments as well. Thanks again!

pkg/operator/main.go Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Copy link
Collaborator

@dgkanatsios dgkanatsios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you have any questions, thanks!

@nottagg
Copy link
Contributor Author

nottagg commented Oct 3, 2022

Hi Dimitris. No problem with the delay! I'm just happy to be a part of a OSS project I thoroughly enjoy. Thanks for all of the feedback!

@dgkanatsios
Copy link
Collaborator

thank you!

@dgkanatsios
Copy link
Collaborator

dgkanatsios commented Oct 7, 2022

ping @nottagg, we'd like to push 0.6 next week and we'd love to include your changes!

@dgkanatsios
Copy link
Collaborator

hey @nottagg, thanks again for working on this! Let me know when it's ready to review again

Copy link
Collaborator

@dgkanatsios dgkanatsios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@dgkanatsios dgkanatsios merged commit d215d8e into PlayFab:main Oct 10, 2022
@dgkanatsios
Copy link
Collaborator

thanks @nottagg!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macos port 5000 already in use by Airplay Receiver
2 participants