-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rename PolicyBinding API form `v1alpha1` to `v1beta1` Signed-off-by: pjuarezd <[email protected]> * Update pkg/apis/sts.min.io/v1beta1/doc.go * Update pkg/apis/sts.min.io/v1beta1/register.go * Update pkg/apis/sts.min.io/v1beta1/types.go Co-authored-by: Shubhendu <[email protected]> --------- Signed-off-by: pjuarezd <[email protected]> Co-authored-by: Shubhendu <[email protected]>
- Loading branch information
Showing
42 changed files
with
1,845 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/kustomization/sts-example/sample-data/mc-job-policy-binding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
apiVersion: sts.min.io/v1alpha1 | ||
apiVersion: sts.min.io/v1beta1 | ||
kind: PolicyBinding | ||
metadata: | ||
name: binding-1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (C) 2024, MinIO, Inc. | ||
// | ||
// This code is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License, version 3, | ||
// as published by the Free Software Foundation. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License, version 3, | ||
// along with this program. If not, see <http://www.gnu.org/licenses/> | ||
|
||
// +k8s:deepcopy-gen=package,register | ||
// go:generate controller-gen crd:trivialVersions=true paths=. output:dir=. | ||
|
||
// Package v1beta1 - The following parameters are specific to the `sts.min.io/vv1beta1` MinIO Policy Binding CRD API | ||
// PolicyBinding is an Authorization mechanism managed by the Minio Operator. | ||
// Using Kubernetes ServiceAccount JSON Web Tokens the binding allow a ServiceAccount to assume temporary IAM credentials. | ||
// For more complete documentation on this object, see the https://docs.min.io/minio/k8s/reference/minio-operator-reference.html#minio-operator-yaml-reference[MinIO Kubernetes Documentation]. | ||
// PolicyBinding is added as part of the MinIO Operator v5.0.0. + | ||
// +groupName=sts.min.io | ||
// +versionName=v1beta1 | ||
package v1beta1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (C) 2024, MinIO, Inc. | ||
// | ||
// This code is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License, version 3, | ||
// as published by the Free Software Foundation. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License, version 3, | ||
// along with this program. If not, see <http://www.gnu.org/licenses/> | ||
|
||
package v1beta1 | ||
|
||
import ( | ||
operator "github.com/minio/operator/pkg/apis/sts.min.io" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
// Version specifies the API Version | ||
const Version = "v1beta1" | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
var SchemeGroupVersion = schema.GroupVersion{Group: operator.GroupName, Version: Version} | ||
|
||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind | ||
func Kind(kind string) schema.GroupKind { | ||
return SchemeGroupVersion.WithKind(kind).GroupKind() | ||
} | ||
|
||
// Resource takes an unqualified resource and returns a Group qualified GroupResource | ||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} | ||
|
||
var ( | ||
// SchemeBuilder collects the scheme builder functions for the MinIO | ||
// Operator API. | ||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) | ||
|
||
// AddToScheme applies the SchemeBuilder functions to a specified scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) | ||
|
||
// Adds the list of known types to Scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&PolicyBinding{}, | ||
&PolicyBindingList{}, | ||
) | ||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// Copyright (C) 2024, MinIO, Inc. | ||
// | ||
// This code is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License, version 3, | ||
// as published by the Free Software Foundation. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License, version 3, | ||
// along with this program. If not, see <http://www.gnu.org/licenses/> | ||
|
||
package v1beta1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +genclient | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +k8s:defaulter-gen=true | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:resource:scope=Namespaced,shortName=policybinding,singular=policybinding | ||
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.currentState" | ||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" | ||
// +kubebuilder:metadata:annotations=operator.min.io/version=v5.0.15 | ||
// +kubebuilder:storageversion | ||
// +groupName=policybinding.sts.min.io | ||
// +versionName=v1beta1 | ||
|
||
// PolicyBinding is a https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/[Kubernetes object] describing a MinIO PolicyBinding. | ||
type PolicyBinding struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// *Required* + | ||
// | ||
// The root field for the MinIO PolicyBinding object. | ||
Spec PolicyBindingSpec `json:"spec,omitempty"` | ||
|
||
// Status provides details of the state of the PolicyBinding | ||
// +optional | ||
Status PolicyBindingStatus `json:"status,omitempty"` | ||
} | ||
|
||
// PolicyBindingStatus is the status for a PolicyBinding resource | ||
type PolicyBindingStatus struct { | ||
// *Required* + | ||
CurrentState string `json:"currentState"` | ||
|
||
// Keeps track of the invocations related to the PolicyBinding | ||
// +nullable | ||
Usage PolicyBindingUsage `json:"usage"` | ||
} | ||
|
||
// PolicyBindingUsage are metrics regarding the usage of the policyBinding | ||
type PolicyBindingUsage struct { | ||
Authorizations int64 `json:"authotizations,omitempty"` | ||
} | ||
|
||
// PolicyBindingSpec (`spec`) defines the configuration of a MinIO PolicyBinding object. + | ||
type PolicyBindingSpec struct { | ||
// *Required* + | ||
// | ||
// The Application Property identifies the namespace and service account that will be authorized | ||
Application *Application `json:"application"` | ||
// *Required* + | ||
Policies []string `json:"policies"` | ||
} | ||
|
||
// Application defines the `Namespace` and `ServiceAccount` to authorize the usage of the policies listed | ||
type Application struct { | ||
// *Required* + | ||
Namespace string `json:"namespace"` | ||
// *Required* + | ||
ServiceAccount string `json:"serviceaccount"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +kubebuilder:object:root=true | ||
|
||
// PolicyBindingList is a list of PolicyBinding resources | ||
type PolicyBindingList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
Items []PolicyBinding `json:"items"` | ||
} |
Oops, something went wrong.