Skip to content

Fix (#2644) - Add json tags to InfrastructureRole struct #2659

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

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

hemakshis
Copy link
Contributor

Use json instead of name tags.

@FxKu
Copy link
Member

FxKu commented Jun 11, 2024

May I ask you to rebase your branch to resolve the conflict and also test this with configuring via configmap?

@hemakshis
Copy link
Contributor Author

hemakshis commented Jun 11, 2024

I have used both -

  infrastructure_roles_secret_name: postgresql-infrastructure-roles-oncall
  infrastructure_roles_secrets:
    - secretname: "postgresql-infrastructure-roles"
      userkey: "username"
      passwordkey: "password"
      rolekey: "roles"
apiVersion: v1
data:
  username: YmF0bWFu
  password: anVzdGljZQ==
  roles: cGdfcmVhZF9hbGxfZGF0YQ==
kind: Secret
metadata:
  name: postgresql-infrastructure-roles
  namespace: postgres-operator
type: Opaque
---
apiVersion: v1
data:
  ironman: bWFydmVs
kind: Secret
metadata:
  name: postgresql-infrastructure-roles-oncall
  namespace: postgres-operator
type: Opaque
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: postgresql-infrastructure-roles-oncall
  namespace: postgres-operator
data:
  ironman: |
    inrole: [pg_write_all_data]
    user_flags:
      - login
      - superuser
---

And both got created.

@FxKu
Copy link
Member

FxKu commented Jun 11, 2024

I mean configuring the operator with a configmap and put this setting in there:

infrastructure_roles_secrets: secretname:postgresql-infrastructure-roles,userkey:username,passwordkey:password,rolekey:roles

And in the deployment this configmap needs to be referenced. Can you test this? Then we are good to go. Maybe you did and I've only misunderstood you.

@hemakshis
Copy link
Contributor Author

hemakshis commented Jun 11, 2024

With the configmap approach, it is always trying to look for the secret in the default namespace -

ConfigMap values -

  infrastructure_roles_secret_name: postgresql-infrastructure-roles-oncall
  infrastructure_roles_secrets: "secretname:postgres-operator.postgresql-infrastructure-roles,userkey:username,passwordkey:password,rolekey:roles"

Logs -

time="2024-06-11T13:30:13Z" level=warning msg="could not get infrastructure roles: could not get infrastructure roles secret default/postgres-operator.postgresql-infrastructure-roles: secrets \"postgres-operator.postgresql-infrastructure-roles\" not found" pkg=controller

Edit:
If I pass values as - (use / as separator between namespace and name)

  infrastructure_roles_secret_name: postgresql-infrastructure-roles-oncall
  infrastructure_roles_secrets: "secretname:postgres-operator/postgresql-infrastructure-roles,userkey:username,passwordkey:password,rolekey:roles"

Then it is working.

@FxKu
Copy link
Member

FxKu commented Jun 12, 2024

Thanks @hemakshis for testing. LGTM then 😃

@FxKu
Copy link
Member

FxKu commented Jun 12, 2024

👍

@FxKu FxKu added this to the 1.12.1 milestone Jun 12, 2024
@FxKu FxKu added the bugfix label Jun 12, 2024
@idanovinda
Copy link
Member

👍

@FxKu FxKu merged commit 032743b into zalando:master Jun 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants