Skip to content

Commit

Permalink
Merge pull request #5 from topfreegames/fix/rename-jwt-roles-to-auth-…
Browse files Browse the repository at this point in the history
…roles

fix: rename jwt kind to auth role
  • Loading branch information
YannickZ authored Nov 4, 2022
2 parents d0b0e8d + 6f50b82 commit 3b535f6
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 133 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- Define your resource spec under `apis/<GROUP>/<KIND>_types.go`
- `make generate`
- Proper define the `Observe`, `Create`, `Update`, `Delete` methods in `internal/controller/<KIND>/<KIND>.go`
- Add your resource controller in the `Setup` method [here](.internal/controller/vault.go).
- Add your resource controller in the `Setup` method [here](internal/controller/vault.go).


### Testing locally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ package v1alpha1
import (
"reflect"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
)

// JwtParameters are the configurable fields of a Jwt Auth Backend Role.
type JwtParameters struct {
// RoleParameters are the configurable fields of Auth Role
type RoleParameters struct {

// The namespace to provision the resource in. The value should not contain
// leading or trailing forward slashes. The namespace is always relative to
Expand Down Expand Up @@ -175,57 +174,57 @@ type JwtParameters struct {
TokenType *string `json:"tokenType,omitempty"`
}

// JwtObservation are the observable fields of a Jwt.
type JwtObservation struct {
// RoleObservation are the observable fields of a Role.
type RoleObservation struct {
ObservableField string `json:"observableField,omitempty"`
}

// A JwtSpec defines the desired state of a Jwt.
type JwtSpec struct {
// A RoleSpec defines the desired state of a Role.
type RoleSpec struct {
xpv1.ResourceSpec `json:",inline"`
ForProvider JwtParameters `json:"forProvider"`
ForProvider RoleParameters `json:"forProvider"`
}

// A JwtStatus represents the observed state of a Jwt.
type JwtStatus struct {
// A RoleStatus represents the observed state of a Role.
type RoleStatus struct {
xpv1.ResourceStatus `json:",inline"`
AtProvider JwtObservation `json:"atProvider,omitempty"`
AtProvider RoleObservation `json:"atProvider,omitempty"`
}

// +kubebuilder:object:root=true

// A Jwt is an example API type.
// A Role is an example API type.
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,vault}
type Jwt struct {
type Role struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec JwtSpec `json:"spec"`
Status JwtStatus `json:"status,omitempty"`
Spec RoleSpec `json:"spec"`
Status RoleStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// JwtList contains a list of Jwt
type JwtList struct {
// RoleList contains a list of Role
type RoleList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Jwt `json:"items"`
Items []Role `json:"items"`
}

// Jwt type metadata.
// Role type metadata.
var (
JwtKind = reflect.TypeOf(Jwt{}).Name()
JwtGroupKind = schema.GroupKind{Group: Group, Kind: JwtKind}.String()
JwtKindAPIVersion = JwtKind + "." + SchemeGroupVersion.String()
JwtGroupVersionKind = SchemeGroupVersion.WithKind(JwtKind)
RoleKind = reflect.TypeOf(Role{}).Name()
RoleGroupKind = schema.GroupKind{Group: Group, Kind: RoleKind}.String()
RoleKindAPIVersion = RoleKind + "." + SchemeGroupVersion.String()
RoleGroupVersionKind = SchemeGroupVersion.WithKind(RoleKind)
)

func init() {
SchemeBuilder.Register(&Jwt{}, &JwtList{})
SchemeBuilder.Register(&Role{}, &RoleList{})
}
54 changes: 27 additions & 27 deletions apis/auth/v1alpha1/zz_generated.deepcopy.go

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

48 changes: 24 additions & 24 deletions apis/auth/v1alpha1/zz_generated.managed.go

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

4 changes: 2 additions & 2 deletions apis/auth/v1alpha1/zz_generated.managedlist.go

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

2 changes: 1 addition & 1 deletion examples/auth/jwt_role.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: auth.vault.crossplane.io/v1alpha1
kind: Jwt
kind: Role
metadata:
name: test0
spec:
Expand Down
Loading

0 comments on commit 3b535f6

Please sign in to comment.