Skip to content

Commit

Permalink
Update MaskinportenClient spec
Browse files Browse the repository at this point in the history
  • Loading branch information
martinothamar committed Jun 11, 2024
1 parent 06c9b6c commit 26e7164
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 19 deletions.
16 changes: 16 additions & 0 deletions api/v1alpha1/maskinportenclient_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,28 @@ import (
type MaskinportenClientSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Scopes is a list of Maskinporten scopes that the client should have access to
Scopes []string `json:"scopes,omitempty"`
}

// MaskinportenClientStatus defines the observed state of MaskinportenClient
type MaskinportenClientStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file

// ClientId is the client id of the client posted to Maskinporten API
ClientId string `json:"clientId,omitempty"`
Authority string `json:"authority,omitempty"`
KeyIds []string `json:"keyIds,omitempty"`
// LastSynced is the timestamp of the last successful sync towards Maskinporten API
//
// +kubebuilder:validation:Format: date-time
LastSynced *metav1.Time `json:"lastSynced,omitempty"`
State string `json:"state,omitempty"`
Reason string `json:"reason,omitempty"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
LastActions []string `json:"lastActions,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
23 changes: 21 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

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

84 changes: 84 additions & 0 deletions config/crd/bases/resources.altinn.studio_maskinportenclients.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: maskinportenclients.resources.altinn.studio
spec:
group: resources.altinn.studio
names:
kind: MaskinportenClient
listKind: MaskinportenClientList
plural: maskinportenclients
singular: maskinportenclient
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: MaskinportenClient is the Schema for the maskinportenclients
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: MaskinportenClientSpec defines the desired state of MaskinportenClient
properties:
scopes:
description: Scopes is a list of Maskinporten scopes that the client
should have access to
items:
type: string
type: array
type: object
status:
description: MaskinportenClientStatus defines the observed state of MaskinportenClient
properties:
authority:
type: string
clientId:
description: ClientId is the client id of the client posted to Maskinporten
API
type: string
keyIds:
items:
type: string
type: array
lastActions:
items:
type: string
type: array
lastSynced:
description: LastSynced is the timestamp of the last successful sync
towards Maskinporten API
format: date-time
type: string
observedGeneration:
format: int64
type: integer
reason:
type: string
state:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
37 changes: 27 additions & 10 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: manager-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: altinn-k8s-operator
app.kubernetes.io/part-of: altinn-k8s-operator
app.kubernetes.io/managed-by: kustomize
name: manager-role
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
- apiGroups:
- resources.altinn.studio
resources:
- maskinportenclients
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- resources.altinn.studio
resources:
- maskinportenclients/finalizers
verbs:
- update
- apiGroups:
- resources.altinn.studio
resources:
- maskinportenclients/status
verbs:
- get
- patch
- update
11 changes: 4 additions & 7 deletions config/samples/resources_v1alpha1_maskinportenclient.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ apiVersion: resources.altinn.studio/v1alpha1
kind: MaskinportenClient
metadata:
labels:
app.kubernetes.io/name: maskinportenclient
app.kubernetes.io/instance: maskinportenclient-sample
app.kubernetes.io/part-of: altinn-k8s-operator
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: altinn-k8s-operator
name: maskinportenclient-sample
app: local-testapp-deployment
name: local-testapp
spec:
# TODO(user): Add fields here
appId: 'testapp'
scopes: ['test-scope']

0 comments on commit 26e7164

Please sign in to comment.