-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(package-operator): add fields to package info crd and manifest s…
…chema
- Loading branch information
Showing
9 changed files
with
507 additions
and
17 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,73 @@ | ||
/* | ||
Copyright 2024. | ||
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 ( | ||
"github.com/invopop/jsonschema" | ||
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" | ||
) | ||
|
||
// JSON wraps the apiextensionsv1.JSON type so we can create a custom JSONSchema function | ||
type JSON struct { | ||
apiextensionsv1.JSON `json:"-"` | ||
} | ||
|
||
func (JSON) JSONSchema() *jsonschema.Schema { | ||
return &jsonschema.Schema{ | ||
Type: "object", | ||
AdditionalProperties: jsonschema.TrueSchema, | ||
} | ||
} | ||
|
||
type HelmManifest struct { | ||
// RepositoryUrl is the remote URL of the helm repository. This is the same URL you would use | ||
// if you use "helm repo add ...". | ||
RepositoryUrl string `json:"repositoryUrl" jsonschema:"required"` | ||
// ChartName is the name of the chart that represents this package. | ||
ChartName string `json:"chartName" jsonschema:"required"` | ||
// ChartVersion of the chart that should be installed. | ||
ChartVersion string `json:"chartVersion" jsonschema:"required"` | ||
// Values that should be used for the helm release | ||
Values JSON `json:"values,omitempty"` | ||
} | ||
|
||
type KustomizeManifest struct { | ||
} | ||
|
||
// PackageEntrypoint defines a service port a user may use to access the package | ||
type PackageEntrypoint struct { | ||
// Name of this entrypoint. Used for "glasskube open [package-name] [entypoint-name]" if more | ||
// than one entrypoint exists. Optional if the package only has one entrypoint. | ||
Name string `json:"name,omitempty"` | ||
// ServiceName is the name of a service that is part of | ||
ServiceName string `json:"serviceName" jsonschema:"required"` | ||
// Port of the service to bind to | ||
Port int32 `json:"port" jsonschema:"required"` | ||
} | ||
|
||
type PackageManifest struct { | ||
Name string `json:"name" jsonschema:"required"` | ||
ShortDescription string `json:"shortDescription,omitempty"` | ||
IconUrl string `json:"iconUrl,omitempty"` | ||
// Helm instructs the controller to create a helm release when installing this package. | ||
Helm HelmManifest `json:"helm,omitempty"` | ||
// Kustomize instructs the controller to apply a kustomization when installing this package [PLACEHOLDER]. | ||
Kustomize KustomizeManifest `json:"kustomize,omitempty"` | ||
// DefaultNamespace to install the package. May be overridden. | ||
DefaultNamespace string `json:"defaultNamespace,omitempty" jsonschema:"required"` | ||
Entrypoints []PackageEntrypoint `json:"entrypoints,omitempty"` | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.