-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for mapping APIKey manifests into secrets
- Loading branch information
Showing
32 changed files
with
1,471 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
// APIKeySpec defines the desired state of APIKey | ||
type APIKeySpec struct { | ||
// +kubebuilder:validation:Enum=admin;editor;viewer | ||
// +kubebuilder:validation:Required | ||
Role string `json:"role"` | ||
} | ||
|
||
// APIKeyStatus defines the observed state of APIKey | ||
type APIKeyStatus struct { | ||
Status string `json:"status"` | ||
Message string `json:"message"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
//+kubebuilder:resource:shortName=api-keys;apikeys;api-key;apikey;grafana-api-keys | ||
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.status` | ||
//+kubebuilder:printcolumn:name="Message",type=string,JSONPath=`.status.message` | ||
|
||
// APIKey is the Schema for the apikeys API | ||
type APIKey struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec APIKeySpec `json:"spec,omitempty"` | ||
Status APIKeyStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// APIKeyList contains a list of APIKey | ||
type APIKeyList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []APIKey `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&APIKey{}, &APIKeyList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,82 @@ | ||
|
||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.7.0 | ||
creationTimestamp: null | ||
name: apikeys.k8s.kevingomez.fr | ||
spec: | ||
group: k8s.kevingomez.fr | ||
names: | ||
kind: APIKey | ||
listKind: APIKeyList | ||
plural: apikeys | ||
shortNames: | ||
- api-keys | ||
- apikeys | ||
- api-key | ||
- apikey | ||
- grafana-api-keys | ||
singular: apikey | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .status.status | ||
name: Status | ||
type: string | ||
- jsonPath: .status.message | ||
name: Message | ||
type: string | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: APIKey is the Schema for the apikeys API | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: APIKeySpec defines the desired state of APIKey | ||
properties: | ||
role: | ||
enum: | ||
- admin | ||
- editor | ||
- viewer | ||
type: string | ||
required: | ||
- role | ||
type: object | ||
status: | ||
description: APIKeyStatus defines the observed state of APIKey | ||
properties: | ||
message: | ||
type: string | ||
status: | ||
type: string | ||
required: | ||
- message | ||
- status | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
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,7 @@ | ||
# The following patch adds a directive for certmanager to inject CA into the CRD | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) | ||
name: apikeys.k8s.kevingomez.fr |
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,16 @@ | ||
# The following patch enables a conversion webhook for the CRD | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: apikeys.k8s.kevingomez.fr | ||
spec: | ||
conversion: | ||
strategy: Webhook | ||
webhook: | ||
clientConfig: | ||
service: | ||
namespace: system | ||
name: webhook-service | ||
path: /convert | ||
conversionReviewVersions: | ||
- v1 |
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,24 @@ | ||
# permissions for end users to edit apikeys. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: apikey-editor-role | ||
rules: | ||
- apiGroups: | ||
- k8s.kevingomez.fr | ||
resources: | ||
- apikeys | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
- apiGroups: | ||
- k8s.kevingomez.fr | ||
resources: | ||
- apikeys/status | ||
verbs: | ||
- get |
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,20 @@ | ||
# permissions for end users to view apikeys. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: apikey-viewer-role | ||
rules: | ||
- apiGroups: | ||
- k8s.kevingomez.fr | ||
resources: | ||
- apikeys | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- k8s.kevingomez.fr | ||
resources: | ||
- apikeys/status | ||
verbs: | ||
- get |
Oops, something went wrong.