Skip to content

Commit 0e2d6d1

Browse files
authored
Merge pull request #27 from microsoft/eedorenko/config-schema
Config schema
2 parents d1c024d + f954c0d commit 0e2d6d1

34 files changed

+1081
-774
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747
Publish_Helm_Chart:
4848
runs-on: ubuntu-latest
4949
needs: [Build_Push_Scheduler_Image]
50+
permissions:
51+
contents: write
5052
steps:
5153
- name: Checkout
5254
uses: actions/checkout@v2

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.19 as builder
2+
FROM golang:1.20 as builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

PROJECT

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,12 @@ resources:
100100
kind: Environment
101101
path: github.com/microsoft/kalypso-scheduler/api/v1alpha1
102102
version: v1alpha1
103+
- api:
104+
crdVersion: v1
105+
namespaced: true
106+
domain: kalypso.io
107+
group: scheduler
108+
kind: ConfigSchema
109+
path: github.com/microsoft/kalypso-scheduler/api/v1alpha1
110+
version: v1alpha1
103111
version: "3"

api/v1alpha1/assignment_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ type AssignmentSpec struct {
4343
// AssignmentStatus defines the observed state of Assignment
4444
type AssignmentStatus struct {
4545
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
46+
47+
//optional
48+
GitIssueStatus GitIssueStatus `json:"gitIssueStatus,omitempty"`
4649
}
4750

4851
//+kubebuilder:object:root=true

api/v1alpha1/configschema_types.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
Copyright 2023 microsoft.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// ConfigSchemaSpec defines the desired state of ConfigSchema
24+
type ConfigSchemaSpec struct {
25+
//+kubebuilder:pruning:PreserveUnknownFields
26+
//+kubebuilder:validation:MinLength=0
27+
Schema string `json:"schema"`
28+
}
29+
30+
// ConfigSchemaStatus defines the observed state of ConfigSchema
31+
type ConfigSchemaStatus struct {
32+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
33+
// Important: Run "make" to regenerate code after modifying this file
34+
}
35+
36+
//+kubebuilder:object:root=true
37+
//+kubebuilder:subresource:status
38+
39+
// ConfigSchema is the Schema for the configschemas API
40+
type ConfigSchema struct {
41+
metav1.TypeMeta `json:",inline"`
42+
metav1.ObjectMeta `json:"metadata,omitempty"`
43+
44+
Spec ConfigSchemaSpec `json:"spec,omitempty"`
45+
Status ConfigSchemaStatus `json:"status,omitempty"`
46+
}
47+
48+
//+kubebuilder:object:root=true
49+
50+
// ConfigSchemaList contains a list of ConfigSchema
51+
type ConfigSchemaList struct {
52+
metav1.TypeMeta `json:",inline"`
53+
metav1.ListMeta `json:"metadata,omitempty"`
54+
Items []ConfigSchema `json:"items"`
55+
}
56+
57+
func init() {
58+
SchemeBuilder.Register(&ConfigSchema{}, &ConfigSchemaList{})
59+
}

api/v1alpha1/deploymenttarget_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ type DeploymentTargetSpec struct {
3434
Environment string `json:"environment"`
3535

3636
Manifests map[string]string `json:"manifests"`
37+
38+
// +optional
39+
ConfigSchemas []string `json:"configSchemas"`
3740
}
3841

3942
type ManifestsSpec struct {

api/v1alpha1/gitopsrepo_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ type GitOpsRepoStatus struct {
6262
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
6363
}
6464

65+
type GitIssueStatus struct {
66+
IssueNo int `json:"issueNo,omitempty"`
67+
ContentHash string `json:"contentHash,omitempty"`
68+
}
69+
6570
//+kubebuilder:object:root=true
6671
//+kubebuilder:subresource:status
6772

api/v1alpha1/workload_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
// WorkloadSpec defines the desired state of Workload
2727
type WorkloadSpec struct {
2828
DeploymentTargets []DeploymentTargetDetail `json:"deploymentTargets,omitempty"`
29+
// +optional
30+
ConfigSchemas []string `json:"configSchemas"`
2931
}
3032

3133
type DeploymentTargetDetail struct {

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 115 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/scheduler.kalypso.io_assignments.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ spec:
120120
- type
121121
type: object
122122
type: array
123+
gitIssueStatus:
124+
description: optional
125+
properties:
126+
contentHash:
127+
type: string
128+
issueNo:
129+
type: integer
130+
type: object
123131
type: object
124132
type: object
125133
served: true

0 commit comments

Comments
 (0)