-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
At present, when provisioning in a cluster, it blocks a long time waiting for OpenStack to do what it needs to do. This has a knock on effect for UX in that said delay is visible in the UI and CLI tools. This lays down the groundwork to make this asychronous so we don't hold up uer interaction, but we do cluster provisioning. This is a template also for phyiscal network provisioning that takes even longer, and causes request timeouts that need to be avoided.
- Loading branch information
Showing
22 changed files
with
427 additions
and
4 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
30 changes: 30 additions & 0 deletions
30
charts/region/templates/identity-controller/clusterrole.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: unikorn-identity-controller | ||
labels: | ||
{{- include "unikorn.labels" . | nindent 4 }} | ||
rules: | ||
# Orchestrate Unikorn resources (my job). | ||
- apiGroups: | ||
- region.unikorn-cloud.org | ||
resources: | ||
- identities | ||
verbs: | ||
- list | ||
- watch | ||
- patch | ||
- update | ||
- apiGroups: | ||
- region.unikorn-cloud.org | ||
resources: | ||
- identities/status | ||
verbs: | ||
- update | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- secrets | ||
verbs: | ||
- list | ||
- watch |
14 changes: 14 additions & 0 deletions
14
charts/region/templates/identity-controller/clusterrolebinding.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: unikorn-identity-controller | ||
labels: | ||
{{- include "unikorn.labels" . | nindent 4 }} | ||
subjects: | ||
- kind: ServiceAccount | ||
namespace: {{ .Release.Namespace }} | ||
name: unikorn-identity-controller | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: unikorn-identity-controller |
38 changes: 38 additions & 0 deletions
38
charts/region/templates/identity-controller/deployment.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: unikorn-identity-controller | ||
labels: | ||
{{- include "unikorn.labels" . | nindent 4 }} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: unikorn-identity-controller | ||
template: | ||
metadata: | ||
labels: | ||
app: unikorn-identity-controller | ||
spec: | ||
containers: | ||
- name: unikorn-identity-controller | ||
image: {{ include "unikorn.identityControllerImage" . }} | ||
ports: | ||
- name: http | ||
containerPort: 6080 | ||
- name: prometheus | ||
containerPort: 8080 | ||
- name: pprof | ||
containerPort: 6060 | ||
resources: | ||
requests: | ||
cpu: "50m" | ||
memory: 50Mi | ||
limits: | ||
cpu: "100m" | ||
memory: 100Mi | ||
securityContext: | ||
readOnlyRootFilesystem: true | ||
serviceAccountName: unikorn-identity-controller | ||
securityContext: | ||
runAsNonRoot: true |
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,23 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: unikorn-identity-controller | ||
labels: | ||
{{- include "unikorn.labels" . | nindent 4 }} | ||
rules: | ||
# Controller prerequisites. | ||
- apiGroups: | ||
- coordination.k8s.io | ||
resources: | ||
- leases | ||
verbs: | ||
- create | ||
- get | ||
- update | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- events | ||
verbs: | ||
- create | ||
- update |
14 changes: 14 additions & 0 deletions
14
charts/region/templates/identity-controller/rolebinding.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: unikorn-identity-controller | ||
labels: | ||
{{- include "unikorn.labels" . | nindent 4 }} | ||
subjects: | ||
- kind: ServiceAccount | ||
namespace: {{ .Release.Namespace }} | ||
name: unikorn-identity-controller | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: unikorn-identity-controller |
10 changes: 10 additions & 0 deletions
10
charts/region/templates/identity-controller/serviceaccount.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: unikorn-identity-controller | ||
labels: | ||
{{- include "unikorn.labels" . | nindent 4 }} | ||
{{- with ( include "unikorn.imagePullSecrets" . ) }} | ||
imagePullSecrets: | ||
{{ . }} | ||
{{- end }} |
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,27 @@ | ||
/* | ||
Copyright 2022-2024 EscherCloud. | ||
Copyright 2024 the Unikorn Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/unikorn-cloud/core/pkg/manager" | ||
"github.com/unikorn-cloud/region/pkg/managers/identity" | ||
) | ||
|
||
func main() { | ||
manager.Run(&identity.Factory{}) | ||
} |
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,2 @@ | ||
* | ||
!bin/*-linux-gnu/unikorn-identity-controller |
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,8 @@ | ||
FROM gcr.io/distroless/static:nonroot | ||
|
||
# This is implcitly created by 'docker buildx build' | ||
ARG TARGETARCH | ||
|
||
COPY bin/${TARGETARCH}-linux-gnu/unikorn-identity-controller / | ||
|
||
ENTRYPOINT ["/unikorn-identity-controller"] |
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,3 +1,2 @@ | ||
* | ||
!bin/*-linux-gnu/unikorn-region-controller | ||
!hack/passwd.nonroot |
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,48 @@ | ||
/* | ||
Copyright 2024 the Unikorn Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
unikornv1core "github.com/unikorn-cloud/core/pkg/apis/unikorn/v1alpha1" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/labels" | ||
) | ||
|
||
// Paused implements the ReconcilePauser interface. | ||
func (c *Identity) Paused() bool { | ||
return c.Spec.Pause | ||
} | ||
|
||
// StatusConditionRead scans the status conditions for an existing condition whose type | ||
// matches. | ||
func (c *Identity) StatusConditionRead(t unikornv1core.ConditionType) (*unikornv1core.Condition, error) { | ||
return unikornv1core.GetCondition(c.Status.Conditions, t) | ||
} | ||
|
||
// StatusConditionWrite either adds or updates a condition in the cluster manager status. | ||
// If the condition, status and message match an existing condition the update is | ||
// ignored. | ||
func (c *Identity) StatusConditionWrite(t unikornv1core.ConditionType, status corev1.ConditionStatus, reason unikornv1core.ConditionReason, message string) { | ||
unikornv1core.UpdateCondition(&c.Status.Conditions, t, status, reason, message) | ||
} | ||
|
||
// ResourceLabels generates a set of labels to uniquely identify the resource | ||
// if it were to be placed in a single global namespace. | ||
func (c *Identity) ResourceLabels() (labels.Set, error) { | ||
return nil, nil | ||
} |
Oops, something went wrong.