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

[JUJU-4151] - Fix/lp 2025960 #15877

Merged
merged 3 commits into from
Jul 10, 2023
Merged

[JUJU-4151] - Fix/lp 2025960 #15877

merged 3 commits into from
Jul 10, 2023

Conversation

ycliuhw
Copy link
Member

@ycliuhw ycliuhw commented Jul 7, 2023

This PR adds secret support for the k8s controller model.

Checklist

  • Code style: imports ordered, good names, simple structure, etc
  • Comments saying why design decisions were made
  • Go unit tests, with comments saying what you're testing
  • Integration tests, with comments saying what you're testing
  • doc.go added or updated in changed packages

QA steps

juju switch k1:controller
k1 (controller) -> k1:admin/controller

juju exec --unit controller/0 -- secret-add foo=bar
secret://a38b6cd2-b37d-4766-890d-acc62e414139/cijsiv6ffbas7adlb97g

juju exec --unit controller/0 -- secret-add foo=bar
secret://a38b6cd2-b37d-4766-890d-acc62e414139/cijsj0mffbas7adlb98g

juju exec --unit controller/0 -- secret-get cijsj0mffbas7adlb98g
foo: bar

juju exec --unit controller/0 -- secret-get cijsiv6ffbas7adlb97g
foo: bar

juju add-model t1
Added 't1' model on microk8s/localhost with credential 'microk8s' for user 'admin'

juju deploy snappass-test
Located charm "snappass-test" in charm-hub, revision 9
Deploying "snappass-test" from charm-hub charm "snappass-test", revision 9 in channel stable on ubuntu@20.04/stable

juju exec --unit snappass-test/0 -- secret-add foo=bar
secret://8d6b9148-8ed7-4461-89d8-c549fbdadc7f/cijsjbuffbas7adlb990

juju exec --unit snappass-test/0 -- secret-add foo=bar
secret://8d6b9148-8ed7-4461-89d8-c549fbdadc7f/cijsjcmffbas7adlb99g

juju exec --unit snappass-test/0 -- secret-get cijsjbuffbas7adlb990
foo: bar

juju exec --unit snappass-test/0 -- secret-get cijsjcmffbas7adlb99g
foo: bar

Documentation changes

No

Bug reference

https://bugs.launchpad.net/juju/+bug/2025960

@ycliuhw ycliuhw changed the title Fix/lp 2025960 [JUJU-4151] - Fix/lp 2025960 Jul 7, 2023
@ycliuhw ycliuhw requested a review from wallyworld July 7, 2023 08:27
@hpidcock
Copy link
Member

hpidcock commented Jul 9, 2023

----------------------------------------------------------------------
FAIL: rbac_test.go:264: rbacSuite.TestEnsureSecretAccessTokeControllerModelUpdate

[LOG] 0:00.002 DEBUG juju.kubernetes.provider updating service account "unit-gitlab-0"
rbac_test.go:337:
    token, err := s.broker.EnsureSecretAccessToken(tag, nil, nil, nil)
/home/jenkins/go/pkg/mod/github.com/golang/mock@v1.6.0/gomock/controller.go:183:
    h.t.Fatalf(format, args...)
... Error: Unexpected call to *mocks.MockClusterRoleInterface.Get([context.TODO controller-k1-unit-gitlab-0 {{ } }]) at /home/jenkins/go/src/github.com/juju/juju/caas/kubernetes/provider/rbac.go:438 because: 
expected call at /home/jenkins/go/src/github.com/juju/juju/caas/kubernetes/provider/rbac_test.go:326 doesn't match the argument at index 1.
Got: controller-k1-unit-gitlab-0 (string)
Want: is equal to unit-gitlab-0 (string)

rbac_test.go:337:
    token, err := s.broker.EnsureSecretAccessToken(tag, nil, nil, nil)
/home/jenkins/go/pkg/mod/github.com/golang/mock@v1.6.0/gomock/controller.go:180:
    h.t.Errorf(format, args...)
... Error: missing call(s) to *mocks.MockClusterRoleInterface.Get(is anything, is equal to unit-gitlab-0 (string), is equal to {{ } } (v1.GetOptions)) /home/jenkins/go/src/github.com/juju/juju/caas/kubernetes/provider/rbac_test.go:326

rbac_test.go:337:
    token, err := s.broker.EnsureSecretAccessToken(tag, nil, nil, nil)
/home/jenkins/go/pkg/mod/github.com/golang/mock@v1.6.0/gomock/controller.go:180:
    h.t.Errorf(format, args...)
... Error: missing call(s) to *mocks.MockClusterRoleBindingInterface.Get(is anything, is equal to controller-k1-unit-gitlab-0 (string), is equal to {{ } } (v1.GetOptions)) /home/jenkins/go/src/github.com/juju/juju/caas/kubernetes/provider/rbac_test.go:328

rbac_test.go:337:
    token, err := s.broker.EnsureSecretAccessToken(tag, nil, nil, nil)
/home/jenkins/go/pkg/mod/github.com/golang/mock@v1.6.0/gomock/controller.go:180:
    h.t.Errorf(format, args...)
