10000 [GEP-26] Add issuer field to workloadIdentity.status by vpnachev · Pull Request #11168 · gardener/gardener · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[GEP-26] Add issuer field to workloadIdentity.status #11168

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

Closed
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions docs/api-reference/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,18 @@ string
<p>Sub contains the computed value of the subject that is going to be set in JWTs &lsquo;sub&rsquo; claim.</p>
</td>
</tr>
<tr>
<td>
<code>issuer</code></br>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Issuer is the issuer URL of the ID token.</p>
</td>
</tr>
</tbody>
</table>
<hr/>
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/security/types_workloadidentity.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ type TargetSystem struct {
type WorkloadIdentityStatus struct {
// Sub contains the computed value of the subject that is going to be set in JWTs 'sub' claim.
Sub string
// Issuer is the issuer URL of the ID token.
Issuer *string
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
172 changes: 109 additions & 63 deletions pkg/apis/security/v1alpha1/generated.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/apis/security/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/apis/security/v1alpha1/types_workloadidentity.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ type TargetSystem struct {
type WorkloadIdentityStatus struct {
// Sub contains the computed value of the subject that is going to be set in JWTs 'sub' claim.
Sub string `json:"sub" protobuf:"bytes,1,opt,name=sub"`
// Issuer is the issuer URL of the ID token.
// +optional
Issuer *string `json:"issuer" protobuf:"bytes,2,opt,name=issuer"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/security/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pkg/apis/security/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pkg/apis/security/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions pkg/apiserver/openapi/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6D4E
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ func NewStorage(
tokenIssuer workloadidentityutils.TokenIssuer,
coreInformerFactory gardencoreinformers.SharedInformerFactory,
) WorkloadIdentityStorage {
workloadIdentityRest := NewREST(optsGetter)
var issuerURL *string
if tokenIssuer != nil {
issuerURL = new(string)
*issuerURL = tokenIssuer.Issuer()
}
workloadIdentityRest := NewREST(optsGetter, issuerURL)

return WorkloadIdentityStorage{
WorkloadIdentity: workloadIdentityRest,
Expand All @@ -42,7 +47,9 @@ func NewStorage(
}

// NewREST returns a RESTStorage object that will work against WorkloadIdentity.
func NewREST(optsGetter generic.RESTOptionsGetter) *REST {
func NewREST(optsGetter generic.RESTOptionsGetter, issuerURL *string) *REST {
strategy := workloadidentity.NewStrategy(issuerURL)

store := &genericregistry.Store{
NewFunc: func() runtime.Object { return &security.WorkloadIdentity{} },
NewListFunc: func() runtime.Object { return &security.WorkloadIdentityList{} },
Expand All @@ -51,9 +58,9 @@ func NewREST(optsGetter generic.RESTOptionsGetter) *REST {
SingularQualifiedResource: security.Resource("workloadidentity"),
EnableGarbageCollection: true,

CreateStrategy: workloadidentity.Strategy,
UpdateStrategy: workloadidentity.Strategy,
DeleteStrategy: workloadidentity.Strategy,
CreateStrategy: strategy,
UpdateStrategy: strategy,
DeleteStrategy: strategy,

TableConvertor: newTableConvertor(),
}
Expand Down
Loading
0