... Error: missing call(s) to *mocks.MockServiceAccountInterface.CreateToken(is anything, is equal to unit-gitlab-0 (string), is equal to &TokenRequest{ObjectMeta:{      0 0001-01-01 00:00:00 +0000 UTC <nil> <nil> map[] map[] [] []  []},Spec:TokenRequestSpec{Audiences:[],BoundObjectRef:nil,ExpirationSeconds:*600,},Status:TokenRequestStatus{Token:,ExpirationTimestamp:0001-01-01 00:00:00 +0000 UTC,},} (*v1.TokenRequest), is equal to {{ } []  } (v1.CreateOptions)) /home/jenkins/go/src/github.com/juju/juju/caas/kubernetes/provider/rbac_test.go:332

rbac_test.go:337:
    token, err := s.broker.EnsureSecretAccessToken(tag, nil, nil, nil)
/home/jenkins/go/pkg/mod/github.com/golang/mock@v1.6.0/gomock/controller.go:180:
    h.t.Errorf(format, args...)
... Error: missing call(s) to *mocks.MockClusterRoleBindingInterface.Patch(is anything, is equal to unit-gitlab-0 (string), is equal to application/strategic-merge-patch+json (types.PatchType), is anything, is equal to {{ } [] <nil> juju } (v1.PatchOptions)) /home/jenkins/go/src/github.com/juju/juju/caas/kubernetes/provider/rbac_test.go:329

rbac_test.go:337:
    token, err := s.broker.EnsureSecretAccessToken(tag, nil, nil, nil)
/home/jenkins/go/pkg/mod/github.com/golang/mock@v1.6.0/gomock/controller.go:180:
    h.t.Errorf(format, args...)
... Error: missing call(s) to *mocks.MockClusterRoleInterface.Update(is anything, is equal to &ClusterRole{ObjectMeta:{controller-k1-unit-gitlab-0  controller-k1    0 0001-01-01 00:00:00 +0000 UTC <nil> <nil> map[app.kubernetes.io/managed-by:juju app.kubernetes.io/name:gitlab] map[] [] []  []},Rules:[]PolicyRule{PolicyRule{Verbs:[create patch],APIGroups:[*],Resources:[secrets],ResourceNames:[],NonResourceURLs:[],},PolicyRule{Verbs:[get list],APIGroups:[*],Resources:[namespaces],ResourceNames:[],NonResourceURLs:[],},},AggregationRule:nil,} (*v1.ClusterRole), is equal to {{ } []  } (v1.UpdateOptions)) /home/jenkins/go/src/github.com/juju/juju/caas/kubernetes/provider/rbac_test.go:327

rbac_test.go:337:
    token, err := s.broker.EnsureSecretAccessToken(tag, nil, nil, nil)
/home/jenkins/go/pkg/mod/github.com/golang/mock@v1.6.0/gomock/controller.go:183:
    h.t.Fatalf(format, args...)
... Error: aborting test due to missing call(s)


----------------------------------------------------------------------

Copy link
Member

@wallyworld wallyworld left a comment

Choose a reason for hiding this comment

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

Thank you. Just needs a little clean up.

caas/kubernetes/provider/rbac.go Outdated Show resolved Hide resolved
caas/kubernetes/provider/rbac.go Outdated Show resolved Hide resolved
@ycliuhw
Copy link
Member Author

ycliuhw commented Jul 10, 2023

/build

@ycliuhw
Copy link
Member Author

ycliuhw commented Jul 10, 2023

/merge

@jujubot jujubot merged commit cbc0e38 into juju:3.1 Jul 10, 2023
21 of 22 checks passed
@barrettj12 barrettj12 mentioned this pull request Jul 10, 2023
jujubot added a commit that referenced this pull request Jul 10, 2023
#15893

Merges the following patches:
- #15888
- #15877
- #15887
- #15879
- #15880

### Conflicts
None.
@barrettj12 barrettj12 mentioned this pull request Jul 10, 2023
jujubot added a commit that referenced this pull request Jul 11, 2023
@hpidcock hpidcock mentioned this pull request Jul 11, 2023
jujubot added a commit that referenced this pull request Jul 11, 2023
#15896

Forward ports:
- #15845
- #15725
- #15852
- #15854
- #15849
- #15855
- #15857
- #15861
- #15862
- #15860
- #15864
- #15825
- #15866
- #15863
- #15870
- #15871
- #15872
- #15873
- #15874
- #15876
- #15875
- #15881
- #15727
- #15883
- #15884
- #15880
- #15879
- #15886
- #15887
- #15877
- #15888
- #15893
- #15894

Conflicts:
- cmd/juju/ssh/debugcode_test.go
- cmd/juju/ssh/debughooks_test.go
- cmd/juju/ssh/scp_unix_test.go
- cmd/juju/ssh/ssh_machine.go
- cmd/juju/ssh/ssh_machine_test.go
- cmd/juju/ssh/ssh_unix_test.go
- worker/dbaccessor/worker.go
- caas/kubernetes/provider/k8s_test.go
- caas/kubernetes/provider/operator_test.go
- caas/kubernetes/provider/package_test.go
- caas/kubernetes/provider/rbac.go
- cmd/juju/application/deployer/bundlehandler.go
- cmd/juju/application/deployer/bundlehandler_test.go
- cmd/jujud/agent/model/manifolds.go
- core/bundle/changes/changes.go
- worker/caasapplicationprovisioner/application.go
- worker/caasapplicationprovisioner/application_test.go
- worker/caasapplicationprovisioner/mock_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants